Deploy Application on Kubernetes Using Jenkins Multicloud-AWS Infra

Aniket Kumavat
5 min readMar 31, 2023

--

Organizations can escape being reliant on a single cloud vendor by adopting a multi-cloud strategy. It also makes it easier for customers to negotiate with service providers for better rates and service level agreements. Data centers for various cloud service companies are spread across various regions. Through the use of a multi-cloud approach, businesses can split up their tasks among various service providers, cutting down on latency and enhancing the user experience for clients in various geographies.

Figure: Architecture diagram for the implementation of the proposed solution

In this Architecture, we’ve specified how quickly we can deploy our application to multiple clouds using Jenkins, and today’s businesses are switching from monolithic to microservice architectures to improve their operations.

High-level Steps

  1. AWS and GCP infra by Aniketkumavat
  2. EKS creation and Jenkins pipeline setup in AWS by Bhavesh Dhande (here)
  3. Jenkins pipeline setup in GCP by Siddhesh Patil (here)
  4. GKE creation and Route traffic using Route53 GKE and EKS by Rushabh Mahale

Note- Beginning with step number 1, I’ll create a Infrastructure in AWS .

Prerequisites -

  1. Need AWS account to achieve this task.
  2. Basic knowledge of AWS and Linux.

AWS Infrastructure

In our project, we are going to set up a suitable environment which includes a VPC, an EC2 instance, and many more applications.

What is a Virtual Private Cloud Network (VPC) ?

The Virtual Private Network (VPC) is an isolated or private cloud computing environment within a public cloud. VPC provides networking for your cloud-based resources and services that are global, scalable, and flexible.
For more information on VPC and related topics, refer to this link .

In this first step, we will establish Eks-vpc in mumbai-ap-south1 region with a specific private CIDR.

Eks-vpc

What is subnet in aws ?

Subnet is a range of IP addresses in your VPC. You can create AWS resources, such as EC2 instances, in specific subnets. Each subnet must be completely contained inside a single availability zone (AZ) and cannot span zones. You can protect your applications from a single Availability Zone failure by launching Amazon services in separate Availability Zones. For more information, refer to the link.

Now create Eks-subnet and jenkins-subnet in different zones with specific CIDR.

Eks-subnet
jenkins-subnet

What is the Internet Gateway ?

An internet gateway is a horizontally scaled, redundant, and highly available VPC component that allows communication between your VPC and the internet. It supports IPv4 and IPv6 traffic. It does not cause availability risks or bandwidth constraints on your network traffic.

Create an Eks-vpc internet gateway for communication with the internet, which is also attached to Eks-vpc.

Eks-vpc internet gateway

Create an Eks-vpc route table that determines where network traffic from your subnet or gateway is directed and associates both subnets with the route table.

Eks-vpc route table

Below figure shows the road map of Eks-vpc.

Eks-vpc roadmap

Go and create EC2 instances.

What is EC2 Instance?

Elastic Cloud Computing is a fundamental service in AWS which offer virtual machine auto-scaling, storage, and storing data in virtual drives. This is IAAS.

Refer this document:- link

After setting up Eks-vpc, we will now create two EC2 instances, Eks-master-vm and jenkins-master-vm, in the Eks-vpc network.
Install required packages that need to run our applications

  1. Docker
  2. Java
  3. Jenkins
  4. Git

For installation go through this links Docker and Jenkins.

Jenkins-master-vm

After installation of Jenkins packages, hit the public IP along with the 8080 port, and then install the suggested packages in Jenkins.

In Eks-master-vm we are going to use configuration files through aws cli and kubectl.

Eks-master-vm

What is Jenkins?

Jenkins is an open-source continuous integration/continuous delivery, and continuous deployment (CI/CD) automation software DevOps tool written in the Java programming language.
After installation of Jenkins plugins the dashboard look like this

Jenkins Dashboard

CONCLUSION -

To build an isolated environment and increase application security, use a custom virtual private network (VPC) to create on-demand intercloud apps. Overall, configuring a VPC and running Docker and Jenkins on an EC2 instance can assist you in automating your software development and deployment processes, improving security, and increasing scalability.

In case you have any questions regarding this article, please feel free to comment in the comments section or contact me via LinkedIn.

I’d like to give a shout-out to my team at Guysinthecloud for all the support.

Thank You

--

--