K8S无法拉取私有仓库镜像解决

问题:
K8S部署pod 从Harbor拉取镜像报错:
repository does not exist or may require ‘docker login’: denied: requested access to the resource is denied
解决方法:

  1. 配置添加项目所在命名空间的私有仓库秘钥,以便拉取镜像时完成认证过程
kubectl create secret docker-registry harbor-secret(别名) --namespace=项目所在命名空间 --docker-server=Harbor地址 --docker-username=账户 --docker-password=Harbor密码 
//这里的别名在引用时需要用到,尽可能和命名空间一致
  1. 更新服务yaml文件,添加引用创建的秘钥
    spec:
      containers:
      - image: 
        imagePullPolicy: Always
        name:
      imagePullSecrets:
      - name: harbor-secret    
# k8s  

评论

公众号:mumuser

企鹅群:932154986

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×