Skip to content

Krew plugin to restart Kubernetes Nodes sequentially and gracefully

License

Notifications You must be signed in to change notification settings

MnrGreg/kubectl-node-restart

Repository files navigation

kubectl-node-restart

kubectl-node-restart is a kubectl plugin that sequentially and gracefully performs a rolling restart of Nodes within a Kubernetes cluster

using kubectl-node-restart plugin

Installing

  • install krew using instructions here
  • run kubectl krew update
  • run kubectl krew install node-restart

installing kubectl-node-restart plugin

Usage

  • perform rolling restart of all nodes in a cluster
    kubectl node-restart [--context cluster] all
  • restart only specific nodes selected through labels
    kubectl node-restart --selector node-role.kubernetes.io/master
  • execute a command prior to reboot labels
    kubectl node-restart all --command "echo 'hello world'"
  • perform a dry-run
    kubectl node-restart all --dry-run
  • restart node(s) without first draining
    kubectl node-restart all --force
  • add a delay of 120seconds between node restarts
    kubectl node-restart all --sleep 120
  • Pull the Alpine image from a private registry
    kubectl node-restart all --registry myregistry.local/library/alpine:3.9