DEV Community

Cover image for ToDo-App Deployed on EKS Cluster
Tohid Hanfi
Tohid Hanfi

Posted on

ToDo-App Deployed on EKS Cluster

Table Of Contents

    * [Step 1- Step 7 --Setup your project according to you]
* [Step 8- Step 10 --Terraform for eks provisioning]
* [Step 11- Step 12 -- Circle Ci Setup]
* [Step 13 --CD setup using Argo cd]
Enter fullscreen mode Exit fullscreen mode




Let's Start our project

Step-1

Download my repositories from my github account named into to local computer:

  1. AppCode - https://github.com/tohidhanfi20/AppCode
  2. tf_code - https://github.com/tohidhanfi20/tf_code
  3. kube_manifest - https://github.com/tohidhanfi20/kube_manifest

Step-2

Make all the files according to your accounts like change github credentials, Docker Credentials.

Step-3 DEEP DIVE

Now as we are provisioning Terraforma as our infra as a code firstly,
we need to change certain changes into backend.tf file present in
tf_code/ToDo-App/backend.tf for that follow this Steps :-

  • Go To https://signin.aws.amazon.com/
  • Then after you logged Navigate to s3 service.
  • There is a option to create a bucket Click on it.
  • Choose a unique name for your bucket.
  • Note- Bucket should be present in the region were you will user terraform.
  • Enable Versioning in those settings.
  • Leave all things now to default.

Step-4

Now for dynanodb table follow this steps

  • Navigate to Dynamodb Dashboard.
  • There you will see tables option Click on that.
  • Edit a unique name and it should be present in your backend.tf file.
  • Make partition key - LockID (string)
  • Leave all things to default and make the table.

Step-5 SET UP TERRAFORM USER

Make new user for terraform - Steps

  • Navigate to IAM Dashboard
  • There is a user section
  • Make a new user with any name
  • Attach admin level permissions to it
  • save your access key and secret-access credentials

Step-6 SET UP YOUR VSCODE

Use vscode to setup your infra provisioning

  • install terraform into your local machine
  • install aws cli
  • set ENV variables in your system

Step-7 SET UP AWS account into vscode - command

aws configure
it will ask you following credentials

  • Access-keys ->
  • secret-access-key ->
  • Default-region -> ap-south-1
  • Default output format -> Don't change

Step-8 START WITH THE TERRAFORM COMMANDS

  • Go to the directory c:\users\asus\downloads\tf_code\ToDo_App
  • Now write terraform init -- to initialize the terraform backend
  • Now use terraform plan -- to plan what resources will be created
  • Then use terraform apply --auto-approve
  • This will created your Resources defined in your terraform files

Step-9 Our Resources are created now

  • We need now to set some variables
  • set $REGION=ap-south-1
  • set $CLUSTER_NAME=ToDo-App

  • We need to update the content of kubeconfig file with the variables we just have give

  • command --> aws eks update-kubeconfig --region ap-south-1 --name ToDo-App

Step-10 Check with the Kubernete's content is created or not

  • kubectl get pods -n=kube-system

Step-11 Circleci Setup

  • Setup your github account as organization
  • Select your repo in which your project is there --> AppCode

Step-12 Setup your ENV variable's into our CircleCi

  • Go to project settings
  • There we have ENV-VAR
  • Add there docker-username, Docker-pswd, Github personal token

Step-13 Check with argocd resources are created

  • now run following commands one by one
  • kubectl create ns argocd

kubectl apply -n argocd -f
https://raw.githubusercontent.com/argoproj/argocd/stable/manifests/install.sh

kubectl port-forward svc/argocd-server 8080:443 -n argocd

  • argocd is running on http:localhost:8080

admin - Username

password you can find in -->

kubectl get secrets -n=argocd

kubectl get secret argocd-initial-admin-secret -n=argocd

  • Now apply manifest file present in the tf_code repo

command- kubectl apply -f argo-manifest.yaml

ALL SET TO START

Top comments (0)