<p>Following the <a href="https://kubernetes.io/docs/setup/learning-environment/minikube/" rel="noreferrer">docs</a> and this <a href="https://stackoverflow.com/questions/42564058/how-to-use-local-docker-images-with-minikube">question</a>, I am trying to pull a image that I created locally with docker while creating deployment with <strong>kubectl</strong>. I am looking for something like this,</p>

<p><code>kubectl create deployment first-k8s-deploy --image="laxman/nodejs/express-app" --image-pull-policy="never"</code></p>

<p>Looking into <code>kubectl create deployment --help</code> doesn't provide any <code>--image-pull-policy</code> option.</p>

<p>Is there any global config to set imagePullPolicy and how can I set this flag for some specific deployments only?</p>

laxman
<p>You might have gone past what can be done with the command line. See <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#creating-a-deployment" rel="noreferrer">Creating a Deployment</a> for how to specify a deployment in a yaml file. </p>

<p>The <code>imagePullPolicy</code> is part of the <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#container-v1-core" rel="noreferrer">Container</a> definition.</p>

<p>You can get the yaml for any <code>kubectl</code> command by adding <code>-o yaml --dry-run</code> to the command. Using your example deployment:</p>

<pre><code>kubectl create deployment first-k8s-deploy \
  --image="laxman/nodejs/express-app" \
  -o yaml \
  --dry-run
</code></pre>

<p>Gives you:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    app: first-k8s-deploy
  name: first-k8s-deploy
spec:
  replicas: 1
  selector:
    matchLabels:
      app: first-k8s-deploy
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: first-k8s-deploy
    spec:
      containers:
      - image: laxman/nodejs/express-app
        name: express-app
        resources: {}
</code></pre>

<p>Then add the <code>imagePullPolicy</code> property into a container in the list:</p>

<pre><code>    spec:
      containers:
      - image: laxman/nodejs/express-app
        name: express-app
        resources: {}
        imagePullPolicy: Never
</code></pre>

<p>The yaml file you create can then be deployed with the following command</p>

<p><code>kubectl apply -f &lt;filename&gt;</code></p>
