- Deploying Mongoose with Helm
- About Helm
- Steps to deploy
- Debugging
- Releasing
- Issue tracking
Mongoose can be deployed in a kubernetes cluster. Deploy description can be found in the documentation on the mongoose-base repository. One of the ways to deploy an application on kubernetes is to use helm.
Helm is the package manager for Kubernetes.
helm
- client tool running on your workstation
tiller
(only for helm 2) - server component running on kubernetes cluster
charts
- packages
release
- instance of chart
Below are the steps to deploy a mongoose-storage-driver-pravega on kubernetes using the chart.
Note: since helm is a kubernetes package manager, kubectl tool must first be installed on the current maschine and a k8s cluster deployed.
Сlient installation. Get the latest tarball from https://github.com/helm/helm/releases
wget https://get.helm.sh/helm-v3.2.4-linux-amd64.tar.gz
tar -xzf helm-*
sudo mv linux-amd64/helm /usr/local/bin/
For helm 2: Next command will install Tiller in the cluster. Note: Tiller is installed by default in the kubectl context cluster. Accordingly, the machine must be switched to the cluster context (see command
kubectl config use-context [cluster-name]
). Otherwise, you may get errors.helm init
To install a chart, you can run the helm install
command. Helm has several ways to find and install a chart, but the easiest is to use one of the chart registry.
By default helm use stable/
repo with url: https://kubernetes-charts.storage.googleapis.com
Note:
helm repo add stable https://kubernetes-charts.storage.googleapis.com/
Adding our repo:
helm repo add emc-mongoose https://emc-mongoose.github.io/mongoose-helm-charts/
Or update repo:
helm repo update
To check chart:
$ helm search repo mongoose
NAME CHART VERSION APP VERSION DESCRIPTION
emc-mongoose/mongoose 0.1.9 4.2.17 Mongoose is a horizontally scalable and configu...
emc-mongoose/mongoose-pravega alpha 4.2.17 Mongoose chart with Pravega storage driver and ...
emc-mongoose/mongoose-service 0.1.11 4.2.18 Chart for deploying mongoose-nodes
To get more information:
$ helm inspect chart emc-mongoose/mongoose
apiVersion: v1
appVersion: 4.2.17
description: Mongoose is a horizontally scalable and configurable performance testing
utility.
home: https://github.com/emc-mongoose/mongoose
name: mongoose
version: 0.1.9
To install chart (create kubernetes object defined in a chart):
helm install [release-name] --namespace [namespace-name] emc-mongoose/mongoose-service [args]
or with random name and default namespace
helm install --generate-name emc-mongoose/mongoose-service [args]
and you can see list of releases with command:
$ helm ls -A -a
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
mongoose mongoose 1 2020-07-28 16:20:43.0715076 +0300 STD deployed mongoose-service-0.1.11 4.2.18
mongoose-service-1595942475 default 1 2020-07-28 16:21:19.298276 +0300 STD deployed mongoose-service-0.1.11 4.2.18
It is also possible to install a chart from source.
git clone https://github.com/emc-mongoose/mongoose-helm-charts.git
helm install [release-name] --namespace [namespace-name] mongoose-helm-charts/mongoose-service
Note: It is strongly recommended to remove the releases with the help of helm. If the release was installed with command
helm install
and will be removed withkubectl
, it can lead to unexpected behavior.
helm uninstall --namespace [namespace-name] [release-name]
!!! All subsequent parameterization steps are available for all charts in this repo
Mongoose service is deployed by default with type LoadBalancer. To specify other service type, use option service.type
:
helm install mongoose emc-mongoose/mongoose --set service.type=NodePort ...
By default the chart uses the mongoose-base
image. To specify a custom image, use the following parameters:
helm install mongoose emc-mongoose/mongoose \
--set image.name=emcmongoose/mongoose-storage-driver-pravega
where emcmongoose/mongoose-storage-driver-pravega
- name of docker image
To set mongoose CLI arguments use helm argument --set args=...
:
helm install mongoose \
emc-mongoose/mongoose \
--set "args=\"--storage-driver-limit-concurrency=5\"\,\"--load-step-limit-time=60s\""
Example with custom image:
helm install mongoose \
emc-mongoose/mongoose \
--set "args=\"--storage-net-node-addrs=<x.y.z.j>\"\,\"--storage-namespace=scope4\"\,\"--load-step-limit-time=10s\"" \
--set "image.name=emcmongoose/mongoose-storage-driver-pravega"
Mongoose supports custom scenarios. There are 3 ways to supply the scenario to mongoose:
-
Sending the scenario content via the REST API (mongoose service mode) (see REST API ) The option #2 may require external connectivity so the additional option is necessary.
-
Prepare the custom mongoose image containing the scenario which is required need to run. (see Custom image)
-
Specifying the file via the command line (mongoose interactive mode):
With scenario
option:
helm install mongoose emc-mongoose/mongoose --set scenario='$(cat <custom_scenario>.js)'
With values.yaml
overwriting:
scenario: 'while(true) {
Load.config(
{"load":{
"step":{
"limit":{
"time": 1
}
}
}
}).run();
}'
helm install -n mongoose emc-mongoose/mongoose --values values.yaml
Limitations: Inside the scenario, use only double quotes ("), or escape single quotes (\').
To get list of all chart parameters:
$ helm inspect values emc-mongoose/mongoose
As a result, a values.yaml
is displayed, each of whose parameters can be overridden with --set <key1.key2.<...>.keyN>=<value>
command.
########################################################
#### Default values for demo-chart.
########################################################
#### Number of Mongoose replicas to deploy
replicas: 1
#### Since mongoose version 4 there is one image for controller and for peer (driver) nodes
#### The mongoose image configuration
image:
name: emcmongoose/mongoose-base
tag: "latest"
pullPolicy: Always
pod:
name: mongoose-node
service:
name: mongoose-svc
type: LoadBalancer
resources:
limits:
cpu: "4"
memory: "4Gi"
requests:
cpu: "4"
memory: "4Gi"
serviceAccount : ""
debug: false
################## Mongoose CLI args ##################
args: ""
############### Mongoose scenario #####################
scenario: 'Load.run();'
Note: about serviceAccount
Mongoose can be deployed in 2 ways (charts):
-
mongoose
chart - Classic way - That is, helm deploys several additional nodes at once and one entry node, from which the scenario and, accordingly, the load immediately starts to run. -
mongoose-service
chart - Service mode (with Remote API). Helm deploys several mongoose nodes that are pending a request. The load starts after a remote request. And after the end of the scenario, these nodes go into pending state again.
As can be seen from the replicas
parameter, Mongoose by default run in standalone mode with count of node = "1".
To change count of Mongoose node use parametr --set "replicas=<int>"
helm install mongoose emc-mongoose/mongoose --set "replicas=4"
Let's see the list of pods
NAME READY STATUS RESTARTS AGE
mongoose 0/1 Completed 0 11s
mongoose-node-0 1/1 Running 0 11s
mongoose-node-1 1/1 Running 0 11s
mongoose-node-2 1/1 Running 0 11s
It creates pods
mongoose
- entry nodemongoose-node-<>
- additional node
To use mongoose with REST, it is needed to deploy one (standalone mode) or more (distributed mode) nodes with a key --run-node
. After that, they are waiting for requests. External access is provided through the service (mongoose-entry-node-svc
). Internal access for internal mongoose-node communication is provided through the service (mongoose-svc
, ClusterIP type). The node with 0 serial number (mongoose-node-0
) is selected as the entry node. And the mongoose-entry-node-svc
communicates with this node, all the requests come to mongoose-node-0
.
To deploy Mongoose as service (--run-node
) use mongoose-service
chart:
helm install mongoose emc-mongoose/mongoose-service --set replicas=3
With command kubectl get -n mongoose pods
you can see inforamtion about running pods (mongoose-node
). For this example:
NAME READY STATUS RESTARTS AGE
mongoose-node-0 1/1 Running 0 11s
mongoose-node-1 1/1 Running 0 11s
mongoose-node-2 1/1 Running 0 11s
With command kubectl get -n mongoose svc
you can see inforamtion about running service (mongoose-entry-node-svc
). For this example:
NAME | TYPE | CLUSTER-IP | EXTERNAL-IP | PORT(S) | AGE |
---|---|---|---|---|---|
mongoose-entry-node-svc | LoadBalancer | a.b.c.d | x.y.z.j | 9999:31687/TCP | 25m |
By default, the type of service is the
LoadBalancer
, but it can be changed.
To run mongoose scenario it is needed to send HTTP-requests to the external ip x.y.z.j (see Remote API). For example:
curl -v -X POST http://x.y.z.j:9999/run
Example of mongoose defaults.yaml
for distributed mode:
...
load:
step:
node:
addrs:
- mongoose-node-1.mongoose-svc
- mongoose-node-2.mongoose-svc
...
REST API doc: https://github.com/emc-mongoose/mongoose-base/tree/master/doc/usage/api/remote
helm template --debug mongoose-helm-charts/mongoose ...
See more in the helm docs.
To debug mongoose with some IDE use option debug
. Example:
helm install mongoose emc-mongoose/mongoose-service --set debug=true ...
This option exposes port for mongoose debugging (5005 by default) and run container with entrypoint_debug.sh
.
Note:
master
branch is used to store charts code, andgh-pages
branch as charts repository.
- Ensure that all changes were committed and pushed
- Ensure that the
version: <X.Y.Z>
is changed inChart.yaml
- Ensure the new version documentation is ready
- Merge to the
master
branch - Publish new release in to helm repo (
gh-pages
branch):
cd $PATH_TO_REPO/mongoose-helm-charts/
helm package $CHART_PATH/ # to build the .tgz file and copy it here
git stash -u # save untracked .tgz file
git checkout gh-pages
git stash pop
helm repo index . --url https://emc-mongoose.github.io/mongoose-helm-charts/ # create or update the index.yaml for repo
git add index.yaml *.tgz
git commit -m 'New chart version'
git push
# helm repo add $REPO_NAME https://emc-mongoose.github.io/mongoose-helm-charts/
helm repo update
helm install $REPO_NAME/$CHART_NAME
For example:
- REPO_NAME=emc-mongoose
- CHART_NAME=mongoose
- CHART_PATH=$CHART_NAME/