How to increase vm.max count to 262144 in the worker nodes to implement ELK.
search cancel

How to increase vm.max count to 262144 in the worker nodes to implement ELK.

book

Article ID: 313116

calendar_today

Updated On:

Products

VMware Tanzu Kubernetes Grid

Issue/Introduction

Symptoms:
Current count for vm.max count is low for implementation of ELK stack on TKGm Workload clusters.

Environment

VMware Tanzu Kubernetes Grid 1.x

Resolution

There is no resolution however there is a workaround available for it.

Workaround:
Target the Management cluster and retrieve the kubeadmconfigtemplate for the cluster, run the below command 
kubectl config use-context <Mgmt Cluster context>
kubectl get kubeadmconfigtemplate -n <namespace>
NAME AGE
workload-md-0 4d23h



Edit the kubeadmconfigtemplate add below two flags in the preKubeadmCommands section and save the kubeadmconfigtemplate.add below two lines in the preKubeadmCommands section and save the kubeadmconfigtemplate.         
kubectl edit kubeadmconfigtemplate workload-md-0

- sysctl -w vm.max_map_count=262144
- sysctl -w vm.nr_hugepages=0

 

 

In order to make this change in effect, patch the machine deployment which will roll out the new machines with the required set of changes.

kubectl get md -n <namespace>
kubectl patch machinedeployments.cluster.x-k8s.io <your_cluster>-md-0 -n <your_namespace> --type merge -p "{\"spec\":{\"template\":{\"metadata\":{\"annotations\":{\"date\":\"`date +'%s'`\"}}}}}"

 

This will patch the machine deployment and will rollout new machine in the cluster with the required set of configuration for vm.max count.

Note: The kubectl patch command is ran only for worker nodes after editing kubeadmconfigtemplate to rollout changes to vms.
Note: Replace <your_cluster> with the name of your cluster and <your_namespace> with the namespace where the cluster is deployed.