如何停止Kubernetes控制飞机吊舱? [英] How can I stop Kubernetes control plane pods?
问题描述
只是好奇,对于mesos,我习惯于做systemctl stop mesos-master
和systemctl start mesos-master
(如果我出于某些原因需要将其弹起).使用k8s,可以在控制平面中停止"多个组件,例如apiserver,controller-manager等.
在使用kubeadm创建集群时,它会像Pod一样运行控制平面(没有副本集或类似的设置,也许是因为目前我只有一个主服务器).
在不破坏集群的情况下停止控制平面中的东西然后再次启动它们的最佳方法是什么?
Kubernetes控制平面Pod通常部署为
要临时禁用/启用这些Pod,只需将定义文件移至安全位置并再次返回: Just curious, with mesos I'm used to being able to do When creating a cluster with kubeadm, it runs the control plane as pods (no replica set, or anything like that, perhaps because I only have a single master at the moment). What's the best way to stop the things in the control plane and then start them again, without tearing down the cluster? The Kubernetes control plane pods are often deployed as Static Pods. These are not managed by any kind of Deployment controller, but are defined in static (hence the name) configuration files that are placed in a configuration directory (like for example According to the documentation, you can stop/delete static pods simply by removing the respective configuration files, and start/create them again by creating new files: Running kubelet periodically scans the configured directory (
To temporarily disable/enable these pods, simply move the definition files to a safe location and back again:
这篇关于如何停止Kubernetes控制飞机吊舱?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!$ mv /etc/kubelet.d/*.yaml /tmp # Disable static pods
$ mv /tmp/*.yaml /etc/kubelet.d # Re-enable static pods
systemctl stop mesos-master
and systemctl start mesos-master
(if I need to bounce it for some reason). With k8s, there are multiple components to 'stop' in the control plane, such as apiserver, controller-manager, etc./etc/kubelet.d/
or /etc/kubernetes/manifests
, depending on how your cluster is set up). These definition files are picked up by the Kubelet running on the Kubernetes master node that creates the respective pods.
/etc/kubelet.d
in our example) for changes and adds/removes pods as files appear/disappear in this directory.[joe@my-node1 ~] $ mv /etc/kubelet.d/static-web.yaml /tmp
[joe@my-node1 ~] $ sleep 20
[joe@my-node1 ~] $ docker ps
// no nginx container is running
[joe@my-node1 ~] $ mv /tmp/static-web.yaml /etc/kubelet.d/
[joe@my-node1 ~] $ sleep 20
[joe@my-node1 ~] $ docker ps
CONTAINER ID IMAGE COMMAND CREATED ...
e7a62e3427f1 nginx:latest "nginx -g 'daemon of 27 seconds ago
$ mv /etc/kubelet.d/*.yaml /tmp # Disable static pods
$ mv /tmp/*.yaml /etc/kubelet.d # Re-enable static pods