项目作者: emc-mongoose

项目描述 :
The repository that contains the helm charts for automatic Mongoose deployment on a k8s cluster.
高级语言: Smarty
项目地址: git://github.com/emc-mongoose/mongoose-helm-charts.git
创建时间: 2019-05-27T10:14:03Z
项目社区:https://github.com/emc-mongoose/mongoose-helm-charts

开源协议:MIT License

下载


Table of Contents

Deploying Mongoose with Helm

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.


About Helm

Helm is the package manager for Kubernetes.

Helm 3 release

Basic terms:

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.


Steps to deploy

Install Helm

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

  1. wget https://get.helm.sh/helm-v3.2.4-linux-amd64.tar.gz
  2. tar -xzf helm-*
  3. 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.

  1. helm init

Using Repo

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:

  1. helm repo add emc-mongoose https://emc-mongoose.github.io/mongoose-helm-charts/

Or update repo:

  1. helm repo update

To check chart:

  1. $ helm search repo mongoose
  2. NAME CHART VERSION APP VERSION DESCRIPTION
  3. emc-mongoose/mongoose 0.1.9 4.2.17 Mongoose is a horizontally scalable and configu...
  4. emc-mongoose/mongoose-pravega alpha 4.2.17 Mongoose chart with Pravega storage driver and ...
  5. emc-mongoose/mongoose-service 0.1.11 4.2.18 Chart for deploying mongoose-nodes

To get more information:

  1. $ helm inspect chart emc-mongoose/mongoose
  2. apiVersion: v1
  3. appVersion: 4.2.17
  4. description: Mongoose is a horizontally scalable and configurable performance testing
  5. utility.
  6. home: https://github.com/emc-mongoose/mongoose
  7. name: mongoose
  8. version: 0.1.9

To install chart (create kubernetes object defined in a chart):

  1. helm install [release-name] --namespace [namespace-name] emc-mongoose/mongoose-service [args]

or with random name and default namespace

  1. helm install --generate-name emc-mongoose/mongoose-service [args]

and you can see list of releases with command:

  1. $ helm ls -A -a
  2. NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
  3. mongoose mongoose 1 2020-07-28 16:20:43.0715076 +0300 STD deployed mongoose-service-0.1.11 4.2.18
  4. mongoose-service-1595942475 default 1 2020-07-28 16:21:19.298276 +0300 STD deployed mongoose-service-0.1.11 4.2.18

Installation from sources (good for tests)

It is also possible to install a chart from source.

  1. git clone https://github.com/emc-mongoose/mongoose-helm-charts.git
  2. helm install [release-name] --namespace [namespace-name] mongoose-helm-charts/mongoose-service

Remove release

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 with kubectl, it can lead to unexpected behavior.

  1. helm uninstall --namespace [namespace-name] [release-name]

Detailed Mongoose installation

Parametrisation

!!! All subsequent parameterization steps are available for all charts in this repo

Custom service type

Mongoose service is deployed by default with type LoadBalancer. To specify other service type, use option service.type:

  1. helm install mongoose emc-mongoose/mongoose --set service.type=NodePort ...

Custom image

By default the chart uses the mongoose-base image. To specify a custom image, use the following parameters:

  1. helm install mongoose emc-mongoose/mongoose \
  2. --set image.name=emcmongoose/mongoose-storage-driver-pravega

where emcmongoose/mongoose-storage-driver-pravega - name of docker image

CLI arguments

To set mongoose CLI arguments use helm argument --set args=...:

  1. helm install mongoose \
  2. emc-mongoose/mongoose \
  3. --set "args=\"--storage-driver-limit-concurrency=5\"\,\"--load-step-limit-time=60s\""

Example with custom image:

  1. helm install mongoose \
  2. emc-mongoose/mongoose \
  3. --set "args=\"--storage-net-node-addrs=<x.y.z.j>\"\,\"--storage-namespace=scope4\"\,\"--load-step-limit-time=10s\"" \
  4. --set "image.name=emcmongoose/mongoose-storage-driver-pravega"

Custom scenario

Mongoose supports custom scenarios. There are 3 ways to supply the scenario to mongoose:

  1. 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.

  2. Prepare the custom mongoose image containing the scenario which is required need to run. (see Custom image)

  3. Specifying the file via the command line (mongoose interactive mode):

