feat: manage node-level kernel sysctls on the k3s scheduler
Sysctls the kernel does not namespace, such as `vm.max_map_count`, cannot be set from a pod spec and previously had no answer beyond editing `/etc/sysctl.d` on each host by hand. `scheduler-k3s:node-sysctls:set` now applies them through a privileged daemonset, which reaches nodes joined later and reapplies after a reboot. Sysctls may be scoped to a node profile, with a profile scope inheriting the global values and overriding them on conflict so that every node is covered by exactly one daemonset. Clearing a sysctl stops dokku managing it but does not restore the previous value, which persists until the node reboots.
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
annotations:
|
||||
dokku.com/managed: "true"
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ .Values.global.release_name }}
|
||||
app.kubernetes.io/part-of: dokku
|
||||
name: {{ .Values.global.release_name }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: {{ .Values.global.release_name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ .Values.global.release_name }}
|
||||
app.kubernetes.io/part-of: dokku
|
||||
spec:
|
||||
{{- if .Values.global.profile_name }}
|
||||
nodeSelector:
|
||||
dokku.com/node-profile: {{ .Values.global.profile_name | quote }}
|
||||
{{- else }}
|
||||
affinity:
|
||||
nodeAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: dokku.com/node-profile
|
||||
operator: DoesNotExist
|
||||
{{- end }}
|
||||
tolerations:
|
||||
- operator: Exists
|
||||
initContainers:
|
||||
- name: apply-sysctls
|
||||
image: {{ .Values.global.image | quote }}
|
||||
securityContext:
|
||||
privileged: true
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
set -e
|
||||
{{- range .Values.global.sysctls }}
|
||||
sysctl -w {{ printf "%s=%s" .name .value | quote }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: pause
|
||||
image: {{ .Values.global.pause_image | quote }}
|
||||
resources:
|
||||
requests:
|
||||
cpu: 1m
|
||||
memory: 8Mi
|
||||
Reference in New Issue
Block a user