kubernetes通过私有仓库harbor拉取镜像

 

   首先配置私有仓库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

 

posted on 2017-10-25 09:38  走心的狗  阅读(4143)  评论(0编辑  收藏  举报

导航