Post

Kubernetes docker-registry like secret

Kubernetes docker-registry like secret

**Create a Secret by providing credentials on the command line’’

1
2
3
4
5
6
7
k create  secret docker-registry \
private-reg-cred --docker-server=myprivateregistry.com:5000 \
--docker-username=dock_user \
--docker-password=dock_password \
--docker-email=dock_user@myprivateregistry.com

secret/private-reg-cred created

**Edit your custom deployment and provide: imagePullSecrets under container spec’’

1
2
3
4
5
6
7
8
9
10
11
12
13
14
kubectl edit deployment web
...
    spec:
      containers:
      - image: myprivateregistry.com:5000/nginx:alpine
        imagePullPolicy: IfNotPresent
        name: nginx
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      imagePullSecrets:
      - name: private-reg-cred

This post is licensed under CC BY 4.0 by the author.