Skip to content

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
nangu001 committed May 3, 2024
1 parent 9e04bcc commit 48f264c
Showing 1 changed file with 33 additions and 37 deletions.
70 changes: 33 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,58 +1,54 @@
# How to setup and run terragrunt scripts for EKS related modules in a LAB account

## 1. Lab Account request and setup:
## Lab Account request and setup:
- Open a REMEDY ticket for creating an account in LAB environment, preferably with t3-admin role.
- LAB account url:https://pssvlab.tco.census.gov/PSS/
- Make a note that the LAB account password is different from laptop password
- Get your gpg keys pushed to lab-dev-ew (224384469011)
- login to lab-gov account using sso commands.
$ aws-sso-login.sh lab-gov
- Refer this page for additional help on sso credentials: https://github.e.it.census.gov/terraform/support/tree/master/docs/how-to/aws-sso
- Verify your sso credentials using the following command
$ aws sts get-caller-identity --profile <your profile name>
Example:
$ aws sts get-caller-identity --profile 224384469011-lab-dev-gov.inf-admin-t3
- Once you have successful log proceed to next steps below
## 2. Terrgrunt Setup:
- Create provider.tf file with sso profile and region
- Create terrgrunt.hcl file as specified in the repo
- Collect all the tags information required to build an EKS cluster
- Specify the source repo where EKS terraform code resides: git@github.e.it.census.gov:SCT-Engineering/tfmod-eks.git
- Gather all the values for the local variables required to build an EKS cluster
- For the remote backend to state file used an existing s3 bucket in this account: tg-infrastructure-tf-state-lab-dev-ew-us-gov-east-1
## Access LAB jumphost (bromine):
Refer this page for additional help on sso credentials: https://github.e.it.census.gov/terraform/support/tree/master/docs/how-to/aws-sso

## 3. Terraform/Terragrunt binaries and versions:
1. Goto LAB workspace:https://clients.amazonworkspaces.com/
2. Hit the web access login on the top right corner
3. Enter the following registration code: FRosu+FMEXNZ and click Register
4. Use your jbid and password (use lab password)
5. Open reflection client and ssh connect to bromine.cto.census.gov
6. On bromine, sso login to lab-gov as:
$ aws-sso-login.sh lab-gov
7. On a browser goto auth-dev.census.gov
8. Use PIV card option to login
9. Copy the link from step 6 and paste it on the portal and authenticate
10. Go back to bromine and doubleclick at an empty space, you should get successful login lab env

## Environment Setup:
- Set your profile as a default profile by exporting AWS_PROFILE variable
$ export AWS_PROFILE="224384469011-lab-dev-gov.inf-admin-t3"
$ aws sts get-caller-identity <to verify you are getting the credential from 224384469011>
- Run any aws commands to make sure you are getting responses from the account your profile is set to:
$ aws s3 ls

## Terraform/Terragrunt binaries and versions:
The following binaries used:
- Terraform version: v1.7.5
- Terragrunt version: v0.55.21
These versions can be found at on IEBCloud host:
/data/terraform/workspaces/mcgin314/tools/terragrunt
/data/terraform/workspaces/mcgin314/tools/terraform
Also these versions can be found at on bromine.cto.census.gov host:
These versions can be found on bromine.cto.census.gov host at:
/app/terraform/bin/terr* folder
- In order to use the above version of terraform/terragrunt, update the PATH env variable
$ export PATH=/data/terraform/workspaces/mcgin314/tools:$PATH

## 4. Environment Setup:
$ eval $(ssh-agent);cd $HOME/.ssh;ssh-add nangu001-git;
$ aws-sso-login.sh lab-gov
$ export AWS_PROFILE="224384469011-lab-dev-gov.inf-admin-t3"
$ aws sts get-caller-identity <to verify you are getting the credential from 224384469011>
$ Make sure NO_PROXY doesn't have .eks.amazonaws.com in the list ( do echo $NO_PROXY)

## 5. Run the Terragrunt script:
- Run terragrunt plan the dir
$ /data/terraform/workspaces/mcgin314/tools/terragrunt plan
## Run the Terragrunt script:
- Cd to specifc folder (example: cd eks) and Run terragrunt plan
$ terragrunt plan
- Verify the plan output and make sure there are no errors
- Run terragrunt apply
$ /data/terraform/workspaces/mcgin314/tools/terragrunt apply
$ terragrunt apply
- Verify apply completes successfully and verify the resources on AWS Console.

## 6. Accessing the cluster:
## Accessing the cluster:
$ aws eks --region us-gov-east-1 update-kubeconfig --name platform-eng-eks-test
$ kubectl config use-context arn:aws-us-gov:eks:us-gov-east-1:224384469011:cluster/platform-eng-eks-test
$ kubectl config get-contexts

## 7. Run few kubectl commands to verify you are accessing the cluster
## Run few kubectl commands to verify you are accessing the cluster
$ kubectl cluster-info
$ kubectl get pods -A
$ kubectl get ns
Expand Down

0 comments on commit 48f264c

Please sign in to comment.