Common daily troubleshooting guide for Kubernetes|dry goods sharing|suitable for all kinds of basic personnel to learn

     ▲ Click on the "DevOps and k8s full-stack technology" above to follow the official account

Question 1: Failed to access Kubernetes cluster services?

c87cad34657acb35a0a983bc817612b4.png

03d118ee4555828f70ff4dada54aa083.png

Cause Analysis: The certificate cannot be recognized, the reasons are: custom certificate, expired, etc.
Solution: Just update the certificate.

Question 2: Failed to access Kubernetes cluster services?

curl: (7) Failed connect to 10.103.22.158:3000; Connection refused

Cause Analysis: The port mapping is wrong, and the service works normally, but the service cannot be provided.
Solution: delete the SVC and remap the port.

kubectl delete svc nginx-deployment

Question 3: Does Kubernetes cluster service exposure fail?

Error from server (AlreadyExists): services "nginx-deployment" already exists

Cause Analysis: The container has exposed services.
Solution: delete the SVC and remap the port.

Question 4: The external network cannot access the services provided by the Kubernetes cluster?

Cause analysis: The type of the Kubernetes cluster is ClusterIP, and the service is not exposed to the external network.
Solution: Just change the type of the Kubernetes cluster to NodePort, so the service can be accessed through all Kubernetes cluster nodes.

kubectl edit svc nginx-deployment

Question 4: Pod status is ErrImagePull?

readiness-httpget-pod   0/1     ErrImagePull   0          10s

a61868a9e4e490ae7bc13bf5d2a3ff23.png

Cause analysis: The image cannot be pulled.

9b894e47b5b5483cecb6c85b9a3a3cb6.png

6c297ee08ca8fb35fddd1879ca66ff18.png

Solution: Just replace the mirror image.
Question 5: After creating the init C container, its state is not normal?

NAME READY STATUS RESTARTS AGE
myapp-pod 0/1 Init:0/2 0 20s

Cause analysis: Check the logs and find that the Pod is always being initialized; then check the details of the Pod to locate the reason for the Pod creation failure: the initialization of the container has not completed.

Error from server (BadRequest): container "myapp-container" in pod "myapp-pod" is waiting to start: PodInitializing

Solution: Just replace the mirror image.

Question 6: After creating the init C container, its state is not normal?

NAME READY STATUS RESTARTS AGE
myapp-pod 0/1 Init:0/2 0 20s

Cause analysis: Check the logs and find that the Pod is always being initialized; then check the details of the Pod to locate the reason for the Pod creation failure: the initialization of the container has not completed.

Error from server (BadRequest): container "myapp-container" in pod "myapp-pod" is waiting to start: PodInitializing

83b14489310735c302e79538ce11db08.png

df18e05144308c6af7d69e62c137456e.png

8abbd7cc5908799f6a1fa814261c8241.png

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

Solution: Create a related Service and write the name of the SVC into the CoreDNS server of the Kubernetes cluster, so that CoreDNS can resolve the domain name during the execution of the Pod's init C container.

kubectl apply -f myservice.yaml

Question 7: Is the state of the surviving Pod detected as CrashLoopBackOff?
Cause analysis: The mirroring problem caused the container to fail to restart.
Solution: Just replace the mirror image.

0a321b3310112545cb480999cdfd93ed.png

dde0c450d0a90315eb289634957e1306.png

Question 8: 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 mirroring problems.

3b5eadef20bc8d87b6bc9b9ef932e575.png

Solution: replace the mirror image.

2b4cc3d3405fe0f26f10233295407d2b.png

Question 9: The ready state of the Pod is not entered?

readiness-httpget-pod   0/1     Running   0          116s

Cause analysis: Pod failed to execute the command and could not obtain resources.

Solution: enter the container and create resources defined by yaml. ,

9618168a403c22aafb17cc6b52a80d70.png

3876ab40a7fcaa42cdc932fd246a7a41.png

Question 10: Pod creation failed?

e5bb6240e9a7c30769e9f18229ac0251.png

Cause Analysis: The content of the yml file is wrong——using Chinese characters.
Solution: modify the content of myregistrykey.

7cb48ba333fd51998709e3a9c095b7af.png

Wonderful article recommendation

It's the end of the year, sum up this year, full of harvest

Check out these 11 stats for kubernetes in 2022

GitOps Best Practices on Kuberentes

WeChat public account

   Light up the collection, the server will not be down for 10 yearsc22da0a172f3920fbf10666ab7b92881.gifdd655e0d870abdb626499f18e3142624.gif

Guess you like

Origin blog.csdn.net/weixin_38320674/article/details/128027115
Recommended