<p><a href="https://www.docker.com/" rel="nofollow noreferrer">Docker</a> provides a way to run the container using <code>docker run</code></p>

<p>Or just pull the container image using <code>docker pull</code></p>

<p>Found a <a href="https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/" rel="nofollow noreferrer">doc</a> showing mapping between docker commands and kubectl.</p>

<p>Can't find <code>docker pull</code> equivalent in this doc.</p>

<p>If there is no any such equivalent to <code>docker pull</code>, then is there any way to just pull an image using <code>kubectl</code> cli.</p>

mchawre
<p>I think there isn't a <code>kubectl ...</code> equivalent and some of the reasons might be:</p>
<ul>
<li><p>they are not equivalent 🙂. When you <code>docker pull</code> an image, you are planning to use it afterwards on your docker host. When you <code>kubectl ...</code> a deployment, you want the platform to schedule everything. For example if you have many worker nodes and the replicas are going to be scheduled to only two of them, then the other nodes don't have to pull the image.</p>
</li>
<li><p><code>kubectl</code> is a tool that talks to the API server to control the cluster. It would be wrong to make it also responsible for container images (see, <a href="https://www.joelonsoftware.com/2002/11/11/the-law-of-leaky-abstractions/" rel="nofollow noreferrer">Leaky Abstractions</a>) since you have available a lower level tool that talks to the Container Runtime Interface for that: <a href="https://kubernetes.io/docs/tasks/debug-application-cluster/crictl/" rel="nofollow noreferrer"><code>crictl</code></a>.</p>
<pre><code>k8s-master:~$ crictl --help
NAME:
   crictl - client for CRI

USAGE:
   crictl [global options] command [command options] [arguments...]

VERSION:
   v1.12.0

COMMANDS:
     attach        Attach to a running container
     create        Create a new container
     exec          Run a command in a running container
     version       Display runtime version information
     images        List images
     inspect       Display the status of one or more containers
     inspecti      Return the status of one or more images
     inspectp      Display the status of one or more pods
     logs          Fetch the logs of a container
     port-forward  Forward local port to a pod
     ps            List containers
     pull          Pull an image from a registry
     ...
</code></pre>
<p>pic from: <a href="https://www.aquasec.com/wiki/display/containers/Kubernetes+Architecture+101" rel="nofollow noreferrer">www.aquasec.com/wiki/display/containers/Kubernetes+Architecture+101</a>
<a href="https://i.stack.imgur.com/zxFhZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zxFhZ.png" alt="enter image description here" /></a></p>
</li>
<li><p>what takes place with container run-times under the hood is complicated and keeps evolving. Think about this, people started creating Kubernetes clusters and the container engine used was Docker. Then Docker adopted <code>containerd</code> so we had Kubernetes on top of Docker on top of <code>containerd</code>, which caused problems like this:</p>
<blockquote>
<p>Users won't see Kubernetes pulled images with the <code>docker images</code> command... And vice versa, Kubernetes won't see images created by <code>docker pull</code>, <code>docker load</code> or <code>docker build</code> commands...</p>
<p>source / more details: <a href="https://kubernetes.io/blog/2018/05/24/kubernetes-containerd-integration-goes-ga/" rel="nofollow noreferrer"><strong>Kubernetes Containerd Integration Goes GA</strong></a></p>
</blockquote>
<p><a href="https://i.stack.imgur.com/zp1jQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zp1jQ.png" alt="enter image description here" /></a></p>
</li>
</ul>