With scenario option:

  1. helm install mongoose emc-mongoose/mongoose --set scenario='$(cat <custom_scenario>.js)'

With values.yaml overwriting:

  1. scenario: 'while(true) {
  2. Load.config(
  3. {"load":{
  4. "step":{
  5. "limit":{
  6. "time": 1
  7. }
  8. }
  9. }
  10. }).run();
  11. }'
  1. helm install -n mongoose emc-mongoose/mongoose --values values.yaml

Limitations: Inside the scenario, use only double quotes (“), or escape single quotes (\‘).

List of all params

To get list of all chart parameters:

  1. $ 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.

  1. ########################################################
  2. #### Default values for demo-chart.
  3. ########################################################
  4. #### Number of Mongoose replicas to deploy
  5. replicas: 1
  6. #### Since mongoose version 4 there is one image for controller and for peer (driver) nodes
  7. #### The mongoose image configuration
  8. image:
  9. name: emcmongoose/mongoose-base
  10. tag: "latest"
  11. pullPolicy: Always
  12. pod:
  13. name: mongoose-node
  14. service:
  15. name: mongoose-svc
  16. type: LoadBalancer
  17. resources:
  18. limits:
  19. cpu: "4"
  20. memory: "4Gi"
  21. requests:
  22. cpu: "4"
  23. memory: "4Gi"
  24. serviceAccount : ""
  25. debug: false
  26. ################## Mongoose CLI args ##################
  27. args: ""
  28. ############### Mongoose scenario #####################
  29. scenario: 'Load.run();'

Note: about serviceAccount


Distributed mode

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.

More about distributed mode

Classic installation

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>"

  1. helm install mongoose emc-mongoose/mongoose --set "replicas=4"

Let’s see the list of pods

  1. NAME READY STATUS RESTARTS AGE
  2. mongoose 0/1 Completed 0 11s
  3. mongoose-node-0 1/1 Running 0 11s
  4. mongoose-node-1 1/1 Running 0 11s
  5. mongoose-node-2 1/1 Running 0 11s

It creates pods

  • mongoose - entry node
  • mongoose-node-<> - additional node
Design

high level design

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.

Usage

To deploy Mongoose as service (--run-node) use mongoose-service chart:

  1. 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:

  1. NAME READY STATUS RESTARTS AGE
  2. mongoose-node-0 1/1 Running 0 11s
  3. mongoose-node-1 1/1 Running 0 11s
  4. 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:

  1. curl -v -X POST http://x.y.z.j:9999/run

Example of mongoose defaults.yaml for distributed mode:

  1. ...
  2. load:
  3. step:
  4. node:
  5. addrs:
  6. - mongoose-node-1.mongoose-svc
  7. - mongoose-node-2.mongoose-svc
  8. ...

REST API doc: https://github.com/emc-mongoose/mongoose-base/tree/master/doc/usage/api/remote


Debugging

  1. helm template --debug mongoose-helm-charts/mongoose ...

See more in the helm docs.

Mongoose debugging

To debug mongoose with some IDE use option debug. Example:

  1. 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.

More


Releasing

Note: master branch is used to store charts code, and gh-pages branch as charts repository.

0) Ensure that all changes were committed and pushed
1) Ensure that the version: <X.Y.Z> is changed in Chart.yaml
2) Ensure the new version documentation is ready
3) Merge to the master branch
4) Publish new release in to helm repo (gh-pages branch):

  1. cd $PATH_TO_REPO/mongoose-helm-charts/
  2. helm package $CHART_PATH/ # to build the .tgz file and copy it here
  3. git stash -u # save untracked .tgz file
  4. git checkout gh-pages
  5. git stash pop
  6. helm repo index . --url https://emc-mongoose.github.io/mongoose-helm-charts/ # create or update the index.yaml for repo
  7. git add index.yaml *.tgz
  8. git commit -m 'New chart version'
  9. git push
  10. # helm repo add $REPO_NAME https://emc-mongoose.github.io/mongoose-helm-charts/
  11. helm repo update
  12. helm install $REPO_NAME/$CHART_NAME

For example:

  • REPO_NAME=emc-mongoose
  • CHART_NAME=mongoose
  • CHART_PATH=$CHART_NAME/

Issue tracking

https://mongoose-issues.atlassian.net/projects/HELM/issues