- Terraform
- Aws-cli
- git
- Kubectl
- Helm
- Aws-Iam-Authenticator
- Configure awscli
aws configure
and provide: - Create two key-pairs naming convention [environment]-bastion [staging-bastion and dev-bastion]
| Key | Value |
| -------------------------|:--------------------:|
| AWS Access Key ID | AXDJBJD************ |
| AWS Secret Access Key | HBDKJ4JD******* |
| Default region name | us-east-1 |
| Default output format | json |
- Clone the terraform code repository
- Go Inside Remote-Backend:
- Run
terraform init
to install provider. - Run
terraform apply --var-file dev.tfvars
to create remote backend in S3 and DynamoDB for dev environment. - Run
terraform apply --var-file staging.tfvars
to create remote backend in S3 and DynamoDB for staging environment
- Run
- Go Inside
[environment]/example (like dev-environment/dev/)
directory - Fill up the required variables in
example.tfvars
likeprofile
andregion
- Run
terraform init
- In first phase deploy base setup like Vpc, Bastion, Ecr, and Eks-Cluster, comment the remaining portion of code in main.tf from provider "kubernetes" to the end. then Run
terraform apply --var-file example.tfvars (dev.tfvars)
see what are the resources to be deploying and approve. - Export the kubeconfig
export KUBECONFIG=./kubeconfig_[environment]-eks-cluster
- Update the kubeconfig of eks-cluster
aws eks update-kubeconfig --region [region-code] --name [environment]-eks-cluster
- Fill up the required variables in
[environment].tfvars
likeecr-repository uri
andacm-certicate-arn
- In second phase, uncomment the remaining code in main.tf to the end then Run
terraform apply --var-file [environment].tfvars
again to setup deployments inside eks-cluster and approve - Edit the configmap
aws-auth
for users to access eks-clusterkubectl edit cm aws-auth -n kube-system
or add the user in theaws-auth.yaml
file and then Runkubectl apply -f aws-auth.yaml
- Login to jenkins server
- Go inside
Manage jenkins/Manage Plugins/available
and installnodejs
andbitbucket
plugins - Go inside
Manage jenkins/Global Tool Configuration/NodeJs
and follow:Name: 14.16.0
Version: NodeJS 14.16.0
Global npm packages to install: npm@6.14.12
- Save
-
Go inside
Manage jenkins/Credentials
Add credentials and follow:Kind: Username with password
Scope: Global
Username:ss-comprinno
Password: bitbucket-repository-password
ID: BitBuketCredsForDockerfile
Description: BitBuket Credentials for cloning repositories
- Go Inside
Configure System/Global properties/Environment variables
and set two environment variables - On
dashboard/New Item/
and follow:Item Name: dev-surveysparrow-pipeline
Type: Pipeline
Build Triggers: Build when a change is pushed to BitBucket
- Copy the pipeline script
dev-pipline or staging-pipline
in the terraform code repository and paste inside pipeline block - Save
- Click on
Build Now
and check the pipeline is working - Also create Webhook in bitbucket for continuous integration and continuous deployment
- Now commit a change in bitbucket repository and follow the pipeline till deployment completes
| Name | Value |
| ------------------|:--------:|
| BRANCH | master |
| OPTIONAL_SCRIPT | true |