kubernetes與docker環境下命令整合【持續更新】

kubernetes與docker環境下命令整合【持續更新】

查看集羣環境部署的服務

kubectl  -s ip:port --namespace=kube-system cluster-info
kubectl  -s ip:port cluster-info

主節點各類服務啓停命令

systemctl status docker
systemctl status etcd
systemctl status kubelet
systemctl restart kubelet
systemctl restart kube-proxy
systemctl restart kube-apiserver
systemctl restart kube-controller-manager
systemctl restart kube-scheduler
systemctl status kubelet kube-proxy kube-apiserver kube-controller-manager kube-scheduler #可同時多個服務一起查看

子節點各類服務啓停命令

systemctl restart kubelet
systemctl restart kube-proxy
systemctl status kubelet kube-proxy

查看最小節點Pod的應用情況

kubectl  -s ip:port --namespace=kube-system get po
kubectl  -s ip:port --namespace=kube-system get po -o wide #服務詳情
kubectl  -s ip:port --namespace=kube-system get po -o wide -w #動態監控服務運行

進入容器

kubectl  -s ip:port --namespace=kube-system get po
kubectl  -s ip:port --namespace=kube-system exec -ti 服務名 bash

查看Pod的yaml詳細

kubectl  -s ip:port --namespace=kube-system get po app-bdg5h -o yaml

查看Pod的label詳細

kubectl  -s ip:port --namespace=kube-system get node --show-labels

刪除狀態爲Evicted 的Pod

kubectl  -s ip:port --namespace=kube-system get pods | grep Evicted | awk '{print $1}' | xargs kubectl  -s ip:port  --namespace=kube-system delete pod

複製文件到容器

kubectl  -s ip:port --namespace=kube-system cp local_path 容器ID:容器目錄

容器複製文件到系統

kubectl  -s ip:port --namespace=kube-system cp 容器ID:容器目錄 local_path
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章