如何正确关闭这些k8容器?

时间:2019-03-23 02:33:32

标签: docker kubernetes

我正在与Kubernetes进行一些自学,并且我拥有这些不会永久关闭的容器:

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

一次关闭它们并阻止它们重新启动的最有效方法是什么?

我运行了一个minikube stop并处理了它,但是我不清楚这是否是正确的方法。

1 个答案:

答案 0 :(得分:1)

这看起来像docker ps的输出。使用Kubernetes时,通常不应该担心Docker级别的事情以及Docker正在运行哪个容器。一些正在运行的容器是Kubernetes API本身的一部分,因此,仅当您打算关闭Kubernetes本身时,才应关闭这些容器。如果您打算关闭Kubernetes本身,那么关闭它的正确方法取决于您如何启动它(minkube,GKE等?)。如果您不打算关闭Kubernetes本身,但是想要关闭Kubernetes代表您运行的任何其他容器(与作为Kubernetes系统本身一部分运行的容器相对),则可以运行{{1} }以查看正在运行的所有“用户土地”窗格。 “ Pod”是您在使用Kubernetes时主要与之交互的抽象级别,您不必担心正在运行的特定Docker进程。

编辑:我看到您更新了问题,说您运行了kubectl get pods --all-namespaces。是的,那是正确的方法,很好!