Al Wld
Al Wld

Reputation: 939

How to find the pod that led to an error in GKE

If I look at my logs in GCP logs, I see for instance that I got a request that gave 500

  log_message: "Method: some_cloud_goo.Endpoint failed: INTERNAL_SERVER_ERROR"   

I would like to quickly go to that pod and do a kubectl logs on it. But I did not find a way to do this.

I am fairly new to k8s and GKE, any way to traceback the pod that handled that request?

Upvotes: 4

Views: 1138

Answers (2)

Mr.KoopaKiller
Mr.KoopaKiller

Reputation: 3982

As mentioned in @Neelam answer, you can can get the pod names with the command kubectl get pods -A and log into all your pods to find the error.

Or, alternatively, you could deploy a custom monitoring system like Elastic GKE Logging available in GCP github Click-to-deploy.

See here to install from MarketPlace with few clicks.

It is a free alternative to have a complete monitoring system and you can filter your logs in Kibana dashboard after deployed.

Upvotes: 2

Neelam
Neelam

Reputation: 567

You could run command "kubectl get pods " on each node to check the status of all pods and could figure out accordingly by running for detail description of an error " kubectl describe pod pod-name"

Upvotes: 2

Related Questions