今天启动k8s dashboard的时候报错:"no endpoints available for service \"kubernetes-dashboard\""

以下是问题排查步骤:

(1)首先查看pod状态:

kubectl get pods --namespace kube-system

K8s运行dashboard命令启动报错:"no endpoints available for service \"kubernetes-dashboard\""-LMLPHP

发现dashboard没有运行报错,继续查询:

kubectl describe pod kubernetes-dashboard-669f9bbd46-rhmst  --namespace kube-system

K8s运行dashboard命令启动报错:"no endpoints available for service \"kubernetes-dashboard\""-LMLPHP

发现问题是某个镜像拉取失败,问题的原因在于我运行了kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml命令,它需要拉取kubernetes-dashboard-amd64:v1.10.1镜像,这个镜像在国外,网络问题无法拉取。

解决方法:

因为我本机有kubernetes-dashboard-amd64:v1.10.0镜像,所以运行kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.0/src/deploy/recommended/kubernetes-dashboard.yaml命令,问题解决。

K8s运行dashboard命令启动报错:"no endpoints available for service \"kubernetes-dashboard\""-LMLPHP

05-11 19:22