Nikhil Verma

Sep 4, 20231 min

Build Jenkins Pipeline Using Git, Docker Hub, Podman and Kubernetes - Part 3

In this section we will do Jenkins configuration, Install all required plugins and integrated with Kubernetes.

From Part1 , we have already installed Jenkins using Terraform :

Let's set OPC and Root credentials :

Enter your intial admin password :

Install Plugins as per your requirement :

Post Installation setup your Admin password :

Make sure Kubernetes plugin installed :

Configure Security settings for agent communication :

Before Kubernetes configuration we need to create service account in Kubernetes , set appropriate permissions and bind role.

  • kubectl create serviceaccount jenkins

  • kubectl create clusterrole deployer --verb=get,list,watch,create,delete,patch,update --resource=deployments,pods,services

  • kubectl create clusterrolebinding deployer-srvacct-default-binding --clusterrole=deployer --serviceaccount=default:jenkins

Let's create secret for this service account :

apiVersion: v1
 
kind: Secret
 
type: kubernetes.io/service-account-token
 
metadata:
 
name: sa-secret
 
annotations:
 
kubernetes.io/service-account.name: “jenkins”

Let's use this for configuring Kubernetes in Jenkins

Click Test connection , make sure you are connected.

Remaining Options set it default.

Next we need to add DockerHub and GitHub account in Jenkins:

Git Account creation with Username and password.

Now our Jenkins integrated with Kubernetes , Next blog we will do Pipeline deployment.

    350
    0