Nexus Docker私服配置+K8S拉取私服镜像
# Nexus创建Docker私服
hosted
# K8S拉取私服Docker
如果你的docker私服是http协议 需要每台物理机 vi /etc/docker/daemon.json
添加 "insecure-registries":["192.168.1.177:30303"],
systemctl daemon-reload
systemctl restart docker
# 创建secret
kubectl create secret docker-registry <secret-name> --docker-server=<your-registry-server> --docker-username=<docker-username> --docker-password=<docker-password> --docker-email=<your-email>
1
secret-name:k8s Secret的名称标识字段
your-registry-server:私服docker仓库地址
docker-username:docker登录用户
docker-password:docker密码
your-email:邮件地址
# 使用secret
apiVersion: v1
kind: Pod
metadata:
name: test-private-registry
spec:
containers:
- name: private-reg-container
image: <your-registry-server>/tomcat:8.5.34-alpine
imagePullSecrets:
- name: <secret-name>
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
上次更新: 10/23/2024