Helm is a package manager for Kubernetes, simplifying the process of defining, installing, and upgrading Kubernetes applications. This document provides guidelines and references for using Helm Charts with various Kubernetes services and tools.
- Architecture
- Create Cluster and NodeGroup
- Model Repository S3
- Install aws-ebs-csi-driver
- Install Metric Server
- Install Cluster Autoscaler
- Install Charts
- Load Test Autoscaling
- Upgrade Charts
- Uninstall Charts
- Clean up PVC
- Check Resources
- References
-
Creating a Cluster and Node Group
eksctl create cluster -f cluster-config-eksctl.yaml
-
Deleting a Cluster and Node Group
eksctl delete cluster -f cluster-config-eksctl.yaml --disable-nodegroup-eviction --wait
Instructions to create an S3 bucket and copy a model repository from local to S3.
- Create S3 Bucket
aws s3api create-bucket --bucket qai-triton-repository --region us-east-1
- Copy Model Repository
aws s3 cp ./../triton-server/model_repository s3://qai-triton-repository/model_repository --recursive
You may deploy the EBS CSI driver via Kustomize, Helm, or as an Amazon EKS managed add-on.
- Kustomize
kubectl apply -k "github.com/kubernetes-sigs/aws-ebs-csi-driver/deploy/kubernetes/overlays/stable/?ref=release-1.25"
- Helm
-
Add the
aws-ebs-csi-driver
Helm repository.helm repo add aws-ebs-csi-driver https://kubernetes-sigs.github.io/aws-ebs-csi-driver helm repo update
-
Install the latest release of the driver.
helm upgrade --install aws-ebs-csi-driver \ --namespace kube-system \ aws-ebs-csi-driver/aws-ebs-csi-driver
Review the configuration values for the Helm chart.
Metrics Server collects resource metrics from Kubelets and exposes them in Kubernetes apiserver through Metrics API
for use by Horizontal Pod Autoscaler and Vertical Pod Autoscaler. Metrics API can also be accessed by kubectl top
,
making it easier to debug autoscaling pipelines.
- Kustomize
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
- Helm
-
Add the
metrics-server
Helm repository.helm repo add metrics-server https://kubernetes-sigs.github.io/metrics-server/
-
Install the latest release.
helm upgrade --install metrics-server metrics-server/metrics-server
On AWS, Cluster Autoscaler utilizes Amazon EC2 Auto Scaling Groups to manage node groups. Cluster Autoscaler typically runs as a Deployment in your cluster.
Create a Cluster Autoscaler deployment and service account:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/autoscaler/master/cluster-autoscaler/cloudprovider/aws/examples/cluster-autoscaler-autodiscover.yaml
Step-by-step instructions to create namespaces and install various Helm charts like Ingress Nginx Controller, Postgresql, Elastic Search, Qdrant, Prometheus, Grafana, and others.
- Create Namespaces
kubectl create namespace ingress-nginx kubectl create namespace application kubectl create namespace database kubectl create namespace model-serving kubectl create namespace monitoring
Installs the Ingress Nginx controller using Helm.
helm install ingress-nginx ./ingress-nginx --namespace ingress-nginx
Build dependencies and then install Postgresql Helm Chart.
helm dependency build ./postgresql
helm install database ./postgresql --namespace database --set auth.username=db_user,auth.password=db_password,auth.database=db_dev
Build dependencies and then install Elastic Search Helm Chart.
helm dependency build ./elasticsearch
helm install elasticsearch ./elasticsearch --namespace database --set master.masterOnly=false,master.replicaCount=1,data.replicaCount=0,coordinating.replicaCount=0,ingest.replicaCount=0,master.nodeSelector.nodegroup-type=cpu-nodegroup
Install Qdrant Helm Chart for vector search engine.
helm install qdrant ./qdrant --namespace database --set nodeSelector.nodegroup-type=cpu-nodegroup
Install Prometheus and Grafana for monitoring. Assumes availability of Prometheus and Grafana.
helm dependency build ./kube-prometheus-stack
helm install monitoring ./kube-prometheus-stack --namespace monitoring --set prometheus.prometheusSpec.serviceMonitorSelectorNilUsesHelmValues=false
Port-forward to Prometheus and Grafana services for local access.
kubectl port-forward service/monitoring-grafana 8080:80 --namespace monitoring
kubectl port-forward service/monitoring-kube-prometheus 9090:9090 --namespace monitoring
Load models from AWS S3 and deploy the inference server using Helm.
Convert AWS credentials to base64 and update values.yaml
.
echo -n 'REGION' | base64
echo -n 'SECRECT_KEY_ID' | base64
echo -n 'SECRET_ACCESS_KEY' | base64
Update model repository path in values.yaml
.
modelRepositoryPath: s3://qai-triton-repository/model_repository
Deploy the inference server.
helm install model-serving ./triton-inference-server --namespace model-serving --set nodeSelector.nodegroup-type=gpu-nodegroup
Install Image Search Application Helm Chart.
helm install image-search-app ./image-search --namespace application --set nodeSelector.nodegroup-type=cpu-nodegroup
Install Text Search Application Helm Chart.
helm install text-search-app ./text-search --namespace application --set nodeSelector.nodegroup-type=cpu-nodegroup
Install Backend Application Helm Chart.
helm install backend-app ./backend --namespace application --set nodeSelector.nodegroup-type=cpu-nodegroup
Install Frontend Application Helm Chart.
helm install frontend-app ./frontend --namespace application --set nodeSelector.nodegroup-type=cpu-nodegroup
-
Use Locust for Load Test
Navigate to the
locust
directory within the backend application and run Locust.cd ../backend/locust locust
-
Access Locust Web Interface Visit
http://localhost:8089
in your web browser to access the Locust web interface. -
Track Backend Application Scaling Run the following command to monitor the Horizontal Pod Autoscaler (HPA) for the backend application.
kubectl get hpa backend-app --namespace application --watch
-
Scale Up on Increased Load:
As the number of users increases in the Locust test, observe the backend-app pod scaling up.
-
Scale Down after Load Stops:
When the Locust test is stopped, monitor the backend-app pod scaling down.
-
Locust Test in Progress:
View the Locust test results on the web interface.
-
Instructions on how to upgrade existing Helm Chart releases.
helm upgrade [RELEASE_NAME] [CHART_NAME] --version [NEW_VERSION] -f [VALUES_FILE]
Guidelines to list and uninstall Helm Chart releases.
helm list
helm uninstall [RELEASE_NAME]
Deleting PVCs is irreversible and can lead to data loss. Ensure backups are in place before proceeding.
-
List All PVCs To view all PVCs across all namespaces:
kubectl get pvc --all-namespaces
-
Delete All PVCs To remove all PVCs in the cluster:
kubectl delete pvc --all --all-namespaces
-
Delete PVCs in a Specific Namespace To delete PVCs in a particular namespace:
kubectl delete pvc --all -n <namespace>
Replace
<namespace>
with the desired namespace name. -
Verify Deletion To confirm the PVCs have been removed:
kubectl get pvc --all-namespaces
Fig: Persistent Volume Claim (PVC)
- Bitnami Charts
- NetApp Postgres Helm Chart
- Helm Official Install Guide
- Ingress Nginx GitHub Repository
- Triton Inference Server AWS Deployment Guide
- Prometheus Community Helm Charts
- Qdrant Helm Charts
- Elastic Cloud on Kubernetes Documentation
- CSI driver for Amazon EBS
- Kubernetes Metrics Server
- Autoscaling in Kubernetes
- Cluster Autoscaler on AWS