0%

kubernetes 中拉取私有仓库(腾讯云)

官方介绍:https://kubernetes.io/docs/concepts/containers/images/

创建保存仓库地址和密码的secret

1
2
3
4
5
kubectl create secret docker-registry registry-secret --docker-server=registry.cn-shenzhen.aliyuncs.com --docker-username=user-test --docker-password=xxxxxx --docker-email=xxx@xxx.com
--docker-server: 仓库地址
--docker-username: 仓库登陆账号
--docker-password: 仓库登陆密码
--docker-email: 邮件地址(选填)

deployment.yml加入拉取镜像的密钥

1
2
3
4
5
6
7
8
9
10
11
apiVersion: v1
kind: Pod
metadata:
name: foo
namespace: awesomeapps
spec:
containers:
- name: foo
image: janedoe/awesomeapp:v1
imagePullSecrets:
- name: myregistrykey