Mazen Ezzeddine
Mazen Ezzeddine

Reputation: 822

Kubernetes autoscaling and logs of created / deleted pods

I am implementing a Kubernetes based solution where I am autoscaling a deployment based on a dynamic metric. I am running this deployment with autoscaling capabilities against a workload for 15 minutes. During this time, pods of this deployment are created and deleted dynamically as a result of the deployment autoscaling decisions.

I am interested in saving (for later inspection) of the logs of each of the dynamically created (and potentially deleted) pods occuring in the course of the autoscaling experiment.

If the deployment has a label like app=myapp , can I run the below command to store all the logs of my deployment?

kubectl logs -l app=myapp  > myfile.txt

Any other more reliable suggestion (without the overhead of manual central logging solution) ? I am runnig on goole kubernetes engine GKE, Does the GKE keep the logs of deleted pods?

Thank you.

Upvotes: 1

Views: 642

Answers (1)

coderanger
coderanger

Reputation: 54249

Yes, by default GKE sends logs for all pods to Stackdriver and you can view/query them there.

Upvotes: 3

Related Questions