0%

Kubernetes pull an Image from a Private Registry

k8s拉取带验证的镜像方式

  1. 创建验证信息
1
2
3
kubectl create secret docker-registry regcred --docker-server=<your-registry-server> --docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email>
# 如果Pod是在namespace下面的,则要添加对应namespace
kubectl --namespace create secret ...
  1. 创建Pod增加使用验证信息
1
2
3
4
5
6
7
8
9
10
apiVersion: v1
kind: Pod
metadata:
name: private-reg
spec:
containers:
- name: private-reg-container
image: <your-private-image>
imagePullSecrets:
- name: regcred

参考资料

https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/