kubereboot / kured

Kubernetes Reboot Daemon
https://kured.dev
Apache License 2.0
2.11k stars 200 forks source link

Question: where to set configuration: rebootSentinelCommand: 'sh -c "! needs-restarting --reboothint"' #946

Open llyons opened 1 week ago

llyons commented 1 week ago

in the latest 1.15.1 version of kured we have the following setup for the daemonset.

I am trying to figure out where we might place

configuration:   
   rebootSentinelCommand: 'sh -c "! needs-restarting --reboothint"'

to get it to work on an almalinux (rhel) system

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: kured # Must match `--ds-name`
  namespace: kube-system # Must match `--ds-namespace`
spec:
  selector:
    matchLabels:
      name: kured
  updateStrategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        name: kured
    spec:
      serviceAccountName: kured
      tolerations:
      - operator: Exists
      hostPID: true # Facilitate entering the host mount namespace via init
      restartPolicy: Always
      volumes:
        - name: sentinel
          hostPath:
            path: /var/run
            type: Directory
      containers:
        - name: kured
          # If you find yourself here wondering why there is no
          # :latest tag on Docker Hub,see the FAQ in the README
          image: ghcr.io/kubereboot/kured:1.15.1
          imagePullPolicy: IfNotPresent
          securityContext:
            privileged: true # Give permission to nsenter /proc/1/ns/mnt
            readOnlyRootFilesystem: true
          ports:
            - containerPort: 8080
              name: metrics
          env:
            # Pass in the name of the node on which this pod is scheduled
            # for use with drain/uncordon operations and lock acquisition
            - name: KURED_NODE_ID
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
          volumeMounts:
            - mountPath: /sentinel
              name: sentinel
              readOnly: true
          command:
            - /usr/bin/kured
            - --reboot-sentinel=/sentinel/reboot-required
#            - --force-reboot=false
#            - --drain-grace-period=-1
#            - --skip-wait-for-delete-timeout=0
#            - --drain-delay=0
#            - --drain-timeout=0
#            - --drain-pod-selector=""
            - --period=30m
#            - --ds-namespace=kube-system
#            - --ds-name=kured
#            - --lock-annotation=weave.works/kured-node-lock
#            - --lock-ttl=0
#            - --prometheus-url=http://prometheus.monitoring.svc.cluster.local
#            - --alert-filter-regexp=^RebootRequired$
#            - --alert-filter-match-only=false
#            - --alert-firing-only=false
#            - --prefer-no-schedule-taint=""
#            - --reboot-sentinel-command=""
#            - --reboot-method=command
#            - --reboot-signal=39
#            - --slack-hook-url=https://hooks.slack.com/...
#            - --slack-username=prod
#            - --slack-channel=alerting
#            - --notify-url="" # See also shoutrrr url format
            - --message-template-drain=Draining node %s
            - --message-template-reboot=Rebooting node %s
            - --message-template-uncordon=Node %s rebooted & uncordoned successfully!
#            - --blocking-pod-selector=runtime=long,cost=expensive
#            - --blocking-pod-selector=name=temperamental
#            - --blocking-pod-selector=...
            - --reboot-days=sun,mon,tue,wed,thu,fri,sat
            - --reboot-delay=90s
            - --start-time=10pm
            - --end-time=2am
            - --time-zone=America/Chicago
#            - --annotate-nodes=false
#            - --lock-release-delay=30m
            - --log-format=text
#            - --metrics-host=""
#            - --metrics-port=8080
#            - --concurrency=1
llyons commented 1 week ago

Am I correct in saying that the reboot sentinel command should be set like this in 1.15.1 on a RHEL system (yumutils installed of course)

    spec:
      containers:
      - command:
        - /usr/bin/kured
        - --period=30m
        - --reboot-sentinel-command=sh -c "! needs-restarting --reboothint"
        - --message-template-drain=Draining node %s
        - --message-template-reboot=Rebooting node %s
        - --message-template-uncordon=Node %s rebooted & uncordoned successfully!
        - --reboot-days=sun,mon,tue,wed,thu,fri,sat
        - --reboot-delay=90s
        - --start-time=10pm
        - --end-time=2am
        - --time-zone=America/Chicago
        - --log-format=text