kontena / pharos-host-upgrades

Kube DaemonSet for host OS upgrades
Apache License 2.0
41 stars 1 forks source link

Fix kubectl drain to use --delete-local-data #27

Closed SpComb closed 6 years ago

SpComb commented 6 years ago

Fixes #26

Can't think of any reason not to use kubectl drain --delete-local-data - emptyDir volumes should only be used for temporary data. Ideally the pods using local data volumes could be terminated gracefully but left scheduled onto the node for the duration of the reboot instead of being evicted, but lacking any option for that kind of behavior in kubectl drain, it doesn't make sense to fail the entire node eviction because of pods with /tmp volumes.

SpComb commented 6 years ago

Testing that kubectl accepts the argument:

2018/06/18 13:05:04 Reboot required, draining kube node...
2018/06/18 13:05:04 Draining kube node ubuntu-xenial (with annotation pharos-host-upgrades.kontena.io/drain)...
2018/06/18 13:05:04 kubectl drain --delete-local-data --ignore-daemonsets --force ubuntu-xenial...
2018/06/18 13:06:06 kubectl drain --delete-local-data --ignore-daemonsets --force ubuntu-xenial: node "ubuntu-xenial" cordoned
pod "kube-dns-86f4d74b45-kl54k" evicted
node "ubuntu-xenial" drained
2018/06/18 13:06:06 Marking kube node ubuntu-xenial for reboot (with annotation pharos-host-upgrades.kontena.io/reboot=2018-06-18 13:06:06.288183811 +0000 UTC m=+85.864509907)...
2018/06/18 13:06:06 Rebooting...