title: Removing Docker Kubernetes k8s images from local machine
body: <p>I had a problem, maybe easy but I couldn't handle this. How to remove all k8s containers and images from local machine?</p>
  
  <pre><code>gcr.io/google_containers/k8s-dns-sidecar-amd64         Up 36 minutes       k8s_sidecar_kube-dns-6fc954457d-mwgvb_kube-system_fd5ebaed-c63c-11e7-b3c8-28d24484a79b_116
  gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64   Up 36 minutes       k8s_dnsmasq_kube-dns-6fc954457d-mwgvb_kube-system_fd5ebaed-c63c-11e7-b3c8-28d24484a79b_116
  gcr.io/google_containers/k8s-dns-kube-dns-amd64        Up 36 minutes       k8s_kubedns_kube-dns-6fc954457d-mwgvb_kube-system_fd5ebaed-c63c-11e7-b3c8-28d24484a79b_116
  gcr.io/google_containers/kubernetes-dashboard-amd64    Up 36 minutes       k8s_kubernetes-dashboard_kubernetes-dashboard-xpg2v_kube-system_fd403866-c63c-11e7-b3c8-28d24484a79b_222
  gcr.io/google-containers/kube-addon-manager            Up 36 minutes       k8s_kube-addon-manager_kube-addon-manager-lenovo-e540_kube-system_9831e93c3188555873fdb49f43198eef_186
  gcr.io/google_containers/pause-amd64:3.0               Up 36 minutes       k8s_POD_kube-dns-6fc954457d-mwgvb_kube-system_fd5ebaed-c63c-11e7-b3c8-28d24484a79b_116
  gcr.io/google_containers/pause-amd64:3.0               Up 36 minutes       k8s_POD_kube-addon-manager-lenovo-e540_kube-system_9831e93c3188555873fdb49f43198eef_186
  gcr.io/google_containers/pause-amd64:3.0               Up 36 minutes       k8s_POD_kubernetes-dashboard-xpg2v_kube-system_fd403866-c63c-11e7-b3c8-28d24484a79b_186
  </code></pre>
  
  <p>It's unpossible to stop them (they restart always), also to remove them by <code>rm</code> and <code>rmi</code>. Also tryint to kill <code>kubelet</code>.</p>
  
  <pre><code>$ ps ax | grep kubelet
  17234 pts/18   S+     0:00 grep --color=auto kubelet
  
  $ kill -KILL 17234
  bash: kill: (17234) - No such process
  
  systemctl stop kubelet
  Failed to stop kubelet.service: Unit kubelet.service not loaded.
  </code></pre>
  
  <p>Also trying to force remove this containers:
  <code>$ docker rm -f $(docker ps -a -q --filter "name=k8s")</code></p>
  
  <p>but they will recreate after that...</p>
  
  <p>Checking available pods results like this...</p>
  
  <pre><code>$ kubectl get po -n=kube-system
  Unable to connect to the server: dial tcp 192.168.99.100:8443: getsockopt: network is unreachable
  </code></pre>
  
  <p>I was looking for it in documentations, stack etc. but with no effect.</p>
  
  <p>Here's bug on github, but no one could help: <a href="https://github.com/kubernetes/kubernetes/issues/61173" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/issues/61173</a></p>
  
  <p>Thanks in advance!</p>
  
  <p>Best regards,
  Marcin</p>