kubectl describe pod -n kube-flannel kube-flannel-ds-fr5sb
Failed to pull image “192.168.35.14/test/flannel-cni-plugin:v1.2.0”: Error response from daemon: unauthorized: unauthorized to access repository: test/flannel-cni-plugin, action: pull: unauthorized to access repository: test/flannel-cni-plugin, action: pull
最直接的解决方法,在每一个节点,手动把所有镜像都拉取到本地
K8s 集群一般会管理多个节点,每个节点都有自己的 docker 环境。如果让用户分别到集群节点上登录镜像仓库,这显然是很不方便的。
K8s 实现私有镜像自动拉取
~/.docker/config.json是用于存储docker registry的认证信息
cat /root/.docker/config.json | base64 -w 0
在主节点创建harbor登录Secret对象。它主要用于存储敏感信息,例如密码、秘钥、证书等等。
vim harbor-pull-secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: harbor-pull-secret
data:
.dockerconfigjson: ewoJImF1dGhzIjogewoJCSIxOTIuMTY4LjM1LjE0IjogewoJCQkiYXV0aCI6ICJaM2xvT2tkNWFERXlNelExIgoJCX0sCgkJIm1hc3RlciI6IHsKCQkJImF1dGgiOiAiWjNsb09rZDVhREV5TXpRMSIKCQl9Cgl9Cn0=
type: kubernetes.io/dockerconfigjson
kubectl create -f harbor-pull-secret.yaml
修改yml
vim kube-flann