diff --git a/Dockerfile b/Dockerfile index 1f6f6bb..d8242ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,8 @@ RUN apt-get update && apt-get install -y \ && rm -rf /var/lib/apt/lists/* COPY sleep-123 /sleep-123 +COPY healthz.sh /usr/bin/healthz.sh +RUN chmod +x /usr/bin/healthz.sh ENTRYPOINT ["/usr/bin/dumb-init", "--"] CMD ["bash", "/sleep-123"] diff --git a/ds.yaml b/ds.yaml new file mode 100644 index 0000000..ceb7186 --- /dev/null +++ b/ds.yaml @@ -0,0 +1,46 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: testds + namespace: default +spec: + selector: + matchLabels: + name: testds + template: + metadata: + labels: + name: testds + spec: + containers: + - name: testds + image: ghcr.io/willnewby/kshell + command: + - ping + - '1.1.1.1' + livenessProbe: + exec: + command: + - /usr/bin/healthz.sh + initialDelaySeconds: 15 + periodSeconds: 30 + timeoutSeconds: 15 + failureThreshold: 3 + readinessProbe: + exec: + command: + - /usr/bin/healthz.sh + initialDelaySeconds: 10 + periodSeconds: 20 + timeoutSeconds: 15 + failureThreshold: 3 + resources: + limits: + memory: 200Mi + requests: + cpu: 100m + memory: 200Mi + # it may be desirable to set a high priority class to ensure that a DaemonSet Pod + # preempts running Pods + # priorityClassName: important + terminationGracePeriodSeconds: 30 diff --git a/healthz.sh b/healthz.sh new file mode 100644 index 0000000..fc2376e --- /dev/null +++ b/healthz.sh @@ -0,0 +1,4 @@ +#!/bin/bash +sleep 10 +ping -c4 1.1.1.1 +exit $?