k8s 管理

前言

k8s 有一個很簡單又 powerful 的概念, 就是 labels, 例如

kubectl get pods -l app=keycloak,release=keycloak

對 k8s 移除 node (步驟一)

➜  kubectl drain node3 --ignore-daemonsets 

 --delete-local-data

node/node3 already cordoned
WARNING: ignoring DaemonSet-managed Pods: kube-system/kube-flannel-h8t2j, kube-system/kube-proxy-7bczv, kube-system/nodelocaldns-jjkmg
evicting pod "coredns-56bc6b976d-dcmnn"
evicting pod "tiller-deploy-855fc8c5c8-f56mw"
pod/tiller-deploy-855fc8c5c8-f56mw evicted
pod/coredns-56bc6b976d-dcmnn evicted
node/node3 evicted

對 k8s 移除 node (步驟二)

➜  kubectl get nodes
NAME    STATUS                        ROLES    AGE   VERSION
node1   Ready                         <none>   20h   v1.14.3
node2   Ready                         master   20h   v1.14.3
node3   NotReady,SchedulingDisabled   <none>   20h   v1.14.3

➜  kubectl delete node  node

node "node3" deleted

➜  kubectl get nodes
NAME    STATUS   ROLES    AGE   VERSION
node1   Ready    <none>   20h   v1.14.3
node2   Ready    master   21h   v1.14.3

對 k8s 增加一個 node

➜  ~ kubectl drain node3 --ignore-daemonsets
node/node3 already cordoned
WARNING: ignoring DaemonSet-managed Pods: kube-system/kube-flannel-h8t2j, kube-system/kube-proxy-7bczv, kube-system/nodelocaldns-jjkmg
evicting pod "coredns-56bc6b976d-dcmnn"
evicting pod "tiller-deploy-855fc8c5c8-f56mw"
pod/tiller-deploy-855fc8c5c8-f56mw evicted
pod/coredns-56bc6b976d-dcmnn evicted
node/node3 evicted

k8s 管理

By Ming-der Wang

k8s 管理

  • 1,169