k8s元件批量啟動 檢視狀態

2022-07-12 01:33:12 字數 1271 閱讀 8695

檢視所有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元件介紹

master 管理節點 api server 供kubernetes api介面,主要處理 rest操作以及更新etcd中的物件。所有資源增刪改查的唯一入口。scheduler 繫結pod到node上,資源排程。controller manager 所有其他群集級別的功能,目前由控制器manager...

k8s核心元件

k8s的設計理念類似於linux的分層架構。1.master 核心控制 是老大 它主要負責排程,決定服務在 執行,master執行linux系統,可以是物理機或虛擬機器,master是k8s cluster的大腦,執行著的守護程序服務包括 kube apiserver,kube scheduler,...

k8s批量刪除Evicted Pods

1 查詢pod狀態 root k8s master prom kubectl n kube system get pods grep evicted coredns 67cb7b5f46 2crxg 0 1 evicted 0 4h56m coredns 67cb7b5f46 2ds7n 0 1 e...