Skip to content

Instantly share code, notes, and snippets.

@kyklos
kyklos / k8s-drain.sh
Created February 7, 2024 18:36 — forked from juliohm1978/k8s-drain.sh
Drains a Kubernetes node using "rollout restart" instead "kubectl drain". See comments for motiviation and usage.
#!/bin/bash
NODE_NAME=$1
ROLLOUT_CMD=$2
if [[ "$NODE_NAME" == "" ]]; then
echo "
USAGE: ./drain.sh <NODE_NAME>
Drains a node from its Deployments/Stateful set pods.
var EventEmitter = require("events").EventEmitter,
redis = require("redis"),
dateformat = require("dateformat");
function population32(x)
{
x -= ((x >> 1) & 0x55555555);
x = (((x >> 2) & 0x33333333) + (x & 0x33333333));
x = (((x >> 4) + x) & 0x0f0f0f0f);
x += (x >> 8);
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.