Install Jenkins, configure Docker as slave, set up cicd, deploy applications to k8s using Argo CD in GitOps way.
- create ec2 instance
- Pre-Requisites:
- java
- Install java
- sudo apt update
- sudo apt install openjdk-11-jre
- Verify Java is Installed
- java -version
- Installing jenkins
- curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | sudo tee
/usr/share/keyrings/jenkins-keyring.asc > /dev/null - 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 - sudo apt-get update
- sudo apt-get install jenkins
- Allow the inbound rule with port 8080 as jenkins by default runs on port 8080.
- Access the Jenkins on http://:8080
- To know the administration password the command is sudo cat /var/lib/jenkins/secrets/initialAdminPassword
- sudo su -
- usermod -aG docker jenkins
- usermod -aG docker ubuntu
- systemctl restart docker
- sudo su - -apt install unzip -adduser sonarqube
-wget https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-9.4.0.54424.zip
- unzip *
- chmod -R 755 /home/sonarqube/sonarqube-9.4.0.54424
- chown -R sonarqube:sonarqube /home/sonarqube/sonarqube-9.4.0.54424
- cd sonarqube-9.4.0.54424/bin/linux-x86-64/
- ./sonar.sh start
- Access the SonarQube Server on http://:9000
- install docker-pipeline plugin
- install sonarqube scanner plugin
- docker username & password given as credientials
- github token given as secret text
- sonarqube token given as secret text
- create ec2 instance and add Iam role with permissions -ec2fullaccess -cloudformationFullaccess -IamFullaccess -Administrator access
- commands to install awscli
- Refer--https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
- $ sudo su
- $ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
- $ apt install unzip, $ unzip awscliv2.zip
- $ sudo ./aws/install
- commands to install kubectl
- Refer--https://docs.aws.amazon.com/eks/latest/userguide/install-kubectl.html
- $ sudo su
- $ curl -O https://s3.us-west-2.amazonaws.com/amazon-eks/1.27.1/2023-04-19/bin/linux/amd64/kubectl
- $ ll , $ chmod +x ./kubectl //Gave executable permisions
- $ mv kubectl /bin //Because all our executable files are in /bin
- $ kubectl version --output=yaml
- Refer--https://github.com/eksctl-io/eksctl/blob/main/README.md#installation
- $ curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
- $ cd /tmp
- $ ll
- $ sudo mv /tmp/eksctl /bin
- $ eksctl version
- create eks cluster
- commands to install argocd
- $ kubectl create namespace argocd
- $ kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
- $ kubectl get pods -n argocd
- $ curl --silent --location -o /usr/local/bin/argocd https://github.com/argoproj/argo-cd/releases/download/v2.4.7/argocd-linux-amd64
- $ chmod +x /usr/local/bin/argocd
- $ kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'
- $ kubectl get svc -n argocd
- $ kubectl get secret argocd-initial-admin-secret -n argocd -o yaml
- $ echo XXXXXXX | base64 --decode
- create a job
- given git URL and git branch and jenkins file path
- installed necessary plugins including docker pipeline , sonarqube scanner plugins .
- Given credentials of Docker username & password,sonarqube token,github token
- now build the job
- In sonarqube quality check is passed
- create an application by connecting to repository
- created Pod
- created Deployment
- created Service
-Access the application using loadbalancer
- packaging the code using mvn clean package command
- creating image using docker build command
-
creating container from the image created using docker build command.
-
docker run -p $HOST_PORT:$CONTAINER_PORT --name <container_name> -t
: command to create container
- Access the application on localhost:port no

















































