故障排查-k8s

查看某个资源的定义和⽤法
kubectl explain

查看Pod的状态
kubectl get pods
kubectl describe pods my-pod

监控Pod状态的变化
kubectl get pod -w

可以看到⼀个 namespace 中所有的 pod 的 phase 变化

查看 Pod 的⽇志
kubectl logs my-pod
kubectl logs my-pod -c my-container
kubectl logs -f my-pod
kubectl logs -f my-pod -c my-container

-f 参数可以 follow ⽇志输出

交互式 debug
kubectl exec my-pod -it /bin/bash
kubectl top pod POD_NAME --containers

猜你喜欢

转载自www.cnblogs.com/g2thend/p/12745081.html
k8s