homek8s/infrastructure/node-io/etcd-io-guard.yaml

69 lines
2 KiB
YAML

apiVersion: apps/v1
kind: DaemonSet
metadata:
name: etcd-io-guard
namespace: node-io
labels:
app: etcd-io-guard
spec:
selector:
matchLabels:
app: etcd-io-guard
updateStrategy:
type: RollingUpdate
template:
metadata:
labels:
app: etcd-io-guard
spec:
# siriussec is the only node that hosts the etcd data dir and the dind
# runner data-root on the same NVMe.
nodeSelector:
kubernetes.io/hostname: siriussec
tolerations:
- operator: Exists
hostPID: true
priorityClassName: system-node-critical
containers:
- name: guard
image: busybox:1.36
imagePullPolicy: IfNotPresent
# ConfigMap keys are the source filenames, so the mounted path is
# /opt/guard/guard-script.sh (NOT guard.sh - that typo kept the
# guard in CrashLoopBackOff and the limits unapplied).
command: ["/bin/sh", "/opt/guard/guard-script.sh"]
env:
- name: DIRTY_BYTES
valueFrom:
configMapKeyRef:
name: etcd-io-guard-config
key: dirty-bytes
- name: DIRTY_BACKGROUND_BYTES
valueFrom:
configMapKeyRef:
name: etcd-io-guard-config
key: dirty-background-bytes
securityContext:
privileged: true
resources:
requests:
cpu: 5m
memory: 8Mi
limits:
cpu: 50m
memory: 32Mi
volumeMounts:
- name: host-proc-sys
mountPath: /host/proc/sys/vm
- name: script
mountPath: /opt/guard
readOnly: true
volumes:
- name: host-proc-sys
hostPath:
path: /proc/sys/vm
type: Directory
- name: script
configMap:
name: etcd-io-guard-script
defaultMode: 0755