From 3a89e3e058a37d9d451ebf6da10f15929c43c3f5 Mon Sep 17 00:00:00 2001 From: JJ Jordan Date: Tue, 9 Apr 2019 18:02:11 -0700 Subject: [PATCH] Add documentation section, params to daemonset, tzdata to docker container --- README.md | 28 ++++++++++++++++++++++++++++ cmd/kured/Dockerfile | 2 +- kured-ds.yaml | 4 ++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4bade6c..edb3df3 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ * [Installation](#installation) * [Configuration](#configuration) * [Reboot Sentinel File & Period](#reboot-sentinel-file-&-period) + * [Setting a schedule](#setting-a-schedule) * [Blocking Reboots via Alerts](#blocking-reboots-via-alerts) * [Blocking Reboots via Pods](#blocking-reboots-via-pods) * [Prometheus Metrics](#prometheus-metrics) @@ -72,13 +73,17 @@ Flags: --blocking-pod-selector stringArray label selector identifying pods whose presence should prevent reboots --ds-name string name of daemonset on which to place lock (default "kured") --ds-namespace string namespace containing daemonset on which to place lock (default "kube-system") + --end-time string only reboot before this time of day (default "23:59") -h, --help help for kured --lock-annotation string annotation in which to record locking node (default "weave.works/kured-node-lock") --period duration reboot check period (default 1h0m0s) --prometheus-url string Prometheus instance to probe for active alerts + --reboot-days strings only reboot on these days (default [su,mo,tu,we,th,fr,sa]) --reboot-sentinel string path to file whose existence signals need to reboot (default "/var/run/reboot-required") --slack-hook-url string slack hook URL for reboot notfications --slack-username string slack username for reboot notfications (default "kured") + --start-time string only reboot after this time of day (default "0:00") + --time-zone string use this timezone to calculate allowed reboot time (default "UTC") ``` ### Reboot Sentinel File & Period @@ -89,6 +94,29 @@ values with `--reboot-sentinel` and `--period`. Each replica of the daemon uses a random offset derived from the period on startup so that nodes don't all contend for the lock simultaneously. +### Setting a schedule + +By default, kured will reboot any time it detects the sentinel, but this +may cause reboots during odd hours. While service disruption does not +normally occur, anything is possible and operators may want to restrict +reboots to predictable schedules. Use `--reboot-days`, `--start-time`, +`--end-time`, and `--time-zone` to set a schedule. For example, business +hours on the west coast USA can be specified with: + +``` + --reboot-days mon,tue,wed,thu,fri + --start-time 9am + --end-time 5pm + --time-zone America/Los_Angeles +``` + +Times can be formatted in numerous ways, including `5pm`, `5:00pm` `17:00`, +and `17`. `--time-zone` represents a Go `time.Location`, and can be `UTC`, +`Local`, or any entry in the standard Linux tz database. + +Note that when using smaller time windows, you should consider shortening +the sentinel check period (`--period`). + ### Blocking Reboots via Alerts You may find it desirable to block automatic node reboots when there diff --git a/cmd/kured/Dockerfile b/cmd/kured/Dockerfile index dba4021..1a26455 100644 --- a/cmd/kured/Dockerfile +++ b/cmd/kured/Dockerfile @@ -1,5 +1,5 @@ FROM alpine:3.8 -RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/* +RUN apk update && apk add ca-certificates tzdata && rm -rf /var/cache/apk/* # NB: you may need to update RBAC permissions when upgrading kubectl - see kured-rbac.yaml for details ADD https://storage.googleapis.com/kubernetes-release/release/v1.12.1/bin/linux/amd64/kubectl /usr/bin/kubectl RUN chmod 0755 /usr/bin/kubectl diff --git a/kured-ds.yaml b/kured-ds.yaml index 72978dc..c68369f 100644 --- a/kured-ds.yaml +++ b/kured-ds.yaml @@ -51,9 +51,13 @@ spec: # - --blocking-pod-selector=... # - --ds-name=kured # - --ds-namespace=kube-system +# - --end-time=23:59 # - --lock-annotation=weave.works/kured-node-lock # - --period=1h # - --prometheus-url=http://prometheus.monitoring.svc.cluster.local +# - --reboot-days=sun,mon,tue,wed,thu,fri,sat # - --reboot-sentinel=/var/run/reboot-required # - --slack-hook-url=https://hooks.slack.com/... # - --slack-username=prod +# - --start-time=0:00 +# - --time-zone=UTC