Redis
 sql >> Database >  >> NoSQL >> Redis

Disabilita le pagine enormi trasparenti da Kubernetes

Sì, con init-container è abbastanza semplice:

apiVersion: v1
kind: Pod
metadata:
  name: thp-test
spec:
  restartPolicy: Never
  terminationGracePeriodSeconds: 1
  volumes:
    - name: host-sys
      hostPath:
        path: /sys
  initContainers:
    - name: disable-thp
      image: busybox
      volumeMounts:
        - name: host-sys
          mountPath: /host-sys
      command: ["sh", "-c", "echo never >/host-sys/kernel/mm/transparent_hugepage/enabled"]
  containers:
    - name: busybox
      image: busybox
      command: ["cat", "/sys/kernel/mm/transparent_hugepage/enabled"]

Demo (notare che questa è un'impostazione a livello di sistema):

$ ssh THATNODE cat /sys/kernel/mm/transparent_hugepage/enabled
always [madvise] never
$ kubectl create -f thp-test.yaml
pod "thp-test" created
$ kubectl logs thp-test
always madvise [never]
$ kubectl delete pod thp-test
pod "thp-test" deleted
$ ssh THATNODE cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]