Chaos Engineering for Kubernetes Using litmus 2.0
Make sure your kubernetes ready for production
Chaos Engineering
Chaos Engineering is the discipline of experimenting on a system in order to build confidence in the system’s capability to withstand turbulent conditions in production. In sample explanation if you want to deploy an app on the production, you must ensure that sample app can run properly with minimal and maximal resource on your production environment. If your production using kubernetes you can test your production with chaos scenario, such as running one deployment and make sure that deployment run properly.
Litmus 2.0
LitmusChaos is a Cloud-Native Chaos Engineering Framework. Litmus adopts a Kubernetes-native approach to define chaos intent in a declarative manner via custom resources.
Environment
Environment to trying Litmus will use k3s cluster, components:
- 1 node k3s server
- 2 node k3s agent
- kubernetes version : v1.24.6+k3s1
- runtime : containerd://1.6.8-k3s1
ChaosCenter Cluster Scope Installation
Prerequisites
- Kubernetes 1.17 or later
- A Persistent volume of 20GB
- Helm3 or kubectl
Installation using helm3
- Add litmus helm repository
helm repo add litmuschaos https://litmuschaos.github.io/litmus-helm/
helm repo list
- Create namespace for litmus
kubectl create ns litmus
- Install litmus ChaosCenter
helm install chaos litmuschaos/litmus --namespace=litmus --set portal.frontend.service.type=NodePort
Installation using kubectl
- Install litmus ChaosCenter
kubectl apply -f https://litmuschaos.github.io/litmus/2.13.0/litmus-2.13.0.yaml
Verify Installation
- Check the pods
Installation from helm3 will use chaos-litmus-* for resources name and Installation from kubectl will use litmusportal-* for resources name
- Check the services
Accessing the ChaosCenter
- Check services
kubectl get svc -n litmus
To setup and login to ChaosCenter expand the available services just created and copy the PORT
of the litmusportal-frontend-service
service. Once you have the PORT copied in your clipboard, simply use your IP (k3s server node) and PORT in this manner <NODEIP>:<PORT>
to access the Litmus ChaosCenter.
Example
http://10.10.11.11:30385/
The default credentials are
Username : admin
Password : litmus
Running pre-defined chaos scenario
- Open litmus Chaos Center
- Go to Chaos Scenarios > Schedule a Chaos scenario
- Choose a Chaos Delegate
- Schedule a new Chaos Scenario
You can choose scenario from pre-defined Chaos-scenario templates, cloning existing Chaos scenario, using experiments from ChaosHubs, or import a Chaos scenario using YAML
- Chaos scenario settings, edit name and description for scenario
- Tune Chaos scenario
- Reliability Score, to set points of scenario
- Choose a new Chaos Scenario, you can set schedule of scenario for now or later
- Verify and Commit
- Litmus will run the workflow
- Result
What next?
in the next article we’ll show implementation chaos engineering using another tools such as kraken. Stay Tune
By Razzaaq Arditian, Research Team Btech
Our Tagline
Continuous Learning