一、根据私有仓库的用户名密码等信息创建secret
kubectl create secret docker-registry my-registry-secret \
--docker-server=xxx.xxx.xxx.xxx \
--docker-username=admin \
--docker-password=Harbor12345 \
--docker-email=xxxx@sina.com
二、在清单文件中使用imagePullSecrets来引入上面这个步骤中创建的secret
apiVersion: v1
kind: Pod
metadata:
name: mypod
spec:
containers:
- name: mycontainer
image: xxx.xxx.xxx.xxx/hive/hello:1.0
imagePullSecrets:
- name: my-registry-secret