How to Isolate a Pod in Production for Debugging using kubectl

FoxuTech
2 min readJul 21, 2024

--

This article shows a nifty technique for live debugging Pods running in production using labels.

The Scenario:

Imagine you have a Deployment with three Pods, all labeled with app=tech. A Service routes traffic to these Pods based on this selector.

Isolating a Pod:

  • Use kubectl label pod <pod-name> app=debug --overwrite to change the specific Pod’s label to app=debug.
  • Consequences:
  • The Service stops sending traffic because its selector (app=tech) no longer matches the isolated Pod’s label (app=debug).
  • The ReplicaSet notices a missing replica (only two Pods with app=tech label) and creates a new one to maintain the desired number of running Pods (originally 3).

The Outcome:

  • You end up with four Pods:
  • 3 Pods running production traffic (labeled app=tech).
  • 1 isolated Pod (labeled app=debug) that was previously receiving traffic but is now isolated.

Continue reading on https://foxutech.com/how-to-isolate-a-pod-in-production-for-debugging-using-kubectl/

If you like our posts, don’t forget to subscribe and share with your friends.

You can subscribe us on https://www.youtube.com/@FoxuTech

Follow us on Twitter & Instagram

--

--

FoxuTech
FoxuTech

Written by FoxuTech

Discuss about #Linux, #DevOps, #Docker, #kubernetes, #HowTo’s, #cloud & IT technologies like #argocd #crossplane #azure https://foxutech.com/

No responses yet