End-to-End DevOps Implementation: Deploying a Multi-Tier Java Application on Kubernetes Cluster using Helm, DockerHub, SonarQube, Jenkins Declarative Pipeline, Docker, GitHub, and EC2 Kops Instance
- AWS Account
- Kubernetes Nodes
- DockerHub Account
- Jenkins Server
- SonarQube Server
- Kops VM (EC2 Instance)
- Spring MVC
- Spring Security
- Spring Data JPA
- Maven
- JSP
- MySQL
- AWS
- Docker
- Jenkins
- Kubernetes
- SonarQube
- Helm
- Continuous Integration Setup
- Jenkins, SonarQube, and Nexus (Continuous Integration Project)
- DockerHub Account (Containerization Project)
- Store DockerHub Credentials in Jenkins
- Setup Docker Engine in Jenkins
- Install Plugins in Jenkins
- a. Docker-pipeline
- b. Docker
- c. Pipeline utility
- Create Kubernetes Cluster with Kops
- Install Helm in Kops VM
- Create Helm Charts
- Test Charts in K8s Cluster in the test namespace.
- Add Kops VM as Jenkins Salve
- Create Pipeline code [Declarative]
- Update Git Repository with
- a. Helm Charts
- b. Dockerfile
- c. Jenkinsfile (pipeline code)
- Create Jenkins Job for Pipeline
- Run and Test the Job
- create an EC2 instance with
ubuntu20ltswitht3.micro - SSH to EC2 Instance and give the following command
sudo apt update && sudo apt install awscli -y- configure the AWS with the access-key with Administrative access
- Install Kubectl with the following Commands
-
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl -
now give the execution command and move it to the bin directory
-
chmod +x kubectl -
mv kubectl /usr/local/bin -
Install Kops with the following Commands
-
curl -LO https://github.com/kubernetes/kops/releases/download/$(curl -s https://api.github.com/repos/kubernetes/kops/releases/latest | grep tag_name | cut -d '"' -f 4)/kops-linux-amd64 -
chmod +x kops-linux-amd64 -
sudo mv kops-linux-amd64 /usr/local/bin/kops -
Create the Nodes using the following command
-
kops create cluster --name=kubepro.novocarenb.ca --state=s3://kubernetes-kops47 --zones=eu-north-1a,eu-north-1b --node-count=2 --node-size=t3.micro --master-size=t3.micro --dns-zone=kubepro.novocarenb.ca \ -
kops update cluster --name kubepro.novocarenb.ca --state=s3://kubernetes-kops47 --yes --admin -
Now wait for 20 minutes until your cluster is being created
-
Once cluster created validate using following command
-
kops validate cluster --name kubepro.novocarenb.ca --state=s3://kubernetes-kops47 -
Installation of Helm
cd /tmp/wget https://get.helm.sh/helm-v3.12.1-linux-amd64.tar.gztar xzvf helm-v3.12.1-linux-amd64.tar.gzcd linux-amd64/sudo mv helm /usr/local/bin/helmNow your Helm has been installed
-
GitHub Repo
- Clone the Project repo
git clone https://github.com/amitgitz/cicdkube-docker.git- Install the Java
sudo add-apt-repository ppa:openjdk-r/ppa sudo apt update sudo apt install openjdk-11-jdk -
Create the Namespace
kubectl create namespace prodkubectl get pods --namespace prod
-
Now go to the Jenkins
- create a node with KOPS Private Key and Validate it
- New Item : Kube-Deploy
- Type : Pipeline
- SCM : Git
- GitHub Repo : https://github.com/amitgitz/cicdkube-docker.git
- Branch : */main
- Save the file
- Click on Build
- If you did your configuration right your pipeline would be successfully built and your app deployed on the Kubernetes Cluster.

- You can check your app by going to AWS Load Balancer and copying the DNS Name and Pasting it in Browser
- Load Balancer Example : acc4522f717b440e6a158027f045451e-1353310725.eu-north-1.elb.amazonaws.com


- Now you can validate each of the Service of your app
- Once done with everything make sure to clean up all the resources
Connect me at https://www.linkedin.com/in/devopsamit/ if you have any queries or suggestions.
Thanks, Keep Learning the Cloud


