Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 1.04 KB

README.md

File metadata and controls

45 lines (32 loc) · 1.04 KB

node-drain

A systemd service and script to drain and optionally delete nodes on shutdown/restart.

Install

Download the files

  • git clone this repo
  • cd node-drain

or

curl -OLs https://raw.githubusercontent.com/dkeightley/node-drain/master/node-drain.service
curl -OLs https://raw.githubusercontent.com/dkeightley/node-drain/master/node-drain.sh

Copy files into place and enable the service

cp node-drain.sh /usr/local/bin/
cp node-drain.service /etc/systemd/system/
systemctl enable node-drain
systemctl daemon-reload
systemctl start node-drain

Check the logs

journalctl -u node-drain

Usage

node-drain systemd service for RKE and k3s

  Usage: bash node-drain.sh [ -d -n -r <container runtime> ]

    All flags are optional:
    -d    Delete local data, pods using emptyDir volumes will be drained as well
    -n    Delete node as well, useful for immutable infrastructure as nodes are replaced on shutdown
    -r    Override container runtime if not automatically detected (docker|k3s)