Step by step installation and configuration of client machine for CI/CD integration - Jenkins
Step by step installation and configuration of client
machine for CI/CD integration
1, Create
an ubuntu Ec2 instance – volume 15 GB
2, Install
awscli v2
$ curl
"https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o
"awscliv2.zip"
$ sudo apt install unzip
$ unzip awscliv2.zip
$ sudo ./aws/install
3,
Configure AWS CLI to interact with AWS
$ ubuntu@ip-172-31-88-76:~$ aws configure
AWS Access Key ID [****************BCXU]:
AWS Secret Access Key [****************cRPe]:
Default region name [us-east-1]: us-east-1
Default output format [json]:
$ ubuntu@ip-172-31-88-76:~$ aws eks list-clusters
{
"clusters":
[
"abushad-eks"
]
}
4,
Install kubectl
$ curl -o kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.21.2/2021-07-05/bin/linux/amd64/kubectl
$ chmod +x ./kubectl
$
mkdir -p $HOME/bin && cp ./kubectl $HOME/bin/kubectl && export
PATH=$PATH:$HOME/bin
$
echo 'export PATH=$PATH:$HOME/bin' >> ~/.bashrc
$ kubectl version --short --client
$
kubectl get all
5,
Install eksctl
$ curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname
-s)_amd64.tar.gz" | tar xz -C /tmp
$ sudo mv /tmp/eksctl /usr/local/bin
$ eksctl version
0.71.0
$ eksctl get clusters
6,
Install EKS cluster using eksctl
$ eksctl create cluster --region us-east-1 --name abushad-eks
--nodegroup-name worker-node --nodes 1 --nodes-min 1 --nodes-max 1 --node-type
t3.small --node-volume-size 15
7,
Install Docker , official link is provided below
$ sudo curl -fsSL get.docker.com | /bin/bash
https://docs.docker.com/engine/install/ubuntu/
$ sudo docker run hello-world
$ sudo docker ps -a
8,
Install OpenJDK , Prerequisite for Jenkins installation
$ sudo apt update
$ sudo apt install openjdk-11-jdk
9,
Install Jenkins and Configuration
$ wget -q -O -
https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
$ sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable
binary/ > \
/etc/apt/sources.list.d/jenkins.list'
$ sudo apt-get update
$ sudo apt-get install jenkins
$ sudo systemctl status jenkins
9.1, To
allow 8080 port to be accessed from outside – Do the following
Go to ec2 – select instance – go to security – select
security group – add inbound rule and give 8080 in custom port
9.2, Now
Jenkins will be accessible in http://dnsnameofec2:8080
9.3, Take
the initial credential from the below file
$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword
946e4e15523e48d79c01b77e92681117
9.4, And
use the select the suggested plugins option
$ sudo usermod -aG docker jenkins
Create
git_cred2 credentials in Jenkins with private token
Private token
is created using github settings -developer settings ,
Install
maven – dashboard – manage Jenkins – global tools configuration – maven – name
– maven-3.8.3
11.
Configure kubectl to work in Jenkins user
Copy kubectl from ubuntu user
home dir to /usr/local/bin
$ sudo cp kubectl /usr/local/bin/
Copy kube config from ubuntu user home dir to Jenkins home
dir
$ vi .kube/config
11.1, Configure
AWC CLI to access AWS
$ aws configure
$ kubectl get nodes
$ eksctl get clusters
Comments
Post a Comment