Thursday, July 22, 2021

create secret for container images

 you can create a secret (similar to configmap but with hashing) and use that in deployment container specification as imagePullSecrets.


kubectl create secret docker-registry <acr-mysecret> --docker-server=mycustomlinux.azurecr.io --docker-username=<username> --docker-password=<password>


Reference deployment yaml file

You can create a secret using yaml also.
But you need to do the encryption to base64 yourself.
Or else, you can create using above command and export it using below command and then remove all the unnecessary shit inside it.

kubectl get secret <secret_name> --output=yaml


apiVersion: v1
data:
  .dockerconfigjson: configvaluewithbase64
kind: Secret
metadata:
  name: <mysecret>
type: kubernetes.io/dockerconfigjson

Ref

No comments:

Post a Comment