A Repo for NXT Solutions Assessment
docker build -t nodejs-app .
docker tag nodejs-app:latest your-dockerhub-username/nodejs-app:latest docker login docker push your-dockerhub-username/nodejs-app:latest
aws ecr get-login-password --region your-region | docker login --username AWS --password-stdin your-account-id.dkr.ecr.your-region.amazonaws.com docker tag nodejs-app:latest your-account-id.dkr.ecr.your-region.amazonaws.com/your-ecr-repo-name:latest docker push your-account-id.dkr.ecr.your-region.amazonaws.com/your-ecr-repo-name:latest
This will create the namespace where the application will be running along with the svc and any other needed things
kubectl apply -f nodeapp-namespace.yaml
kubectl apply -f nodeapp-deployment.yaml
This creates a svc that points to the application to be able to hit the application from outside the cluster (loadbalancer in our case)
kubectl apply -f nodeapp-svc.yaml
- Set Up EKS Cluster (if not already set up) Either using eksctl
eksctl create cluster --name my-cluster --region us-west-2 --nodegroup-name my-nodes --node-type t3.medium --nodes 3 --nodes-min 1 --nodes-max 4 --managed
=> This is a snapshot of a part of the script used to provision the EKS cluster
- After creating the EKS cluster
#!/bin/bash
CLUSTER_NAME="my-cluster" REGION="us-west-2" DEPLOYMENT_FILE="nodeapp-deployment.yaml" SERVICE_FILE="nodeapp-svc.yaml" IMAGE_URI="123456789012.dkr.ecr.us-west-2.amazonaws.com/nodejs-app:latest"
aws eks --region $REGION update-kubeconfig --name $CLUSTER_NAME
kubectl apply -f $DEPLOYMENT_FILE kubectl apply -f $SERVICE_FILE