确定 Pod 故障的原因
determine the Reason for Pod Failure
我在默认命名空间中有一个损坏的 pod。我想将关联的错误事件存储到文件 error.txt。我需要在我的命令中使用 -o 宽输出说明符。
我看到这样的命令
- kubectl get pod termination-demo -o go-template="{{range
.status.containerStatuses}}{{.lastState.terminated.message}}{{end}}"
但我需要使用 -o wide 命令。
不确定你想要实现什么:
如果您的目标是将内容放入文件中,您可以将输出重定向到文件:
kubectl get pod termination-demo -o go-template="{{range.status.containerStatuses}}{{.lastState.terminated.message}}{{end}} > error.txt
如果要实现pod状态:
kubectl get pod -n <NAMESPACE> <POD> --output=wide -o go-template="{{range.status.containerStatuses}}{{.lastState.terminated.message}}{{end}}" > pod.err
验证方式:
$ cat pod.err
我在默认命名空间中有一个损坏的 pod。我想将关联的错误事件存储到文件 error.txt。我需要在我的命令中使用 -o 宽输出说明符。 我看到这样的命令
- kubectl get pod termination-demo -o go-template="{{range
.status.containerStatuses}}{{.lastState.terminated.message}}{{end}}"
但我需要使用 -o wide 命令。
不确定你想要实现什么:
如果您的目标是将内容放入文件中,您可以将输出重定向到文件:
kubectl get pod termination-demo -o go-template="{{range.status.containerStatuses}}{{.lastState.terminated.message}}{{end}} > error.txt
如果要实现pod状态:
kubectl get pod -n <NAMESPACE> <POD> --output=wide -o go-template="{{range.status.containerStatuses}}{{.lastState.terminated.message}}{{end}}" > pod.err
验证方式:
$ cat pod.err