DEV Community

Rahul Wagh
Rahul Wagh

Posted on • Originally published at jhooq.com

How I set up AWS Kubernetes Jenkins pipeline?

In this lab session I will be setting up Kubernetes jenkins pipeline on AWS.

This will be a long session but I will be setting up everything from the scratch.

Here are steps which we will go through -

  1. Setting up AWS EC2 Machine - First we need to set up EC2 machine where we will be installing the Jenkins along with Gradle, kubectl, eksctl, docker. We can not use t2.micro instance because we will need more CPU and memory to run Jenkins and Gradle.

  2. Connect to EC2 machine - After starting the EC2 machine we will use the private key-pair file to connect to EC2 instance.

  3. Install JDK - As we need to install Jenkins so we need to have JDK(https://adoptopenjdk.net/) pre-installed onto the EC2 machine. For this lab session I will be using adopt open JDK 11.

  4. Install and Setup Jenkins - In this step we are going to install Jenkins and also going to the setup admin user

  5. Assign administrative privileges to Jenkins user - After installing and setting up the Jenkins on EC2 machine we need to assign root privileges so that we can execute Docker and Gradle commands inside the Jenkins pipeline

  6. Install Docker - The next step would be to install docker so that we can create a docker image and push the docker image to docker hub

  7. Install and Configure AWS CLI - After installing the docker we need to install and configure AWS CLI so that we can use EKSCTL to set up and start the Kubernetes cluster.

  8. Install kubectl - Also along with EKSCTL we need to install Kubectl so that we can view the deployments and services

  9. Install eksctl - Now we need to install eksctl so that we can set up and start the Kubernetes cluster without using AWS UI

  10. Add docker hub and GITHUB credentials - As we need to clone the github repo and push the docker image to docker hub we need to store credentials of github and docker inside Jenkins.

  11. Jenkins script for stages - Once we are done all the above steps we are going to write the Jenkins pipeline scripts for all the stages

Top comments (0)