This project is containerized using Docker and deployed on AWS EKS using Kubernetes. The setup includes a multi-stage Dockerfile for efficient image building and Kubernetes manifests for deployment, services, and ingress.
Before you begin, ensure you have the following tools installed:
- Docker: For containerization.
- kubectl: CLI for working with Kubernetes clusters.
- AWS CLI: CLI for interacting with AWS services. Configure it using your AWS access key.
- eksctl: CLI for working with EKS clusters.
-
Understand the Project Flow
- Determine how the project works.
- Identify the port the project runs on.
-
Build a Multi-Stage Dockerfile
- Multi-stage builds help optimize the image size and improve build performance.
-
Create
deployment.ymlScript- Define the deployment configuration for the project.
-
Create
services.ymlScript- Define the service configuration for the project.
-
Create
ingress.ymlScript- Define the ingress configuration for the project.
To deploy the project on AWS EKS, follow these steps:
-
Install Prerequisites
- Ensure
kubectl,AWS CLI, andeksctlare installed and configured.
- Ensure
-
Create an EKS Cluster
- Use the following command to create an EKS cluster:
eksctl create cluster --name demo-cluster --region <enter your region like ap-south-1>
- Use the following command to create an EKS cluster:
-
Apply Kubernetes Manifests
- Use
kubectl apply -fcommand to deploy thedeployment.yml,services.yml, andingress.ymlfiles.
- Use
-
Delete the EKS Cluster
- Use the following command to delete the EKS cluster:
eksctl delete cluster --name demo-cluster --region <enter your region which you used above>
- Use the following command to delete the EKS cluster:
-
Nginx Ingress controler Config Ingress controller is bascially a Go lang program which will look at you ingress reosurces and it will create load balance as per the ingress resources.
- Use this to deply Nginx Ingress controller
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.11.1/deploy/static/provider/aws/deploy.yaml
- Use this to deply Nginx Ingress controller
-
Grab the Address of ingress and bind it to the respective IP address
- Use this to fetch the Ingress Address:
kubectl get ing
- Use this to get IP address:
nslookup <put the ingress address>
- Use this to do DNS mapping:
sudo vim /etc/host
- Bind the IP with the a host name like <go-web-app.local>
- After completing these all process you access your app on your specific hostname.
- Use this to fetch the Ingress Address:
-
Now create Helm chart creation
- Helm will automate all your deployments.
- Initialize helm using:
helm create <name like - web-app-chart>
- Delet all the template file and copy all the manifest file to template folder.
- Update values.yml file so that your deployments can fetch the values dynamically.
- Use this command to deploy all the resources:
helm install web-app ./web-app-chart
-
Implement CI/CD
- CI
- Using Github Actions
- Build and unit test
- Static code analysis
- create docker and push docker image
- update Helm
- CD
- Use GitOps and ArgoCD
- Pull the helm chart and publish it to the kubernetes.
- CI