The information contained in this article has been verified as up-to-date on the date of the original publication of the article. HashiCorp endeavors to keep this information up-to-date and correct, but it makes no representations or warranties of any kind, express or implied, about the ongoing completeness, accuracy, reliability, or suitability of the information provided.
All information contained in this article is for general information purposes only. Any reliance you place on such information as it applies to your use of your HashiCorp product is therefore strictly at your own risk.
This is a guide to increase CPU and memory resources in connect inject pods. The initial Helm chart defaults for the Consul containers are a bare minimum requirement to get Consul up and running for a multitude of environments, and Kubernetes resource tuning may be necessary to better suit your environment's needs as seen below.
Increasing the default resource of Consul connectInject pod will provide faster service registration and discovery times in the Envoy sidecar.
- k8s administrative privileges to Consul namespace.
- connect enabled
In the event, there are high delays during Envoy service registration and discovery, and if any performance increase is to occur, the resources allocated to this component should help improve your case.
Below are two types of procedures to adjust Memory and CPU on connectInject pods.
Adjust the CPU/memory on the connectInject deployment replicaSet
- Get the connect-inject deployment.
$ kubectl get deployment consul-connect-injector -n consul
NAME READY UP-TO-DATE AVAILABLE AGE
consul-connect-injector 1/1 1 1 47m
- Edit the consul-connect-injector deployment.
$ kubectl edit deployment consul-connect-injector -n consul
- Adjust "resources" for cpu and memory to desired limits. Increments of 50 are acceptable.
- Save the file and run the command to see the new connect-inject pod coming up with desired resources.
kubectl get pods -n consul
Adjust the CPU/memory on the connectInject pod using the helm upgrade command
- Create a values.yaml file with desired CPU/Memory values using your favorite editor e.g VIM.
- Use the helm command to upgrade with new values with your consul-k8s version.
helm upgrade consul hashicorp/consul -n consul -f values.yaml --version '1.1.0'
- Run the command to see the new connect-inject pod coming up with desired resources.
kubectl get pods -n consul
- Additionally, we can increase metrics for sidecarProxy and Connect injected init container with helm upgrade command using the below yaml.
sidecarProxy: #specific to envoy sidecars when scaling
More information about these metrics can be found in the following article: Service Mesh Registration Time Tuning - Consul K8s Control Plane Resources.
- Kubernetes site for kubectl edit
- Service Mesh Registration Time Tuning - Consul K8s Control Plane Resources