Solve the failure to create a Dashboard in kubernetes (k8s), and the pod status of the Dashboard is CrashLoopBackOff

1. Background.

 I am doing cloud native development today, and found that the pod status of the Dashboard is CrashLoopBackOff, and record the problem.

Solve the failure to create a Dashboard in kubernetes (k8s), and the pod status of the Dashboard is CrashLoopBackOff 

Second, the solution.

1. First execute: kubectl get pod -A

 kubectl get pod -A

2. Query the error log: kubectl logs -f -n kubernetes-dashboard kubernetes-dashboard-658485d5c7-t7fw7

 kubectl logs -f -n kubernetes-dashboard kubernetes-dashboard-658485d5c7-t7fw7

 3. Found the error reported in the above picture: dial tcp ip: i/o timeout

4. Execute: iptables -L -n --line-numbers | grep dashboard, it is found that it is an ipatables rule problem.

iptables -L -n --line-numbers | grep dashboard

5. According to the above figure, it can be clearly seen that the data packet of the dashboard is directly REJECT (rejected), and it is easy to find the reason, just set it to allow (ACCEPT).

6. Save the existing firewall rules: iptables-save > iptables.rules

iptables-save > iptables.rules

 7. Execute the following command to ensure the default policy is ACCEPT.

iptables -P INPUT ACCEPT

iptables -P FORWARD ACCEPT

iptables -P OUTPUT ACCEPT

8: Execute the command: iptables -F

iptables -F

9. Delete the created dashboard pod and restart the docker, create the dashboard again, and the creation is successful.

 kubectl delete deployment kubernetes-dashboard --namespace=kubernetes-dashboard

 kubectl delete deployment dashboard-metrics-scraper --namespace=kubernetes-dashboard

10. Problem solved.

3. Summary.

A strong geek spirit is a strong business 

 

Guess you like

Origin blog.csdn.net/weixin_42188778/article/details/126935301