Skip to main content
Version: 2.2.0

ChaosCenter Namespace Scope Installation


Prerequisites#

Before deploying LitmusChaos, make sure the following items are there

  • Kubernetes 1.17 or later

  • A Persistent volume of 20GB

    note

    Recommend to have a Persistent volume(PV) of 20GB, You can start with 1GB for test purposes as well. This PV is used as persistent storage to store the chaos config and chaos-metrics in the Portal. By default, litmus install would use the default storage class to allocate the PV. Provide this value

  • Helm3 or kubectl

Installation#

Installation of Litmus can be done using either of the below methods

Install Litmus using Helm #

The helm chart will install all the required service account configuration and ChaosCenter.

The following steps will help you install Litmus ChaosCenter via helm.

Step-1: Add the litmus helm repository#

helm repo add litmuschaos https://litmuschaos.github.io/litmus-helm/helm repo list

Step-2: Create the namespace on which you want to install Litmus ChaosCenter [Required only if namespace isn't there]#

  • The chaoscenter components can be placed in any namespace, though it is typically placed in "litmus".
kubectl create ns litmus

The ChaosCenter can be placed in any namespace, though it is typically placed in litmus. Ignore if you already have the namespace where you want to install Litmus created.

Step-3: Install the required Litmus CRDs#

The cluster-admin or an equivalent user with the right permissions are required to install the CRDs upfront.

kubectl apply -f https://raw.githubusercontent.com/litmuschaos/litmus/master/litmus-portal/litmus-portal-crds.yml
Expected Output
customresourcedefinition.apiextensions.k8s.io/clusterworkflowtemplates.argoproj.io createdcustomresourcedefinition.apiextensions.k8s.io/cronworkflows.argoproj.io createdcustomresourcedefinition.apiextensions.k8s.io/workflows.argoproj.io createdcustomresourcedefinition.apiextensions.k8s.io/workflowtemplates.argoproj.io createdcustomresourcedefinition.apiextensions.k8s.io/chaosengines.litmuschaos.io createdcustomresourcedefinition.apiextensions.k8s.io/chaosexperiments.litmuschaos.io createdcustomresourcedefinition.apiextensions.k8s.io/chaosresults.litmuschaos.io createdcustomresourcedefinition.apiextensions.k8s.io/eventtrackerpolicies.eventtracker.litmuschaos.io created

Step-4: Install Litmus ChaosCenter#

helm install chaos litmuschaos/litmus --namespace=litmus --set portalScope=namespace
Expected Output
NAME: chaosLAST DEPLOYED: Tue Jun 15 19:20:09 2021NAMESPACE: litmusSTATUS: deployedREVISION: 1TEST SUITE: NoneNOTES:Thank you for installing litmus ๐Ÿ˜€
Your release is named chaos and its installed to namespace: litmus.
Visit https://docs.litmuschaos.io/ to find more info.

Note: Litmus uses Kubernetes CRDs to define chaos intent. Helm3 handles CRDs better than Helm2. Before you start running a chaos experiment, verify if Litmus is installed correctly.

Install Litmus using kubectl #

Set the namespace on which you want to install Litmus ChaosCenter#

export LITMUS_PORTAL_NAMESPACE="<namespace>"kubectl get ns ${LITMUS_PORTAL_NAMESPACE}

If the namespace is not already present then create the target namespace kubectl create ns ${LITMUS_PORTAL_NAMESPACE} or kubectl create ns <Your Namespace>

Expected Output
NAME                        STATUS   AGElitmus   Active   79m

Install the required Litmus CRDs#

The cluster-admin or an equivalent user with the right permissions are required to install the CRDs upfront.

kubectl apply -f https://raw.githubusercontent.com/litmuschaos/litmus/master/litmus-portal/litmus-portal-crds.yml
Expected Output
customresourcedefinition.apiextensions.k8s.io/clusterworkflowtemplates.argoproj.io createdcustomresourcedefinition.apiextensions.k8s.io/cronworkflows.argoproj.io createdcustomresourcedefinition.apiextensions.k8s.io/workflows.argoproj.io createdcustomresourcedefinition.apiextensions.k8s.io/workflowtemplates.argoproj.io createdcustomresourcedefinition.apiextensions.k8s.io/chaosengines.litmuschaos.io createdcustomresourcedefinition.apiextensions.k8s.io/chaosexperiments.litmuschaos.io createdcustomresourcedefinition.apiextensions.k8s.io/chaosresults.litmuschaos.io createdcustomresourcedefinition.apiextensions.k8s.io/eventtrackerpolicies.eventtracker.litmuschaos.io created

Install Litmus ChaosCenter#

Applying the manifest file will install all the required service account configuration and ChaosCenter.

curl https://raw.githubusercontent.com/litmuschaos/litmus/master/mkdocs/docs/2.2.0/litmus-namespaced-2.2.0.yaml --output litmus-portal-namespaced-K8s-template.ymlenvsubst '${LITMUS_PORTAL_NAMESPACE}' < litmus-portal-namespaced-K8s-template.yml > ${LITMUS_PORTAL_NAMESPACE}-ns-scoped-litmus-portal-manifest.ymlkubectl apply -f ${LITMUS_PORTAL_NAMESPACE}-ns-scoped-litmus-portal-manifest.yml -n ${LITMUS_PORTAL_NAMESPACE}

You need to export the namespace in order for the above step to work export LITMUS_PORTAL_NAMESPACE="<namespace>". Ignore if already done in the first step.

Expected Output
configmap/litmus-portal-admin-config createddeployment.apps/litmusportal-frontend createdservice/litmusportal-frontend-service createdserviceaccount/litmus-server-account createdrole.rbac.authorization.k8s.io/litmus-server createdrolebinding.rbac.authorization.k8s.io/litmus-server-rb createddeployment.apps/litmusportal-server createdservice/litmusportal-server-service createdstatefulset.apps/mongo createdservice/mongo-service created

Verify your installation#


Verify if the frontend, server, and database pods are running#

  • Check the pods in the namespace where you installed Litmus:

    kubectl get pods -n litmus
    Expected Output
    NAME                                    READY   STATUS  RESTARTS  AGElitmusportal-frontend-97c8bf86b-mx89w   1/1     Running 2         6m24slitmusportal-server-5cfbfc88cc-m6c5j    2/2     Running 2         6m19smongo-0                                 1/1     Running 0         6m16s
  • Check the services running in the namespace where you installed Litmus:

    kubectl get svc -n litmus
    Expected Output
    NAME                            TYPE        CLUSTER-IP      EXTERNAL-IP PORT(S)                       AGElitmusportal-frontend-service   NodePort    10.100.105.154  <none>      9091:30229/TCP                7m14slitmusportal-server-service     NodePort    10.100.150.175  <none>      9002:30479/TCP,9003:31949/TCP 7m8smongo-service                   ClusterIP   10.100.226.179  <none>      27017/TCP                     7m6s

Note: With the namespace mode of the control panel, we need to set the endpoint of the chaos center server according to the use case. By default, it is http://litmusportal-server-service:9002

To alter, Apply:

kubectl set env deployment/litmusportal-server -n litmus --containers="graphql-server" PORTAL_ENDPOINT="http://172.132.44.44:3231"

Verify Successful Registration of the Self Agent post Account Configuration#

Once the project is created, the cluster is automatically registered as a chaos target via installation of ChaosAgents. This is represented as Self-Agent in ChaosCenter.

kubectl get pods -n litmus
NAME                                     READY   STATUS    RESTARTS   AGEchaos-exporter-547b59d887-4dm58          1/1     Running   0          5m27schaos-operator-ce-84ddc8f5d7-l8c6d       1/1     Running   0          5m27sevent-tracker-5bc478cbd7-xlflb           1/1     Running   0          5m28slitmusportal-frontend-97c8bf86b-mx89w    1/1     Running   0          15mlitmusportal-server-5cfbfc88cc-m6c5j     2/2     Running   1          15mmongo-0                                  1/1     Running   0          15msubscriber-958948965-qbx29               1/1     Running   0          5m30sworkflow-controller-78fc7b6c6-w82m7      1/1     Running   0          5m32s

Resources#

Learn more#