In this article we are going to cover Deploy helm chart on EKS cluster | deploy application on eks using helm.
Table of Contents
What is Helm?
Helm is a package manager that works very similar to brew, choco, apt and yum on Mac OS, Windows, Debian and Red Hat, respectively. It is used for software installation and gives you the advantage of using a single command to install something. For example, if you followed a manual process to deploy a frontend application on an EKS cluster, it would likely involve running the following commands at the bear minimum.
Step #1:Install Helm on Ubuntu
Download the gpg key
curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg > /dev/null
Install the apt-transport-https
sudo apt-get install apt-transport-https --yes
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
We need to update your system packages:
sudo apt-get update
Now lets Install helm:
sudo apt-get install helm
Step #2:Install AWS CLI on Ubuntu
Download the aws cli bundle using below command
sudo curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
Extract the aws cli bundle setup
sudo unzip awscliv2.zip
Configure the AWS CLI on Ubuntu
sudo ./aws/install
Verify the AWS CLI version
aws --version
Step #3:Install eksctl CLI tool for creating EKS Clusters on AWS
Use below command to download eksctl CLI tool for creating EKS Clusters on AWS, To download latest eksctl tool visit eksctl official github page
curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
move eksctl setup to /usr/local/bin directory
sudo mv /tmp/eksctl /usr/local/bin
To check eksctl version
eksctl version
Step #4:Install kubectl binary with curl
Download the latest release with the command:
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
Install kubectl
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
Test to ensure the version you installed is up-to-date:
kubectl version --client
Output:
Client Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.3", GitCommit:"25b4e43193bcda6c7328a6d147b1fb73a33f1598", GitTreeState:"clean", BuildDate:"2023-06-14T09:53:42Z", GoVersion:"go1.20.5", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v5.0.1
Step #5:Create AWS Access Key ID and Secret Access Key
Now create AWS Access Key ID and Secret Access Key ID
- Go to the security credentials
2. Then click on create access key
Step #6:Configure AWS CLI
To connect AWS using CLI we have configure AWS user using below command
aws configure
it will ask AWS Access Key ID, AWS Secret Access Key, Default region name, Default output format
AWS Access Key ID [None]: *********7G
AWS Secret Access Key [None]: ***********************px
Default region name [None]: ap-south-1
Default output format [None]: json
Now you have connected your aws account using AWS CLI.
Step #7:Create Amazon EKS cluster using eksctl
Create Create EKS Cluster in AWS using eksctl
eksctl create cluster --name demo-ekscluster --region ap-south-1 --version 1.21 --nodegroup-name linux-nodes --node-type t2.micro --nodes 2
Step #8:Check nodes in EKS cluster
To check the details about your node run the below command
kubectl get nodes
Output:
NAME STATUS ROLES AGE VERSION
ip-192-168-14-133.ap-south-1.compute.internal Ready <none> 58m v1.27.1-eks-2f008fe
ip-192-168-41-158.ap-south-1.compute.internal Ready <none> 58m v1.27.1-eks-2f008fe
Step #9:Deploy Helm Chart on EKS cluster
You are going to name your chart ‘devopshint’, so the first step is to run the following command:
helm create devopshint
Output:
ubuntu@ip-172-31-8-100:~$ helm create devopshint
Creating devopshint
You can ensure that your kubectl command line tool is correctly configured to communicate with your EKS cluster with the following command:
kubectl config current-context
Output:
ubuntu@ip-172-31-8-100:~$ kubectl config current-context
[email protected]
You should see a response with the Amazon Resource Name (ARN) for your EKS cluster. To install the application with Helm/Deploy Helm Chart on EKS cluster, run the helm install command in the directory of the chart.
cd name-of-your-helm-chart helm install devopshint .
This will deploy your application, and to verify that the pod is running successfully, you can use kubectl to fetch the pods in the default namespace of your EKS cluster.
kubectl get pods
Output:
NAME READY STATUS RESTARTS AGE devopshint-dfbdc6699-ptmf7 1/1 Running 0 50s
Once you’ve confirmed that the pod is running, the next step will be to upgrade your application. This upgrade will involve an update to the configuration of the service. You can modify the service type from ClusterIP to LoadBalancer in the values.yaml file.
This will make the application publicly accessible. You can then save the file and run the helm upgrade command.
helm upgrade devopshint .
Once the upgrade is complete, you can get the domain name (listed under External IP) from the service. Keep in mind, the load balancer typically takes a few minutes to get fully setup and configured.
kubectl get svc
Step #10:To delete the EKS Cluster run:
eksctl delete cluster your-cluster-name
Conclusion:
In this article we have covered Deploy Helm Chart on EKS cluster.
Related Articles:
How to Create Amazon EKS cluster using eksctl [2 Steps]
Reference: