Set vm.max_map_count on cluster nodes

前端 未结 3 634
面向向阳花
面向向阳花 2020-12-19 08:18

I try to install ElasticSearch (latest) on a cluster nodes on Google Container Engine but ElasticSearch needs the variable : vm.max_map_count to be >= 262144.

3条回答
  •  孤城傲影
    2020-12-19 09:03

    I found another solution while looking at this repository.

    It relies on the use of an init container, the plus side is that only the init container is running with privileges:

    annotations:
        pod.beta.kubernetes.io/init-containers: '[
          {
          "name": "sysctl",
            "image": "busybox",
            "imagePullPolicy": "IfNotPresent",
            "command": ["sysctl", "-w", "vm.max_map_count=262144"],
            "securityContext": {
              "privileged": true
            }
          }
        ]'
    

    There is a new syntax available since Kubernetes 1.6 which still works for 1.7. Starting with 1.8 this new syntax is required. The declaration of init containers is moved to spec:

      - name: init-sysctl
        image: busybox
        command:
        - sysctl
        - -w
        - vm.max_map_count=262144
        imagePullPolicy: IfNotPresent
        securityContext:
          privileged: true
    

提交回复
热议问题