Skip to content

Latest commit

 

History

History
126 lines (64 loc) · 2.67 KB

README.md

File metadata and controls

126 lines (64 loc) · 2.67 KB

Deploy_to_EKS

What this does? This repo along with https://github.com/Gowrishankarc/Kubernetesmanifest creates a Jenkins pipeline with GitOps to deploy code into a Kubernetes cluster. CI part is done via Jenkins and CD part via ArgoCD (GitOps).

Jenkins installation

Update the system packages:

sudo apt update

Install Java (OpenJDK 11):

sudo apt install openjdk-17-jdk -y

Add Jenkins repository and key:

Add Jenkins GPG key:

curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | sudo tee
/usr/share/keyrings/jenkins-keyring.asc > /dev/null

Add Jenkins repository to your system:

echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc]
https://pkg.jenkins.io/debian binary/ | sudo tee
/etc/apt/sources.list.d/jenkins.list > /dev/null

Update the package list again and install Jenkins:

sudo apt update sudo apt install jenkins -y

Install aws cli

Download the installation script:

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"

Unzip the downloaded file:

unzip awscliv2.zip

Run the install script:

sudo ./aws/install

configure aws credentials:

aws configure Ensure you have the correct Access Key ID, Secret Access Key, region, and output format.

Install Kubectl

Download the latest release:

curl -LO "https://dl.k8s.io/release/$(curl -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"

Make the kubectl binary executable:

chmod +x ./kubectl

Move the binary to a directory included in your PATH:

sudo mv ./kubectl /usr/local/bin/kubectl

Verify the installation:

kubectl version --client

Steps to Configure kubectl for EKS

Update the kubeconfig File:

aws eks update-kubeconfig --name myapp-eks-cluster

Check Your AWS Credentials:

aws configure

Verify the Context:

kubectl config current-context

If it’s not pointing to your EKS cluster, you can set it using:

kubectl config use-context

Replace with the context name you want to use, which should be listed in your kubeconfig.

Test the Connection: Finally, test the connection again:

kubectl get pods

Jenkins plugins

Install the following plugins for the demo.

Docker Pipeline GitHub Integration Plugin Parameterized trigger Plugin

ArgoCD installation

Install ArgoCD in your Kubernetes cluster following this link - https://argo-cd.readthedocs.io/en/stable/getting_started/

Install helm

curl -LO https://get.helm.sh/helm-v3.14.2-linux-amd64.tar.gz

tar -zxvf helm-v3.14.2-linux-amd64.tar.gz

sudo mv linux-amd64/helm /usr/local/bin/helm

helm version

Install Prometheus and grafana

Install Prometheus and grafana following this link - https://www.fosstechnix.com/monitoring-aws-eks-using-prometheus-and-grafana/