➜ Create Nginx Server with Docker Image
➜ Run container-kill experiment on pod
- Kubernetes/kubectl
-
Create an nginx namepsace
kubectl create namespace nginx
-
Create deployment with nginx image
kubectl create deployment nginx --image=nginx -n nginx
-
Check pod was created successfully and has a ready and running status
kubectl get pods --all-namespaces
-
Create service
kubectl create service nodeport nginx --tcp=80:80 -n nginx
-
Check service was created successfully
kubectl get svc -n nginx
-
Apply the LitmusChaos Operator manifest
kubectl apply -f https://litmuschaos.github.io/litmus/litmus-operator-v1.9.0.yaml
-
Verify Litmus installation
#ChaosOperator running kubectl get pods -n litmus #Chaos CRDs installed kubectl get crds | grep chaos #Chaos resources created kubectl api-resources | grep chaos
-
Install Experiments
kubectl apply -f https://hub.litmuschaos.io/api/chaos/1.9.0\?file\=charts/generic/experiments.yaml -n nginx #verify experiments are installed kubectl get chaosexperiments -n nginx
-
Setup Service Account
#create rbac.yaml file.yaml and apply it kubectl apply -f rbac.yaml #annotate application kubectl annotate deploy/nginx litmuschaos.io/chaos="true" -n nginx
-
Prepare Chaos Engine and run it
#create chaosengine.yaml and apply manifest kubectl apply -f chaosengine.yaml
-
Observe Results (Takes a few seconds for command to turnover, results initially in
await
state)kubectl describe chaosengine nginx-chaos -n nginx kubectl describe chaosresult nginx-chaos-container-kill -n nginx #to save results to file: kubectl describe chaosengine nginx-chaos -n nginx > chaosengine.txt kubectl describe chaosresult nginx-chaos-container-kill -n nginx > chaosresult.txt
-
Uninstall
kubectl delete -f https://litmuschaos.github.io/litmus/litmus-operator-v1.9.0.yaml kubectl delete chaosengine --all -n nginx kubectl delete chaosengine --all -n litmus kubectl delete namespaces nginx