THREAD: How to quarantine a Pod in Kubernetes.
This technique helps you with debugging running Pods in production.
The Pod is detached from the Service (no traffic), and you can troubleshoot it live.
Let's get started!
This technique helps you with debugging running Pods in production.
The Pod is detached from the Service (no traffic), and you can troubleshoot it live.
Let's get started!
1/6
Imagine you have a Deployment with three replicas.
Each Pod has an πππ=πππππ label.
A Service routes the traffic to your Pods using the selector πππ=πππππ
Imagine you have a Deployment with three replicas.
Each Pod has an πππ=πππππ label.
A Service routes the traffic to your Pods using the selector πππ=πππππ
2/6
If you want to isolate a Pod you can overwrite the existing label with: πππππππ πππππ πππ <πππ-ππππ> πππ=πππππ --πππππ ππππ
Two things happen next:
If you want to isolate a Pod you can overwrite the existing label with: πππππππ πππππ πππ <πππ-ππππ> πππ=πππππ --πππππ ππππ
Two things happen next:
3/6
First, the Service stops routing traffic to the Pod because the Service's selector doesn't match the label.
First, the Service stops routing traffic to the Pod because the Service's selector doesn't match the label.
4/6
Then, the ReplicaSet notices that there are only two replicas, but you asked for 3.
The ReplicaSet creates a new Pod.
Then, the ReplicaSet notices that there are only two replicas, but you asked for 3.
The ReplicaSet creates a new Pod.
5/6
At this point, you can debug the Pod live without any traffic interfering with it.
You could use a mix of πππππππ ππ‘ππ, πππππππ ππππ-ππππ πππ or πππππππ πππππ to inspect the running process further.
That's it, only 3 easy steps.
At this point, you can debug the Pod live without any traffic interfering with it.
You could use a mix of πππππππ ππ‘ππ, πππππππ ππππ-ππππ πππ or πππππππ πππππ to inspect the running process further.
That's it, only 3 easy steps.
6/6
Credit for this technique goes to @pjausovec who originally posted it on Reddit:
https://www.reddit.com/r/kubernetes/comments/gt3uvg/how_to_quarantine_pods/
Do you know any clever technique to debug your Pods in production?
Let me know!
Credit for this technique goes to @pjausovec who originally posted it on Reddit:
https://www.reddit.com/r/kubernetes/comments/gt3uvg/how_to_quarantine_pods/
Do you know any clever technique to debug your Pods in production?
Let me know!