<p>I'm trying to deploy an image into IBM Cloud kubernetes instance.</p>

<p>First I created and pushed an image ...</p>

<pre class="lang-sh prettyprint-override"><code>$ ic cr images
Listing images...

REPOSITORY                                    NAMESPACE     TAG      DIGEST         CREATED          SIZE     VULNERABILITY STATUS   
registry.ng.bluemix.net/my_namespace/my_app   my_namespace  latest   123456789012   56 minutes ago   264 MB   Vulnerable   

OK
</code></pre>

<p>Then ...</p>

<pre class="lang-sh prettyprint-override"><code>$ ic cs cluster-config my_cluster
$ export KUBECONFIG=/Users/me/.bluemix/plugins/container-service/clusters/my_cluster/kube-config-mil01-my_cluster.yml

$ kubectl run my_app --image=registry.ng.bluemix.net/my_namespace/my_app \
          --port=8080 --generator=run/v1
replicationcontroller/my_app created
</code></pre>

<p>And ...</p>

<pre class="lang-sh prettyprint-override"><code>$ kubectl get pods
NAME          READY     STATUS         RESTARTS   AGE
my_app-zvqwq  0/1       ErrImagePull   0          38s
</code></pre>

<p>Although my region is <code>us-south</code> ...</p>

<pre><code>$ ic target

API endpoint:      https://api.ng.bluemix.net   
Region:            us-south   
User:              me@email.com   
</code></pre>

<p>... interestingly the cluster was created in milan ...</p>

<pre><code>$ ic cs clusters
OK
Name          ID               State    Created          Workers   Location   Version   
my_cluster    xxxxxxxxxxxxxx   normal   55 minutes ago   1         mil01      1.9.9_1520 
</code></pre>

<hr>

<p><strong>Update</strong> Thanks to <a href="https://stackoverflow.com/users/5545087/bloodysock">Bloodysock</a> here is some more debug info: </p>

<blockquote>
  <p>Failed to pull image "registry.ng.bluemix.net/my_namespace/my_app": rpc error: code = Unknown desc = Error response from daemon: Get <a href="https://registry.ng.bluemix.net/v2/my_namespace/my_app/manifests/latest" rel="nofollow noreferrer">https://registry.ng.bluemix.net/v2/my_namespace/my_app/manifests/latest</a>: unauthorized: authentication required</p>
</blockquote>

<p>However, I can't see in the <a href="https://console.bluemix.net/docs/containers/cs_app.html#app" rel="nofollow noreferrer">docs</a> how to setup authentication for the IBM Container Registry.</p>

Chris Snow
<p>The message <code>unauthorized: authentication required</code> suggests that your pod doesn't have a valid ImagePullSecret for the US South (ng) registry. Since your cluster was created in Milan, the secret that is installed by IKS when you create your cluster may well be for the EU Central (eu-de) registry, rather than US South.</p>

<p>If you have the ability to view secrets in your cluster, you can check the contents of the automatically installed ImagePullSecret by running <code>kubectl get secret bluemix-default-secret-regional -o yaml | grep .dockercfg: | awk '{print $2}' | base64 --decode</code>. This command gets the secret called <code>bluemix-default-secret-regional</code>, extracts the <code>.dockercfg</code> field, and then decodes the base64 encoded secret value.</p>

<p>You can create additional ImagePullSecrets and optionally add them to your default ServiceAccount in order for them to be automatically used by your cluster. For instructions, see <a href="https://console.bluemix.net/docs/containers/cs_images.html#other_regions_accounts" rel="nofollow noreferrer">here</a>.</p>

<p>By the way, your cluster might have been created in Milan if your <code>ic cs</code> plugin is targeting the EU Central region for IKS. You can view what IKS region you're using with <code>ic cs region</code>, and change it with <code>ic cs region-set</code>.</p>
