- Helm3 installed
- Docker installed
- AWS CLI installed
- Eksctl installed
- Kubectl installed
- Git installed
-
Clone the repository:
git clone https://github.com/LondheShubham153/django-todo-cicd.git cd django-todo-cicd/
-
Build the Docker image:
docker build -t uj5ghare/django-todo-app .
-
Run the Docker image:
docker run -d -p 8000:8000 uj5ghare/django-todo-app
-
Login to Docker: Replace
<username>
and<password>
with your Docker credentials.DOCKER_USERNAME=<username> DOCKER_PASSWORD=<password> echo $DOCKER_PASSWORD | docker login --username $DOCKER_USERNAME --password-stdin
-
Push the Docker image:
docker push uj5ghare/django-todo-app
-
Create an EKS cluster:
eksctl create cluster --name cluster1 --region ap-south-1 --fargate
-
Update kubeconfig:
aws eks update-kubeconfig --name cluster1
-
Check the nodes:
kubectl get nodes
-
Create a Fargate profile:
eksctl create fargateprofile --name profile1 --cluster cluster1 --region ap-south-1 --namespace ns1
-
Go to this repository:
cd Django-ToDo-App/EKS/my-dir/manifests/
-
Apply the Kubernetes configuration:
kubectl apply -f .
-
Check all the resources in the namespace:
kubectl get all -n ns1
Follow the steps below to set up the AWS Load Balancer Controller on your EKS cluster.
-
Export your cluster name:
export cluster_name=cluster1
-
Get the OIDC ID:
oidc_id=$(aws eks describe-cluster --name $cluster_name --query "cluster.identity.oidc.issuer" --output text | cut -d '/' -f 5)
-
Associate the IAM OIDC provider:
eksctl utils associate-iam-oidc-provider --cluster $cluster_name --approve
-
Create the IAM policy:
aws iam create-policy --policy-name AWSLoadBalancerControllerIAMPolicy --policy-document file://iam_policy.json
-
Create the IAM service account:
eksctl create iamserviceaccount --cluster=cluster1 --namespace=kube-system --name=aws-load-balancer-controller --role-name AmazonEKSLoadBalancerControllerRole --attach-policy-arn=arn:aws:iam::<your-aws-account-id>:policy/AWSLoadBalancerControllerIAMPolicy --approve
-
Add the EKS helm repo:
helm repo add eks https://aws.github.io/eks-charts
-
Install the AWS Load Balancer Controller:
helm install aws-load-balancer-controller eks/aws-load-balancer-controller -n kube-system --set clusterName=cluster1 --set serviceAccount.create=false --set serviceAccount.name=aws-load-balancer-controller --set region=ap-south-1 --set vpcId=<your-vpc-id>
-
Verify the deployment:
kubectl get deployment -n kube-system aws-load-balancer-controller