kubernetes:kubectl没有检索到日志 [英] kubernetes: no log retrieved by kubectl
问题描述
我正在尝试在特定的命名空间上运行一个简单的映像以调试一些问题
I am trying to run a simple image on a specific namespace to debug some issues
kubectl run busy --image busybox --namespace my-local-dev
deployment.apps/busy created
但是由于某些原因,容器会不断重启
However for some reason the container keeps restarting
busy-67b577b945-ng2lt 0/1 CrashLoopBackOff 5 3m
即使使用--previous
标志,我也无法获取任何日志
and I am unable to get any logs, even with the --previous
flag
$ kubectl logs -f --namespace my-local-dev busy-67b577b945-ng2lt --previous
Unable to retrieve container logs for docker://c8b9fce066686b3be01df1ed3343be5ec65607cb203e054fd9365511f77bd4af/home/pkara/Desktop
$ kubectl logs -f --namespace my-local-dev busy-67b577b945-ng2lt
$ _
有什么建议吗?
推荐答案
CrashLoopBackOff
意味着您的pod继续崩溃,并重新启动并再次崩溃.
CrashLoopBackOff
means that your pod continues on crashing and gets restarted and crashes again.
根据崩溃点的不同(例如,很快就会在启动时或稍后在应用程序执行期间),您可能会看到日志,也可能不会看到日志.
Depending on the point of crash, for example soon at startup or later during the execution of your app, you may or may not see the logs.
在这种情况下(未显示日志),您的pod可能没有某些请求的资源可用.例如,它可以是秘密或卷.
In this case (no logs shown) it's likely that your pod has NOT some requested resources available. It may be a secret or a volume, for example.
一种好的方法是观看Kubernetes事件:kubectl get events
A good way is to watch Kubernetes events: kubectl get events
或者以类似的方式描述您的资源并阅读相关事件:kubectl describe pod <pod_name>
,屏幕的最后一部分专用于该资源上的事件.
Or in similar way describe your resource and read the relative events: kubectl describe pod <pod_name>
, the last part of the screen is dedicated to events on that resource.
这篇关于kubernetes:kubectl没有检索到日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!