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!
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 πšŠπš™πš™=πš‘πšŽπš•πš•πš˜
2/6

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.
4/6

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.
You can follow @danielepolencic.
Tip: mention @twtextapp on a Twitter thread with the keyword β€œunroll” to get a link to it.

Latest Threads Unrolled: