K8S|k8s——排错指南

一般的k8s排错步骤:查看node状态→查看pod状态→查看kubelet系统日志
一、常用命令: 1、查看各节点状态:kubectl get node
2、查看node事件:kubectl describe node
3、查看Pod状态:kubectl get pod -o wide
4、查看Pod事件:kubectl describe pod
5、查看Pod日志文件:kubectl logs -f
6、进入pod内部:kubectl exec -it /bin/bash
7、查看系统Kubelet 日志: journalctl -l -u kubelet -n 1000
8、查询副本编辑器:kubectl get rc
9、修改rc环境变量: kubectl edit pod | grep
二、常见错误: 1、The connection to the server localhost:8080 was refused - did you specify the right host or port?

1. echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile 2. source ~/.bash_profile

2、#failed to read pod IP from plugin/docker: NetworkPlugin cni failed on the status hook for pod “nginx-ingress-controller-7bff4d7c6-n7g62_default”: CNI failed to retrieve network namespace path: cannot find network namespace for the terminated container
重启docker服务
systemctl restart docker

【K8S|k8s——排错指南】k8s pod排除指南

    推荐阅读