AWS EKS cluster integration to JENKINS

--

purpose: to do deployment into AWS EKS cluster from jenkins

  1. we have connect EKS cluster for that we can use the below command
aws eks --region <region> update-kubeconfig --name <cluster_name>notes: 1. for that you need to identify AWS identity , for that you can use either < aws IAM CLI cred> or <IAM role>

Note: configuring AWS CLI credentials is not secured for that we will go with IAM role

  • step1: create IAM role with “ AmazonEKSClusterPolicy “ policy

step2: to attach in IAM role at RBAC

for that use the below link (code is copin g from that bewlo link https://www.eksworkshop.com/intermediate/220_codepipeline/configmap

ROLE="    - rolearn: arn:aws:iam::$ACCOUNT_ID:role/EksWorkshopCodeBuildKubectlRole\n      username: build\n      groups:\n        - system:masters"

in the replace with your IAM Role ARN, 2. at the username section :patse <rolename>

lataer run the below commands as tease

kubectl get -n kube-system configmap/aws-auth -o yaml | awk "/mapRoles: \|/{print;print \"$ROLE\";next}1" > /tmp/aws-auth-patch.ymlkubectl patch configmap/aws-auth -n kube-system --patch "$(cat /tmp/aws-auth-patch.yml)"

step3: install awscli2 version, for that use the below link

note: you do not need to configure AWSCLI

finally run , kubectl get nodes

if it dispalys the output means ,it is working otherwise you did something wrong at RBAC section(step2 section)

--

--

Bala Bhaskara Rao Guntupalli
Bala Bhaskara Rao Guntupalli

No responses yet