<p>I would like to access multiple remote registries to pull images. 
In the k8s <a href="https://kubernetes.io/docs/concepts/containers/images/" rel="nofollow noreferrer">documentation</a> they say:</p>

<blockquote>
  <p>(If you need access to multiple registries, you can create one secret
  for each registry. Kubelet will merge any imagePullSecrets into a
  single virtual .docker/config.json)</p>
</blockquote>

<p>and so the POD definition should be something like this:</p>

<pre><code>apiVersion: v1
kind: Pod
spec:
  containers:
    - name: ...
  imagePullSecrets:
    - name: secret1
    - name: secret2
    - ....
    - name: secretN
</code></pre>

<p>Now I am not sure how K8S will pick the right secret for each image? will all secrets be verified one by one each time? and how K8S will handle the failed retries? and if a specific amount of unauthorized retries could lead to some lock state in k8sor docker registries?</p>

<p>/ Thanks</p>

<p>You can use following script to add two authentications in one secret</p>

<pre><code>#!/bin/bash

u1="user_1_here"
p1="password_1_here"
auth1=$(echo -n "$u1:$p1" | base64 -w0)

u2="user_2_here"
p2="password_2_here"
auth2=$(echo -n "$u2:$p2" | base64 -w0)

cat &lt;&lt;EOF &gt; docker_config.json
{
  "auths": {
    "repo1_name_here": {
      "auth": "$auth1"
    },
    "repo2_name_here": {
      "auth": "$auth2"
    }
  }
}
EOF

base64 -w0 docker_config.json &gt; docker_config_b64.json

cat &lt;&lt;EOF | kubectl apply -f -
apiVersion: v1
type: kubernetes.io/dockerconfigjson
kind: Secret
data:
  .dockerconfigjson: $(cat docker_config_b64.json)
metadata:
  name: specify_secret_name_here
  namespace: specify_namespace_here
EOF
</code></pre>
