Microk8s ImagePullBackOff 无法通过修改配置修复

问题描述

我已经在 ubuntu(arm64 位版本)上安装了 microk8s,我想访问 microk8s enable registry 提供的本地镜像注册表。但是我收到 ImagePullBackOff 错误,我尝试修改 /var/snap/microk8s/current/args/containerd.toml 配置,但它不起作用:

[plugins.cri.registry]
  [plugins.cri.registry.mirrors]
    [plugins.cri.registry.mirrors."docker.io"]
      endpoint = ["https://registry-1.docker.io"]
    [plugins.cri.registry.mirrors."localhost:32000"]
      endpoint = ["http://localhost:32000"]
    [plugins.cri.registry.mirrors."192.168.0.45:32000"]
      endpoint = ["http://192.168.0.45:32000"]
    [plugins.cri.registry.configs."192.168.0.45:32000".tls]
      insecure_skip_verify = true

我的豆荚状态:

microk8s.kubectl describe pod myapp-7d655f6ccd-gpgkx
Name:         myapp-7d655f6ccd-gpgkx
Namespace:    default
Priority:     0
Node:         192.168.0.66/192.168.0.66
Start Time:   Mon,15 Mar 2021 16:53:30 +0000
Labels:       app=myapp
              pod-template-hash=7d655f6ccd
Annotations:  <none>
Status:       Pending
IP:           10.1.54.7
IPs:
  IP:           10.1.54.7
Controlled By:  replicaset/myapp-7d655f6ccd
Containers:
  myapp:
    Container ID:   
    Image:          192.168.0.45:32000/myapp:latest
    Image ID:       
    Port:           9000/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       ImagePullBackOff
    Ready:          False
    Restart Count:  0
    Limits:
      memory:  384Mi
    Requests:
      memory:  128Mi
    Environment:
      REdis:                       redis
      MysqL:                       MysqL
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-dn4bk (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  default-token-dn4bk:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-dn4bk
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason     Age                 From               Message
  ----     ------     ----                ----               -------
  normal   Scheduled  15m                 default-scheduler  Successfully assigned default/myapp-7d655f6ccd-gpgkx to 192.168.0.66
  normal   Pulling    14m (x4 over 15m)   kubelet            Pulling image "192.168.0.45:32000/myapp:latest"
  Warning  Failed     14m (x4 over 15m)   kubelet            Failed to pull image "192.168.0.45:32000/myapp:latest": rpc error: code = UnkNown desc = Failed to resolve image "192.168.0.45:32000/myapp:latest": no available registry endpoint: Failed to do request: Head "https://192.168.0.45:32000/v2/myapp/manifests/latest": http: server gave HTTP response to HTTPS client
  Warning  Failed     14m (x4 over 15m)   kubelet            Error: ErrImagePull
  Warning  Failed     13m (x6 over 15m)   kubelet            Error: ImagePullBackOff
  normal   BackOff    20s (x63 over 15m)  kubelet            Back-off pulling image "192.168.0.45:32000/myapp:latest"

版本信息:

microk8s.kubectl version
Client Version: version.Info{Major:"1",Minor:"18",GitVersion:"v1.18.15",GitCommit:"73dd5c840662bb066a146d0871216333181f4b64",GitTreeState:"clean",BuildDate:"2021-01-13T13:22:41Z",GoVersion:"go1.13.15",Compiler:"gc",Platform:"linux/arm64"}
Server Version: version.Info{Major:"1",BuildDate:"2021-01-13T13:14:05Z",Platform:"linux/arm64"}

好像是想用https代替http。

如何在带有 containerd 的 microk8s 中使用不安全选项?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)