minikube如何设置阿里云镜像以及如何解决dashboard无法打开的解决方案
minikube dashboard
报错
consider@consider-Dell-G15-5511:~$ minikube dashboard
🤔 正在验证 dashboard 运行情况 ...
🚀 正在启动代理...
🤔 正在验证 proxy 运行状况 ...❌ 因 SVC_URL_TIMEOUT 错误而退出:http://127.0.0.1:33619/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/ 不可访问:Temporary Error: unexpected response code: 503
此处运行排查问题
kubectl get pods --all-namespaces
consider@consider-Dell-G15-5511:~$ kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-65c54cc984-5vs9p 1/1 Running 0 37m
kube-system etcd-minikube 1/1 Running 0 37m
kube-system kube-apiserver-minikube 1/1 Running 0 37m
kube-system kube-controller-manager-minikube 1/1 Running 0 37m
kube-system kube-proxy-7qgmq 1/1 Running 0 37m
kube-system kube-scheduler-minikube 1/1 Running 0 37m
kube-system storage-provisioner 1/1 Running 0 37m
kubernetes-dashboard dashboard-metrics-scraper-7db978b848-cjq2q 1/1 Running 0 37m
kubernetes-dashboard kubernetes-dashboard-6f4c897964-gzmwn 0/1 ImagePullBackOff 0 37m
可以看到是这个节点问题,报镜像拉取错误
kubernetes-dashboard kubernetes-dashboard-6f4c897964-gzmwn
检查一下节点日志
consider@consider-Dell-G15-5511:~$ kubectl describe --namespace=kubernetes-dashboard po kubernetes-dashboard-6f4c897964-gzmwn
Name: kubernetes-dashboard-6f4c897964-gzmwn
Namespace: kubernetes-dashboard
Priority: 0
Service Account: kubernetes-dashboard
Node: minikube/192.168.49.2
Start Time: Mon, 02 Oct 2023 18:07:57 +0800
Labels: gcp-auth-skip-secret=truek8s-app=kubernetes-dashboardpod-template-hash=6f4c897964
Annotations: <none>
Status: Pending
IP: 172.17.0.3
IPs:IP: 172.17.0.3
Controlled By: ReplicaSet/kubernetes-dashboard-6f4c897964
Containers:kubernetes-dashboard:Container ID: Image: docker.io/kubernetesui/dashboard:v2.7.0@sha256:2e500d29e9d5f4a086b908eb8dfe7ecac57d2ab09d65b24f588b1d449841ef93Image ID: Port: 9090/TCPHost Port: 0/TCPArgs:--namespace=kubernetes-dashboard--enable-skip-login--disable-settings-authorizerState: WaitingReason: ImagePullBackOffReady: FalseRestart Count: 0Liveness: http-get http://:9090/ delay=30s timeout=30s period=10s #success=1 #failure=3Environment: <none>Mounts:/tmp from tmp-volume (rw)/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-t4grc (ro)
Conditions:Type StatusInitialized True Ready False ContainersReady False PodScheduled True
Volumes:tmp-volume:Type: EmptyDir (a temporary directory that shares a pod's lifetime)Medium: SizeLimit: <unset>kube-api-access-t4grc:Type: Projected (a volume that contains injected data from multiple sources)TokenExpirationSeconds: 3607ConfigMapName: kube-root-ca.crtConfigMapOptional: <nil>DownwardAPI: true
QoS Class: BestEffort
Node-Selectors: kubernetes.io/os=linux
Tolerations: node-role.kubernetes.io/master:NoSchedulenode.kubernetes.io/not-ready:NoExecute op=Exists for 300snode.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:Type Reason Age From Message---- ------ ---- ---- -------Normal Scheduled 38m default-scheduler Successfully assigned kubernetes-dashboard/kubernetes-dashboard-6f4c897964-gzmwn to minikubeWarning Failed 16m (x4 over 32m) kubelet Error: ErrImagePullWarning Failed 15m (x8 over 32m) kubelet Error: ImagePullBackOffNormal BackOff 15m (x9 over 32m) kubelet Back-off pulling image "docker.io/kubernetesui/dashboard:v2.7.0@sha256:2e500d29e9d5f4a086b908eb8dfe7ecac57d2ab09d65b24f588b1d449841ef93"Warning Failed 10m (x5 over 32m) kubelet Failed to pull image "docker.io/kubernetesui/dashboard:v2.7.0@sha256:2e500d29e9d5f4a086b908eb8dfe7ecac57d2ab09d65b24f588b1d449841ef93": rpc error: code = Unknown desc = context canceledNormal Pulling 7m42s (x6 over 38m) kubelet Pulling image "docker.io/kubernetesui/dashboard:v2.7.0@sha256:2e500d29e9d5f4a086b908eb8dfe7ecac57d2ab09d65b24f588b1d449841ef93"
解决思路
把节点需要的镜像拉取了就好,这边给出本人使用的解决方法,比较拐弯莫叫,仅供参考
-
拉取了所需要的镜像到本地
-
-
接下来把这个镜像制作成压缩包
-
docker save -o k.tar kubernetesui/dashboard:v2.7.0
-
-
在当前终端运行这个来使得当前终端的镜像构建与minikube同步,这个命令可以将本地的镜像构建同步到minikube中我们加载本地目录下的压缩包为镜像,minikube中也能获取到他
eval $(minikube docker-env)
-
-
然后加载它
-
docker load -i k.tar
-
-
-
接下来再运行
-
minikube dashboard
-
如果自动弹出失败,就把url复制到浏览器中打开
-