DEV Community

tejendrab
tejendrab

Posted on

Chaos Tools & LinkerD

Experiments using chaos tools & LinkerD in your environment

Install linkerD on your setup using linkerD & Kubernetes CLI

curl -sL https://run.linkerd.io/install | sh

Next, add linkerd to your path with:
export PATH=$PATH:$HOME/.linkerd2/bin

If you use Homebrew, you can instead download and install the CLI with:
brew install linkerd
To verify the linkerd is running fine you check version with the below command :
linkerd version

Validate your K8 cluster

To check that your cluster is configured correctly and ready to install the control plane, you can run:
linkerd check --pre

Install Linkerd onto the cluster

linkerd install | kubectl apply -f -

validate the installation by running:
linkered check
components were installed, you can run:
kubectl -n linkerd get deploy

Linkerd Dashboard

Explore Linkerd
linkerd dashboard &

Install the application or demo application

Install emojivoto into the emojivoto namespace by running:
curl -sL https://run.linkerd.io/emojivoto.yml \
| kubectl apply -f -

Before we mesh it, let's take a look at the app. If you're using Docker Desktop at this point you can visit http://localhost directly. If you're not using Docker Desktop, we'll need to forward the web-svc service. To forward web-svc locally to port 8080, you can run:

kubectl -n emojivoto port-forward svc/web-svc 8080:80

Next, let's add Linkerd to emojivoto by running:

kubectl get -n emojivoto deploy -o yaml \
| linkerd inject - \
| kubectl apply -f -

you can replace your deployment or application name with the emojivoto.

Insights ::
How you can inject the faults to your application

  1. Either using an ingress ( installed on your local or namespace)
  2. Or you can utilize the UI of the application if you have one like emojivto.

In my case there was a local NGINX - host application is installed so initiating the same and using it as ingress host,

Injecting chaos experiment

kubectl apply -f kubectl apply -f https://hub.litmuschaos.io/api/chaos/1.6.2?file=charts/generic/pod-network-latency/experiment.yaml -n emojivoto

Now after this setup the RBAC
kubectl apply -f https://hub.litmuschaos.io/api/chaos/1.6.2?file=charts/generic/pod-network-latency/rbac.yaml

Edit the RBAC with the namespace you are applying the experiments.

kubectl apply -f rbac.yaml

Now create a chaosEngine using the below :
kubectl apply -f https://hub.litmuschaos.io/api/chaos/1.6.2?file=charts/generic/pod-network-latency/rbac.yaml

1.set the annotationcheck=false
2.set the applable

  • kgp -n emojivoto --show--lables
    • app=emojvoto.svc 3.target container
  • describe the above pod and get the container ID
    1. Check the latency timings edit according to your comfort and requirements.

Now try ping the application
kubectl get pods
kubectl exec -it NGINX POD
kubectl get pods -n emojivto -o wide
get the IP for voting or UI/ F/E IP for the applications

Now run the fault to the application

kubectl apply -f chaosengine.yaml

This will apply the chaosenperiment as given and the latency will be induced by PUMBA and delay will be see in ping and from the linkerD portal we can see the grafana graph.

Top comments (0)