<p>I'm new to kubernetes. Recently, I was successfull to manage kubernetes with online server. But, when I move to isolated area (offline server) I can't deploy kubectl image. But all of my environment are running well and I got stuck in this. The different just internet connection. </p>

<p>Currently, I can't deploy kubernetes dashboard and some images in offline server. This example of my kubectl command in offline server (I was downloaded the tar file in online server) :</p>

<pre><code># docker load &lt; nginx.tar

# kubectl create deployment test-nginx --image=nginx

# kubectl get pods --all-namespaces
NAMESPACE     NAME                                   READY   STATUS             RESTARTS   AGE
default       test-nginx-7d97ffc85d-2s4lh            0/1     ImagePullBackOff   0          50s
kube-system   coredns-6955765f44-2s54f               1/1     Running            1          26h
kube-system   coredns-6955765f44-wmtq9               1/1     Running            1          26h
kube-system   etcd-devkubeapp01                      1/1     Running            1          26h
kube-system   kube-apiserver-devkubeapp01            1/1     Running            1          26h
kube-system   kube-controller-manager-devkubeapp01   1/1     Running            1          26h
kube-system   kube-flannel-ds-amd64-czn8z            1/1     Running            0          26h
kube-system   kube-flannel-ds-amd64-d58x4            1/1     Running            0          26h
kube-system   kube-flannel-ds-amd64-z9w9x            1/1     Running            0          26h
kube-system   kube-proxy-9wxj2                       1/1     Running            0          26h
kube-system   kube-proxy-mr76b                       1/1     Running            1          26h
kube-system   kube-proxy-w5pvm                       1/1     Running            0          26h
kube-system   kube-scheduler-devkubeapp01            1/1     Running            1          26h

# kubectl get nodes
NAME           STATUS   ROLES     AGE   VERSION
devkubeapp01   Ready    master    26h   v1.17.2
devkubeapp02   Ready    minion1   26h   v1.17.2
devkubeapp03   Ready    minion2   25h   v1.17.2 

# docker images
REPOSITORY                           TAG                 IMAGE ID            CREATED             SIZE
nginx                                latest              5ad3bd0e67a9        6 days ago          127MB
k8s.gcr.io/kube-proxy                v1.17.2             cba2a99699bd        10 days ago         116MB
k8s.gcr.io/kube-apiserver            v1.17.2             41ef50a5f06a        10 days ago         171MB
k8s.gcr.io/kube-controller-manager   v1.17.2             da5fd66c4068        10 days ago         161MB
k8s.gcr.io/kube-scheduler            v1.17.2             f52d4c527ef2        10 days ago         94.4MB
k8s.gcr.io/coredns                   1.6.5               70f311871ae1        2 months ago        41.6MB
k8s.gcr.io/etcd                      3.4.3-0             303ce5db0e90        3 months ago        288MB
quay.io/coreos/flannel               v0.11.0-amd64       ff281650a721        12 months ago       52.6MB
k8s.gcr.io/pause                     3.1                 da86e6ba6ca1        2 years ago         742kB
</code></pre>

<p>My Pod cant running well, so the status CreatingContainer turn into ImagePullBackOff (I was try in online server when I disconnected the Internet the status is same => ImagePullBackOff). Anyone can help to solve this ? Does kubernetes support offline environment to deploy the image ?</p>

<p>Thanks.</p>

<p>As already stated in my previous comment:</p>

<blockquote>
  <p>I suspect that your <code>imagePullPolicy</code> might be misconfigured.</p>
</blockquote>

<p>and further proven by the logs you have provided:</p>

<blockquote>
  <p>Error from server (BadRequest): container "nginx" in pod
  "test-nginx-7d97ffc85d-2s4lh" is waiting to start: trying and failing
  to pull image</p>
</blockquote>

<p>the problem lays within the <a href="https://kubernetes.io/docs/concepts/containers/images/#pre-pulled-images" rel="nofollow noreferrer"><code>imagePullPolicy</code> configuration</a>.</p>

<p>As stated in the <a href="https://kubernetes.io/docs/concepts/containers/images/#pre-pulled-images" rel="nofollow noreferrer">official documentation</a>:</p>

<blockquote>
  <p><strong>Pre-pulled Images</strong></p>
  
  <p>By default, the kubelet will try to pull each image from the specified
  registry. However, if the <code>imagePullPolicy</code> property of the container
  is set to <code>IfNotPresent</code> or <code>Never</code>, then a local image is used
  (preferentially or exclusively, respectively).</p>
  
  <p>If you want to rely on pre-pulled images as a substitute for registry
  authentication, you must ensure all nodes in the cluster have the same
  pre-pulled images.</p>
</blockquote>

<p>So basically as already mentioned by @Eduardo you need to make sure that you have the same images on all nodes and your <code>imagePullPolicy</code> is correctly configured. </p>

<p>However, make sure the container always uses the same version of the image, you can specify its <a href="https://docs.docker.com/engine/reference/commandline/pull/#pull-an-image-by-digest-immutable-identifier" rel="nofollow noreferrer">digest</a>, for example <code>sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2</code>. The digest uniquely identifies a specific version of the image, so it is never updated by Kubernetes unless you change the digest value.</p>

<p>This way you would similar avoid issues in the future as keeping the exact same version of the image cluster wide is the biggest trap in this scenario.</p>

<p>I hope this helps and expands on the previous answer (which is correct) as well as proves my point from the very beginning.   </p>
