1. 程式人生 > >k8s組件批量啟動、查看狀態

k8s組件批量啟動、查看狀態

restart pro roc bsp man etcd nag -a star

查看所有master節點kube-apiserver

ansible k8s -m shell -a systemctl status kube-apiserver

重啟所有master節點kube-apiserver

subprocess.call(["ansible k8s -m shell -a ‘systemctl daemon-reload && systemctl restart kube-apiserver‘"],shell=True)


查看所有master節點所有組件狀態

ansible k8s -m shell -a systemctl status haproxy && systemctl status keepalived && systemctl restart etcd && systemctl daemon-reload && systemctl status kube-apiserver && systemctl status kube-controller-manager && systemctl status kube-scheduler
重啟所有master節點所有組件 subprocess.call(["ansible k8s -m shell -a ‘systemctl daemon-reload && systemctl restart etcd && systemctl daemon-reload && systemctl restart kube-apiserver && systemctl restart kube-controller-manager && systemctl restart kube-scheduler‘"],shell=True) 查看worker節點所有組件狀態 ansible test4
-m shell -a systemctl status docker && systemctl status kubelet && systemctl status kube-proxy 重啟worker節點所有組件 ansible test4 -m shell -a systemctl daemon-reload && systemctl restart docker && systemctl daemon-reload && systemctl restart kubelet && systemctl daemon-reload && systemctl restart kube-proxy

k8s組件批量啟動、查看狀態