YOKOHEI.COM

YOKOHEI.COM

›Kubernetes Basics

Kubernetes Basics

  • Kubernetes Basics
  • Commands
  • Static Pod
  • Drain & Uncordon
  • Cluster Upgrade
  • Backup & Restore
  • Certification
  • RBAC
  • CNI
  • CoreDNS
  • Ingress

Kubernetes the Hard Way

  • the Hard Way?
  • AWS Prerequisites
  • CA and TLS
  • Configuration Files
  • Data Encryption
  • Bootstrapping etcd
  • Bootstrapping Control Plane
  • Bootstrapping Worker Node
  • kubectl configuraton
  • Pod Network
  • RBAC for Kubelet
  • Coredns Add-On
  • Test
  • TLS Bootstrapping

Amazon EKS

  • EKS Introduction
  • Ingress with ALB
  • PersistentVolume with EBS
  • NetworkPolicy with Calico
  • Secret with KMS
  • EKS Hands-On

Drain & Uncordon

drain コマンド

$ kubectl drain node-1
node から pod を terminate して追い出す。
evict された pod が deployment などから作られたものであれば、別の node 上に再作成される。
単体で作成された pod が乗っている場合は drain コマンドを --force しないと drain できない。
そして、強制的に drain にすると単体作成された pod は戻ってこない。

master $ kubectl drain node02 --ignore-daemonsets
node/node02 cordoned
error: unable to drain node "node02", aborting command...

There are pending nodes to be drained:
 node02
error: pods not managed by ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet (use --force to override): hr-app

drain 状態の node は新しい pod のスケジュールを受け付けない。

uncordon コマンド

$ kubectl drain node-1

drain 状態の node を、pod がスケジュール可能な状態に戻す。
しかし、既に drain により別の node に退避された pod は、自動的に戻ることはなく、新しく pod が作成されたときに node-1 にスケジュール可能になるというもの。

cordon コマンド

$ kubectl cordon node-2

既に動いている pod を追い出さずに、node に対して新たに pod がスケジュールされるのを防ぐのが cordon コマンドである。 drain したときと同様、SchedulingDisabled ステータスになる。

master $ kubectl get nodes
NAME      STATUS                     ROLES     AGE       VERSION
master    Ready                      master    12m       v1.11.3
node01    Ready                      <none>    12m       v1.11.0
node02    Ready,SchedulingDisabled   <none>    12m       v1.11.0
node03    Ready,SchedulingDisabled   <none>    12m       v1.11.0
← Static PodCluster Upgrade →
▼ Codes ▼
LeetCodeGitHub
▼ Profile ▼
LinkedInFlickr
▼ Logo made with DesignEvo ▼
DesignEvo
Copyright © 2020 Kohei Yoshida