How do I properly shut down these k8 containers?

3/23/2019

I was doing some self-learning with Kubernetes and I have these containers that will not permanently shut down:

CONTAINER ID        IMAGE                   COMMAND                  CREATED              STATUS              PORTS               NAMES
8e08ecdf12c2        fadcc5d2b066            "/usr/local/bin/kube…"   About a minute ago   Up About a minute                       k8s_kube-proxy_kube-proxy-mtksn_kube-system_08f1149a-4ac6-11e9-bea5-080027db2e61_0
744282ae4605        40a817357014            "kube-controller-man…"   About a minute ago   Up About a minute                       k8s_kube-controller-manager_kube-controller-manager-minikube_kube-system_17eea6fd9342634d7d40a04d577641fd_0
0473a3e3fedb        f59dcacceff4            "/coredns -conf /etc…"   About a minute ago   Up About a minute                       k8s_coredns_coredns-86c58d9df4-l6mdf_kube-system_08f82a2f-4ac6-11e9-bea5-080027db2e61_0
6e9a0a03dff1        4689081edb10            "/storage-provisioner"   About a minute ago   Up About a minute                       k8s_storage-provisioner_storage-provisioner_kube-system_0a7e1c9d-4ac6-11e9-bea5-080027db2e61_0
4bb4356e57e7        dd862b749309            "kube-scheduler --ad…"   About a minute ago   Up About a minute                       k8s_kube-scheduler_kube-scheduler-minikube_kube-system_4b52d75cab61380f07c0c5a69fb371d4_0
973e42e849c8        f59dcacceff4            "/coredns -conf /etc…"   About a minute ago   Up About a minute                       k8s_coredns_coredns-86c58d9df4-l6hqj_kube-system_08fd4db1-4ac6-11e9-bea5-080027db2e61_1
338b58983301        9c16409588eb            "/opt/kube-addons.sh"    About a minute ago   Up About a minute                       k8s_kube-addon-manager_kube-addon-manager-minikube_kube-system_5c72fb06dcdda608211b70d63c0ca488_4
3600083cbb01        k8s.gcr.io/pause:3.1    "/pause"                 About a minute ago   Up About a minute                       k8s_POD_kube-addon-manager-minikube_kube-system_5c72fb06dcdda608211b70d63c0ca488_3
97dffefb7a4b        ldco2016/multi-client   "nginx -g 'daemon of…"   About a minute ago   Up About a minute                       k8s_client_client-deployment-6d89489556-mgznt_default_1f1f77f2-4c5d-11e9-bea5-080027db2e61_1
55224d847c72        k8s.gcr.io/pause:3.1    "/pause"                 About a minute ago   Up About a minute                       k8s_POD_kube-proxy-mtksn_kube-system_08f1149a-4ac6-11e9-bea5-080027db2e61_3
9a66d39da906        3cab8e1b9802            "etcd --advertise-cl…"   About a minute ago   Up About a minute                       k8s_etcd_etcd-minikube_kube-system_8490cea1bf6294c73e0c454f26bdf714_6
e75a57524b41        k8s.gcr.io/pause:3.1    "/pause"                 About a minute ago   Up About a minute                       k8s_POD_etcd-minikube_kube-system_8490cea1bf6294c73e0c454f26bdf714_5
5a1c02eeea6a        fc3801f0fc54            "kube-apiserver --au…"   About a minute ago   Up About a minute                       k8s_kube-apiserver_kube-apiserver-minikube_kube-system_d1fc269f154a136c6c9cb809b65b6899_3
2320ac2ab58d        k8s.gcr.io/pause:3.1    "/pause"                 About a minute ago   Up About a minute                       k8s_POD_kube-apiserver-minikube_kube-system_d1fc269f154a136c6c9cb809b65b6899_3
0195bb0f048c        k8s.gcr.io/pause:3.1    "/pause"                 About a minute ago   Up About a minute                       k8s_POD_kube-scheduler-minikube_kube-system_4b52d75cab61380f07c0c5a69fb371d4_3
0664e62bf425        k8s.gcr.io/pause:3.1    "/pause"                 About a minute ago   Up About a minute                       k8s_POD_coredns-86c58d9df4-l6mdf_kube-system_08f82a2f-4ac6-11e9-bea5-080027db2e61_4
546c4195391e        k8s.gcr.io/pause:3.1    "/pause"                 About a minute ago   Up About a minute                       k8s_POD_kube-controller-manager-minikube_kube-system_17eea6fd9342634d7d40a04d577641fd_4
9211bc0ce3f8        k8s.gcr.io/pause:3.1    "/pause"                 About a minute ago   Up About a minute                       k8s_POD_client-deployment-6d89489556-mgznt_default_1f1f77f2-4c5d-11e9-bea5-080027db2e61_3
c22e7c931f46        k8s.gcr.io/pause:3.1    "/pause"                 About a minute ago   Up About a minute                       k8s_POD_coredns-86c58d9df4-l6hqj_kube-system_08fd4db1-4ac6-11e9-bea5-080027db2e61_3
e5b9a76b8d68        k8s.gcr.io/pause:3.1    "/pause"                 About a minute ago   Up About a minute                       k8s_POD_storage-provisioner_kube-system_0a7e1c9d

What is the most efficient way to shut them all down in one go and stop them from restarting?

I ran a minikube stop and that took care of it, but I am unclear as to whether that was the proper way to do it.

-- Daniel
docker
kubernetes

1 Answer

3/23/2019

This looks like the output of docker ps. When using Kubernetes, you should generally not worry about things at the Docker level, and what containers Docker is running. Some of the containers that are running are part of the Kubernetes API itself, so you should only shut these down if you plan to shut down Kubernetes itself. If you plan to shut down Kubernetes itself, the right way to shut it down depends on how you started it (minkube, GKE, etc?). If you don't plan on shutting down Kubernetes itself, but want to shut down any extra containers that Kubernetes is running on your behalf (as opposed to containers that are running as part of the Kubernetes system itself) you could run kubectl get pods --all-namespaces to see all "user-land" pods that are running. "Pod" is the level of abstraction that you primarily interact with when using Kubernetes, and the specific Docker processes that are running is not something you should need to worry about.

EDIT: I see you updated your question to say that you ran minikube stop. Yes, that is the correct way to do it, nice!

-- Amit Kumar Gupta
Source: StackOverflow