diff --git a/helm-charts/README.md b/helm-charts/README.md index d3c62fb..8478a76 100644 --- a/helm-charts/README.md +++ b/helm-charts/README.md @@ -9,7 +9,8 @@ Helm is a package manager for Kubernetes, simplifying the process of defining, i 3. [Model Repository S3](#model-repository-s3) 4. [Install aws-ebs-csi-driver](#install-aws-ebs-csi-driver) 5. [Install Metric Server](#install-metric-server) -6. [Install Charts](#install-charts) +6. [Install Cluster Autoscaler](#install-cluster-autoscaler) +7. [Install Charts](#install-charts) - [Ingress Nginx Controller](#ingress-nginx-controller) - [Postgresql](#postgresql) - [Elastic Search](#elastic-search) @@ -20,13 +21,14 @@ Helm is a package manager for Kubernetes, simplifying the process of defining, i - [Text Search Application](#text-search-application) - [Backend Application](#backend-application) - [Frontend Application](#frontend-application) -7. [Load Test Horizontal Pod Autoscaling](#load-test-horizontal-pod-autoscaling) +8. [Load Test Autoscaling](#load-test-autoscaling) - [Test Backend Horizontal Pod Autoscaling](#test-backend-horizontal-pod-autoscaling) -8. [Upgrade Charts](#upgrade-charts) -9. [Uninstall Charts](#uninstall-charts) -10. [Clean up PVC](#clean-up-pvc) -11. [Check Resources](#check-resources) -12. [References](#references) + - [Test Cluster Autoscaler ](#test-cluster-autoscaler) +9. [Upgrade Charts](#upgrade-charts) +10. [Uninstall Charts](#uninstall-charts) +11. [Clean up PVC](#clean-up-pvc) +12. [Check Resources](#check-resources) +13. [References](#references) ## Architecture @@ -124,6 +126,14 @@ kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/late helm upgrade --install metrics-server metrics-server/metrics-server ``` +## Install Cluster Autoscaler +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: + ```bash + kubectl apply -f https://raw.githubusercontent.com/kubernetes/autoscaler/master/cluster-autoscaler/cloudprovider/aws/examples/cluster-autoscaler-autodiscover.yaml + ``` + ## Install Charts Step-by-step instructions to create namespaces and install various Helm charts like Ingress Nginx Controller, Postgresql, Elastic Search, Qdrant, Prometheus, Grafana, and others. @@ -215,7 +225,7 @@ Step-by-step instructions to create namespaces and install various Helm charts l helm install frontend-app ./frontend --namespace application --set nodeSelector.nodegroup-type=cpu-nodegroup ``` -## Load Test Horizontal Pod Autoscaling +## Load Test Autoscaling ### Test Backend Horizontal Pod Autoscaling @@ -274,6 +284,15 @@ Step-by-step instructions to create namespaces and install various Helm charts l Fig: Locust Test

+### Test Cluster Autoscaler + +

+ Cluster Autoscaler +
+ Fig: Cluster Autoscaler +

+ + ## Upgrade Charts Instructions on how to upgrade existing Helm Chart releases. @@ -365,4 +384,6 @@ Deleting PVCs is irreversible and can lead to data loss. Ensure backups are in p - [Qdrant Helm Charts](https://github.com/qdrant/qdrant-helm/tree/main/charts/qdrant) - [Elastic Cloud on Kubernetes Documentation](https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-stack-helm-chart.html) - [CSI driver for Amazon EBS](https://github.com/kubernetes-sigs/aws-ebs-csi-driver) -- [Kubernetes Metrics Server](https://github.com/kubernetes-sigs/metrics-server) \ No newline at end of file +- [Kubernetes Metrics Server](https://github.com/kubernetes-sigs/metrics-server) +- [Autoscaling in Kubernetes](https://kubernetes.io/blog/2016/07/autoscaling-in-kubernetes/) +- [Cluster Autoscaler on AWS](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/cloudprovider/aws/README.md) \ No newline at end of file diff --git a/helm-charts/assets/cluster-autoscaler.png b/helm-charts/assets/cluster-autoscaler.png new file mode 100644 index 0000000..d8c4f26 Binary files /dev/null and b/helm-charts/assets/cluster-autoscaler.png differ diff --git a/helm-charts/backend/templates/deployment.yaml b/helm-charts/backend/templates/deployment.yaml index 9b08a0e..45477ac 100644 --- a/helm-charts/backend/templates/deployment.yaml +++ b/helm-charts/backend/templates/deployment.yaml @@ -57,7 +57,6 @@ spec: port: http initialDelaySeconds: 5 periodSeconds: 5 - # Only limit resources for test hpa resources: {{- toYaml .Values.resources | nindent 12 }} {{- with .Values.nodeSelector }} diff --git a/helm-charts/backend/values.yaml b/helm-charts/backend/values.yaml index 96dcbc6..a6c3958 100644 --- a/helm-charts/backend/values.yaml +++ b/helm-charts/backend/values.yaml @@ -37,8 +37,11 @@ env: key: JWT_SECRET -# Only limit resources for test hpa resources: + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. limits: cpu: 500m memory: 256Mi diff --git a/helm-charts/cluster-config-eksctl.yaml b/helm-charts/cluster-config-eksctl.yaml index e595b1f..04b1214 100644 --- a/helm-charts/cluster-config-eksctl.yaml +++ b/helm-charts/cluster-config-eksctl.yaml @@ -36,26 +36,26 @@ nodeGroups: labels: nodegroup-type: cpu-nodegroup - - name: gpu-nodegroup - instanceType: g4dn.xlarge - instanceName: eks-gpu-node - minSize: 1 - maxSize: 3 - volumeSize: 60 - volumeType: gp3 - desiredCapacity: 1 - iam: - withAddonPolicies: - imageBuilder: true - autoScaler: true - externalDNS: true - certManager: true - appMesh: true - appMeshPreview: true - ebs: true - fsx: true - efs: true - labels: - nodegroup-type: gpu-nodegroup + # - name: gpu-nodegroup + # instanceType: g4dn.xlarge + # instanceName: eks-gpu-node + # minSize: 1 + # maxSize: 3 + # volumeSize: 60 + # volumeType: gp3 + # desiredCapacity: 1 + # iam: + # withAddonPolicies: + # imageBuilder: true + # autoScaler: true + # externalDNS: true + # certManager: true + # appMesh: true + # appMeshPreview: true + # ebs: true + # fsx: true + # efs: true + # labels: + # nodegroup-type: gpu-nodegroup availabilityZones: ["us-east-1a", "us-east-1b", "us-east-1c", "us-east-1d"] diff --git a/helm-charts/frontend/templates/deployment.yaml b/helm-charts/frontend/templates/deployment.yaml index 46c2ed4..5466e86 100644 --- a/helm-charts/frontend/templates/deployment.yaml +++ b/helm-charts/frontend/templates/deployment.yaml @@ -39,6 +39,8 @@ spec: httpGet: path: / port: http + resources: + {{- toYaml .Values.resources | nindent 12 }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/helm-charts/frontend/values.yaml b/helm-charts/frontend/values.yaml index 3fb47e0..02b782b 100644 --- a/helm-charts/frontend/values.yaml +++ b/helm-charts/frontend/values.yaml @@ -6,6 +6,14 @@ image: pullPolicy: Always tag: "latest" +resources: {} + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + service: type: ClusterIP port: 3000 diff --git a/helm-charts/image-search/templates/deployment.yaml b/helm-charts/image-search/templates/deployment.yaml index 5ead782..4c72a74 100644 --- a/helm-charts/image-search/templates/deployment.yaml +++ b/helm-charts/image-search/templates/deployment.yaml @@ -57,6 +57,8 @@ spec: # port: http # initialDelaySeconds: 5 # periodSeconds: 5 + resources: + {{- toYaml .Values.resources | nindent 12 }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/helm-charts/image-search/values.yaml b/helm-charts/image-search/values.yaml index 768accf..5c47cc2 100644 --- a/helm-charts/image-search/values.yaml +++ b/helm-charts/image-search/values.yaml @@ -6,6 +6,14 @@ image: pullPolicy: Always tag: "latest" +resources: {} + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + service: type: ClusterIP port: 7000 diff --git a/helm-charts/text-search/templates/deployment.yaml b/helm-charts/text-search/templates/deployment.yaml index ea364f4..932448a 100644 --- a/helm-charts/text-search/templates/deployment.yaml +++ b/helm-charts/text-search/templates/deployment.yaml @@ -57,6 +57,8 @@ spec: # port: http # initialDelaySeconds: 5 # periodSeconds: 5 + resources: + {{- toYaml .Values.resources | nindent 12 }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/helm-charts/text-search/values.yaml b/helm-charts/text-search/values.yaml index cf46922..45f9694 100644 --- a/helm-charts/text-search/values.yaml +++ b/helm-charts/text-search/values.yaml @@ -6,6 +6,14 @@ image: pullPolicy: Always tag: "latest" +resources: {} + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + service: type: ClusterIP port: 6000