Debugging running pods in GKE clusters

minherz
minherz
Feb 11 · 1 min read

For some time now Kubernetes supports ephemeral containers. Starting from Kubernetes version 1.18 the ephemeral pods can be used to debug running pods in addition to a large set of other troubleshooting methods. While GKE already supports Kubernetes 1.18 the kubectl debug command is still unavailable. Mainly because this feature is still marked as Alpha in Kubernetes API. So, what else can you do beside inspecting GKE application logs and traces?

It is possible to access to running pod’s containers from the hosting VM. In GKE most of clusters use COS to run worker nodes. When you SSH’ing to the node you still lack root access as well as many useful utilities that you would need for debugging. In COS you can use the COS toolbox to debug your running pods. The toolbox is initially created to debug the node issues but can be easily converted to the running pod debugging tool. For example, if you need to capture the traffic coming from your pod, do the following:

  1. SSH into the node where the pod runs (use kubectl get po -o wide to see the node name).
  2. Run toolbox.
  3. Install and run tcpdump to capture all packets with source equal to the pod’s IP.
  4. Copy the dump from the node to your workstation.

Google Cloud - Community

Google Cloud community articles and blogs

Google Cloud - Community

A collection of technical articles and blogs published or curated by Google Cloud Developer Advocates. The views expressed are those of the authors and don't necessarily reflect those of Google.

minherz

Written by

minherz

Cloud Engineer in PSO at Google, Specializing in Infrastructure, AppDev, Security and SRE. Horsemanship in a free time.

Google Cloud - Community

A collection of technical articles and blogs published or curated by Google Cloud Developer Advocates. The views expressed are those of the authors and don't necessarily reflect those of Google.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store