You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Kubernetes新手求助:Dashboard出现CrashLoopBackOff问题

解决Kubernetes Dashboard CrashLoopBackOff问题

Hey there, let's troubleshoot your Dashboard CrashLoopBackOff issue step by step. First, let's gather some critical info to narrow down the root cause, then go through common fixes tailored to your Ubuntu 16.04 cluster setup.

Step 1: Collect Diagnostic Information

First, run these commands to get key details about your cluster and the problematic Dashboard pod:

# Get full Kubernetes version details
kubectl version

# List all pods in the kube-system namespace to get the exact Dashboard pod name
kubectl get pods -n kube-system

# Fetch detailed status and event logs for the Dashboard pod
kubectl describe pod <YOUR-DASHBOARD-POD-NAME> -n kube-system

# Check the pod's application logs for error messages
kubectl logs <YOUR-DASHBOARD-POD-NAME> -n kube-system

Share the output of these if the below fixes don't resolve the issue, but let's start with the most likely culprits for your environment.

Step 2: Fix Docker-Kubernetes Version Compatibility

You mentioned you intended to install Docker 17.03, but ended up with 17.12.1-ce. Kubernetes has strict version compatibility rules, and 17.12 isn't in the supported Docker versions for older Kubernetes releases (the ones that work smoothly with Ubuntu 16.04). Let's roll back Docker to the intended compatible version:

# Uninstall the current Docker version
sudo apt-get purge -y docker-ce

# Install Docker 17.03.2-ce (verified compatible with most kubeadm-setup clusters on Xenial)
sudo apt-get install -y docker-ce=17.03.2~ce-0~ubuntu-xenial

# Restart Docker to apply the change
sudo systemctl restart docker

After this, restart the Dashboard pod to let it use the updated Docker environment:

kubectl delete pod <YOUR-DASHBOARD-POD-NAME> -n kube-system

Step 3: Verify Swap is Fully Disabled

Even if you ran swapoff -a and commented out the swap line in /etc/fstab, sometimes kubelet might not pick up the change properly. Let's confirm:

# Check if swap is still active on the node
free -h

# Inspect kubelet status for swap-related error messages
sudo systemctl status kubelet

If swap is still active, double-check your /etc/fstab (ensure the swap entry starts with #), then run:

sudo swapoff -a
sudo mount -a
sudo systemctl daemon-reload
sudo systemctl restart kubelet

Step 4: Fix RBAC Permissions

By default, kubeadm enables RBAC, and the Dashboard's service account doesn't have sufficient permissions to run properly. Create a cluster role binding to grant it the necessary admin access:

kubectl create clusterrolebinding dashboard-admin --clusterrole=cluster-admin --serviceaccount=kube-system:kubernetes-dashboard

Restart the Dashboard pod afterward to apply the new permissions.

Step 5: Resolve Image Pull Issues

If the kubectl describe pod output shows ImagePullBackOff, it means the cluster can't pull the Dashboard image from k8s.gcr.io. Switch to a domestic mirror to fix this:

  1. Edit the Dashboard deployment:
    kubectl edit deployment kubernetes-dashboard -n kube-system
    
  2. Find the image field (looks like k8s.gcr.io/kubernetes-dashboard-amd64:<VERSION>) and replace it with:
    registry.cn-hangzhou.aliyuncs.com/google_containers/kubernetes-dashboard-amd64:<VERSION>
    
    Make sure to keep the version number identical to the original entry.
  3. Save and exit the editor— the deployment will automatically restart the pod with the new image source.

Step 6: Check for Resource Constraints

If your worker nodes have limited CPU or memory, the Dashboard pod might be getting OOM-killed. Check node resource usage:

kubectl top nodes

If nodes are low on resources, you can either add more resources to the nodes or adjust the Dashboard pod's resource requests/limits in its deployment configuration.


内容的提问来源于stack exchange,提问作者Steve Maring

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 04:00:34