<p>I am trying to use kubectl run command to pull an image from private registry and run a command from that. But I don't see an option to specify image pull secret. It looks like it is not possible to pass image secret as part for run command. </p>

<p>Is there any alternate option to pull a container and run a command using kubectl? The command output should be seen on the console. Also once the command finishes the pod should die.</p>

<p>You can use the overrides if you specify it right, it's an array in the end, that took me a bit to figure out, the below works on Kubernetes of at least 1.6:</p>
<p><code>--overrides='{ &quot;spec&quot;: { &quot;template&quot;: { &quot;spec&quot;: { &quot;imagePullSecrets&quot;: [{&quot;name&quot;: &quot;your-registry-secret&quot;}] } } } }'</code></p>
<p>for example</p>
<pre><code>kubectl run -i -t hello-world --rm --generator=run-pod/v1 \
--image=eu.gcr.io/your-registry/hello-world \
--image-pull-policy=&quot;IfNotPresent&quot; \
--overrides='{ &quot;spec&quot;: { &quot;template&quot;: { &quot;spec&quot;: { &quot;imagePullSecrets&quot;: [{&quot;name&quot;: &quot;your-registry-secret&quot;}] } } } }'
</code></pre>
