您可以使用以下命令查看pod的pending状态日志:
首先,使用
kubectl get pods命令获取pod名称。然后,使用
kubectl describe pod <pod_name>命令获取pod的详细信息。最后,查找pod事件中与pending状态相关的日志信息。特别是查看包含错误消息或警告的事件。
例如,在下面的例子中,我们将查看名为my-pod的pod的pending状态日志:
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
my-pod 0/1 Pending 0 10m
$ kubectl describe pod my-pod
...
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling 5m (x6 over 10m) default-scheduler 0/2 nodes are available: 2 Insufficient cpu.
Warning FailedScheduling 2m (x5 over 9m58s) default-scheduler 0/2 nodes are available: 2 Insufficient cpu.
Warning FailedScheduling 31s (x7 over 9m28s) default-scheduler 0/2 nodes are available: 2 Insufficient cpu.
...
在这个例子中,我们可以看到my-pod处于pending状态,因为没有足够的CPU资源可用。根据事件日志,我们可以看到该pod被调度了多次,但都失败了,因为没有可用的节点。




