首先配置私有仓库harbor的secret:
# kubectl create secret docker-registry registry-secret --namespace=default
--docker-server=https://private-registry.domain.com --docker-username=username
--docker-password=password --docker-email=username@abcd.com
部署时指定imagePullSecrets
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
name: service-test
namespace: default
labels:
app: service-test
spec:
replicas: 2
template:
metadata:
labels:
app: service-test
spec:
containers:
- image: private-registry.domain.com/test-private/service-test:1
name: service-test
ports:
- containerPort: 80
imagePullSecrets:
- name: registry-secret