post image January 6, 2022 | 1 min Read

Kubernetes docker-registry like secret

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

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''

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

author image

Jan Toth

I have been in DevOps related jobs for past 6 years dealing mainly with Kubernetes in AWS and on-premise as well. I spent quite a lot …

comments powered by Disqus