K8S YAML use private image registry
Oct 20, 2021
Image Registery
assume you already have a private image registery
and want build a POD use image in this private image registery.
here is how
kubectl create secret docker-registry aliyun181 --docker-server=registry.cn-hangzhou.aliyuncs.com/andydemo/test001 --docker-username=email@com --docker-password=somepassword --docker-email=email@com
this is to create k8s secret for image to use. then in your POD yaml file , specify the imagePullSecrets.
apiVersion: v1
kind: Pod
metadata:
name: busybox1
labels:
app: busybox1
namespace: default
spec:
containers:
- name: web
image: registry.cn-hangzhou.aliyuncs.com/andydemo/test001:latest
imagePullSecrets:
- name: aliyun181