我有一个在Kubernetes上运行的Golang应用程序,但是当pod死掉时,根本没有错误消息。 我该怎么办?

As titled.

When I run kubectl logs my-go-app-deployment-1967699436-yxxn7 or kubectl logs my-go-app-deployment-1967699436-yxxn7 -p, there are no error log print out at all.

What should I do? What makes a Golang pods crashes?

First you should inspect the pod to see the reason why it died and if it was restarted.

kubectl describe pod my-go-app-deployment-1967699436-yxxn7

Look for entries in Containers -> your container -> Last State.

If it was restarted you might want to check the previous logs as well:

kubectl logs --previous pod my-go-app-deployment-1967699436-yxxn7