What are the different values of "imagePullSecrets" and what does "regsecret" do?

1/24/2019

So I am trying to understand two parts:

  1. What are the different types of values that can be put into "imagePullSecrets"? What does each one do?

  2. What in particular does "regsecret" value for "imagePullSecrets" do?

Thank you!

-- cody.tv.weber
kubernetes
kubernetes-secrets

1 Answer

1/25/2019

imagePullSecrets is the parameter which has to be used to invoke authorization token, also known as a secret, that stores Docker credentials that are used for accessing Docker registry inside Kubernetes Pod configuration.

kubectl create secret docker-registry <SECRET_NAME> --docker-server=<FQDN_DOCKER_SERVER> --docker-username=<USER_NAME> --docker-password=<USER_PASSWORD> --docker-email=<USER_EMAIL>

I assume that regsecret equals SECRET_NAME from above command line example, which defines Kubernetes secret:

NAME                  TYPE                                  DATA      AGE
<SECRET_NAME>         kubernetes.io/dockercfg               1         5d

Finally to revoke data from secret just needs imagePullSecrets to be included in the corresponded Pod configuration:

apiVersion: apps/v1beta2
  kind: Deployment
  metadata:
    name: nginx-demo
  spec:
    replicas: 1
    selector:
      matchLabels:
        app: nginx
    template:
      metadata:
        labels:
          app: nginx
      spec:
        hostNetwork: false
        containers:
        - name: nginx
          image: <FQDN_DOCKER_SERVER>
        imagePullSecrets:
        - name: <SECRET_NAME>

Related documentation links from official Kubernetes resource:

  1. Overview of Secrets;
  2. Add ImagePullSecrets to a service account;
  3. Using a Private Docker Registry
-- mk_sta
Source: StackOverflow