问题原文
原帖链接 · four43 · CC BY-SA 3.0
A pod in my Kubernetes cluster is stuck on "ContainerCreating" after running a create. How do I see logs for this operation in order to diagnose why it is stuck? kubectl logs doesn't seem to work since the container needs to be in a non-pending state.
社区高分解答
原帖链接 · Chris Stryczynski · CC BY-SA 4.0
More info could be provided in the events.
kubectl get events --all-namespaces --sort-by='.metadata.creationTimestamp'
However do note that sorting events might not work correctly due to this bug: https://github.com/kubernetes/kubernetes/issues/29838
Alternatively:
As of Kubernetes 1.18 all new objects have metadata for server-side apply, which gives us a new way to sort events:
kubectl get events --sort-by=".metadata.managedFields[0].time"
From: https://github.com/kubernetes/kubernetes/issues/29838#issuecomment-789660546
In my case I had an event relating to a pod:
default 13s Warning FailedMount Pod Unable to mount volumes for pod "restore-db-123-1-5f24s_default(9b7df264-2976-11ea-bb8f-42010a9a002c)": timeout expired waiting for volumes to attach or mount for pod "default"/"restore-db-123-1-5f24s". list of unmounted volumes=[nfsv]. list of unattached volumes=[nfsv default-token-hxrng]
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
