#!/bin/bash #author: Thomas Roehm #version: 1.1 echo "Getting worker:" echo "" su - kubernetes -c "kubectl get nodes" echo "" read -p "Please enter the name of the worker you want to update: " NODENAME echo "Worker: \"$NODENAME\" will be patched" echo "" su - kubernetes -c "kubectl drain ${NODENAME} --ignore-daemonsets" #Below version k8s <= v1.15.x run: #kubeadm upgrade node config --kubelet-version v1.15.x kubeadm upgrade node #Proceed or cancel echo "" read -p "Do you want to wait until ${NODENAME} has been patched to finish (uncordon) the patch-process? Please enter y (wait) or n: " PROCEED echo "You´ve entered: \"$PROCEED\"" echo "" if [ $PROCEED = y ] then while read -s -p "Please enter \"p\" to proceed: " p && [[ -z "$p" ]] ; do echo "Please enter \"p\" to proceed" done su - kubernetes -c "kubectl uncordon ${NODENAME}" echo "Uncordon ${NODENAME}" su - kubernetes -c "kubectl get nodes -o wide" else exit 1 fi