minikube如何设置阿里云镜像以及如何解决dashboard无法打开的解决方案_已设置图床

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=true
                  k8s-app=kubernetes-dashboard
                  pod-template-hash=6f4c897964
Annotations:      
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:2e500d29e9d5f4a086b908eb8dfe7ecac57d2ab09d65b24f588b1d449841ef93
    Image ID:      
    Port:          9090/TCP
    Host Port:     0/TCP
    Args:
      --namespace=kubernetes-dashboard
      --enable-skip-login
      --disable-settings-authorizer
    State:          Waiting
      Reason:       ImagePullBackOff
    Ready:          False
    Restart Count:  0
    Liveness:       http-get http://:9090/ delay=30s timeout=30s period=10s #success=1 #failure=3
    Environment:    
    Mounts:
      /tmp from tmp-volume (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-t4grc (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  tmp-volume:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:     
    SizeLimit:  
  kube-api-access-t4grc:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              kubernetes.io/os=linux
Tolerations:                 node-role.kubernetes.io/master:NoSchedule
                             node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.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 minikube
  Warning  Failed     16m (x4 over 32m)    kubelet            Error: ErrImagePull
  Warning  Failed     15m (x8 over 32m)    kubelet            Error: ImagePullBackOff
  Normal   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 canceled
  Normal   Pulling    7m42s (x6 over 38m)  kubelet            Pulling image "docker.io/kubernetesui/dashboard:v2.7.0@sha256:2e500d29e9d5f4a086b908eb8dfe7ecac57d2ab09d65b24f588b1d449841ef93"

解决思路

把节点需要的镜像拉取了就好,这边给出本人使用的解决方法,比较拐弯莫叫,仅供参考

  1. 拉取了所需要的镜像到本地

    minikube如何设置阿里云镜像以及如何解决dashboard无法打开的解决方案_已设置图床_第1张图片

    • 接下来把这个镜像制作成压缩包

    • docker save -o k.tar kubernetesui/dashboard:v2.7.0
      
  2. minikube如何设置阿里云镜像以及如何解决dashboard无法打开的解决方案_已设置图床_第2张图片

  3. 在当前终端运行这个来使得当前终端的镜像构建与minikube同步,这个命令可以将本地的镜像构建同步到minikube中我们加载本地目录下的压缩包为镜像,minikube中也能获取到他

    eval $(minikube docker-env)
    
  4. minikube如何设置阿里云镜像以及如何解决dashboard无法打开的解决方案_已设置图床_第3张图片

    • 然后加载它

    •  docker load -i k.tar
      
  5. minikube如何设置阿里云镜像以及如何解决dashboard无法打开的解决方案_已设置图床_第4张图片

  6. minikube如何设置阿里云镜像以及如何解决dashboard无法打开的解决方案_已设置图床_第5张图片

  7. 接下来再运行

  8. minikube dashboard
    
  9. 如果自动弹出失败,就把url复制到浏览器中打开

  10. minikube如何设置阿里云镜像以及如何解决dashboard无法打开的解决方案_已设置图床_第6张图片

你可能感兴趣的:(k8s踩坑日志,阿里云,云计算)