描述: 通过访问私有仓库,模拟secret进行账户密码进行进行打包
1. 创建secret
# kubectl create secret docker-registry harbor-registry --docker-server=registry.aww.com --docker-username=chenfj --docker-password=kyle@admin123456 --docker-email=kyle@123 -n test secret/harbor-registry created
2. 查看secret
# kubectl get secrets -n test NAME TYPE DATA AGE harbor-registry kubernetes.io/dockerconfigjson 1 7m11s
3. 创建Pod,通过镜像仓库拉取
apiVersion: v1 kind: Pod metadata: name: nginx namespace: test spec: containers: - name: nginx image: registry.aww.com/sre/nginx:1.7.9 imagePullSecrets: - name: harbor-registry