Question 1: K8S cluster service access failed?
Cause analysis: the certificate cannot be recognized. The reasons are: user-defined certificate, expiration, etc.
Solution: just update the certificate.
Question 2: K8S cluster service access failed?
curl: (7) Failed connect to 10.103.22.158:3000; Connection refused
Cause analysis: port mapping error, the service works normally, but the service cannot be provided.
Solution: delete svc and remap ports.
kubectl delete svc nginx-deployment
Q3: K8S cluster service exposure failure?
Error from server (AlreadyExists): services "nginx-deployment" already exists
Cause analysis: the container has exposed the service.
Solution: delete svc and remap ports.
Question 4: the external network cannot access the services provided by the K8S cluster?
Cause analysis: the type of K8S cluster is ClusterIP, and the service is not exposed to the external network.
Solution: just change the type of K8S cluster to NodePort, so you can access the service through all K8S cluster nodes.
kubectl edit svc nginx-deployment
Question 5: is the pod status ErrImagePull?
readiness-httpget-pod 0/1 ErrImagePull 0 10s
Cause analysis: image cannot be pulled;
Solution: replace the image.
Question 6: after the init C container is created, its state is abnormal?
NAME READY STATUS RESTARTS AGE myapp-pod 0/1 Init:0/2 0 20s
Cause analysis: check the log and find that the pod is always initializing; Then view the details of the pod and locate the reason why the creation of the pod failed: the initialization container was not completed.
Error from server (BadRequest): container "myapp-container" in pod "myapp-pod" is waiting to start: PodInitializing
waiting for myservice Server: 10.96.0.10 Address: 10.96.0.10:53 ** server can't find myservice.default.svc.cluster.local: NXDOMAIN *** Can't find myservice.svc.cluster.local: No answer *** Can't find myservice.cluster.local: No answer *** Can't find myservice.default.svc.cluster.local: No answer *** Can't find myservice.svc.cluster.local: No answer *** Can't find myservice.cluster.local: No answer
Method: create relevant service s and write the name of SVC to the coreDNS server of K8S cluster, so coreDNS can perform domain name resolution on the initC container of POD.
kubectl apply -f myservice.yaml
NAME READY STATUS RESTARTS AGE myapp-pod 0/1 Init:1/2 0 27m myapp-pod 0/1 PodInitializing 0 28m myapp-pod 1/1 Running 0 28m
Question 7: detect whether the status of the surviving pod is CrashLoopBackOff?
Cause analysis: the image problem causes the container restart failure.
Solution: replace the image.
#Q8: POD creation failed?
readiness-httpget-pod 0/1 Pending 0 0s readiness-httpget-pod 0/1 Pending 0 0s readiness-httpget-pod 0/1 ContainerCreating 0 0s readiness-httpget-pod 0/1 Error 0 2s readiness-httpget-pod 0/1 Error 1 3s readiness-httpget-pod 0/1 CrashLoopBackOff 1 4s readiness-httpget-pod 0/1 Error 2 15s readiness-httpget-pod 0/1 CrashLoopBackOff 2 26s readiness-httpget-pod 0/1 Error 3 37s readiness-httpget-pod 0/1 CrashLoopBackOff 3 52s readiness-httpget-pod 0/1 Error 4 82s
Cause analysis: the container cannot be started due to the image problem.
Solution: replace the mirror.
Question 9: did the ready status of POD enter?
readiness-httpget-pod 0/1 Running 0 116s
Cause analysis: the POD failed to execute the command and failed to obtain resources.
Solution: go inside the container and create yaml defined resources
Q10: failed to create pod?
Cause analysis: yml file content error - use Chinese characters;
Solution: modify the content of myregistrykey.
11. The status of the Kube flannel DS AMD64 ndsf7 plug-in pod is Init:0/1?
Cause analysis: k8s-slave1 node failed to pull the image.
Solution: log in k8s-slave1, restart the docker service, and manually pull the image.
K8s master node, just reinstall the plug-in.
kubectl create -f kube-flannel.yml;kubectl get nodes
12. K8S creates a service status of ErrImagePull?
Troubleshooting ideas:
kubectl describe pod test-nginx
Cause analysis: there is a problem in pulling the image name.
Solution: delete the wrong pod; Re pull the image;
kubectl delete pod test-nginx;kubectl run test-nginx --image=10.0.0.81:5000/nginx:alpine
13. Cannot enter the specified container?
Cause analysis: the comcontainers field in the yml file is repeated, resulting in that the pod does not have the container.
Solution: remove the redundant containers field in the yml file and regenerate the pod.
14. Failed to create PV?
Cause analysis: the name field of pv is duplicate.
Solution: modify the name field of pv.
15. Can't pod mount PVC?
Cause analysis: the pod cannot mount PVC.
The accessModes are inconsistent with the available PV, which makes it impossible to mount the PVC. Since only PV larger than 1G and the accessModes are RWO can be mounted, only one pod can be successfully created, and the second pod is consistent with pending. When it is created in sequence, the third pod has not been created;
Solution: modify the accessModes in the yml file or the accessModes of PV.
16. Question: after using PV, pod cannot access its content?
Cause analysis: there are no files in the nfs volume or the permissions are incorrect.
Solution: create a file in the nfs volume and grant permissions.
17. Failed to view node status?
Error from server (NotFound): the server could not find the requested resource (get services http:heapster:)
Cause analysis: there is no heapster service.
Solution: install promethus monitoring component.
18. pod is always in 'pending' status?
Cause analysis: no node can be scheduled because the same image has been used to publish the pod.
Solution: delete all pod s and deploy them.
19. helm failed to install components?
[root@k8s-master01 hello-world]# helm install Error: This command needs 1 argument: chart nam [root@k8s-master01 hello-world]# helm install ./ Error: no Chart.yaml exists in directory "/root/hello-world"
Cause analysis: the file name format is incorrect.
Solution: MV chart yaml Chart. yaml
Reference link:
https://mp.weixin.qq.com/s/CXmw4pagtA2D4soNu3dejg
19 K8S daily troubleshooting collection!
Source: https://www.cnblogs.com/chalon/p/14415252.html