Join us

Deploy to GKE Cluster from Jenkins

1_tGI3umgdq-9fd_7gh2f5rg.png

In this article we would revisit to see:

- Pre-requisites to configure on the kubernetes cluster deployed on GKE to connect from Jenkins

- Configuration/Plugins Required on the Jenkins

- How we can execute the simple manifest file ( Kind: Deployment/ Pod)

Step 1:

1.1. Setup the necessary environment variables

1.2. Create a service account using the Google Cloud SDK , this is the service account that is used when you login into your cluster on the GCP. Alternatively you can also create a new SA different from your default login as provide necessary roles.

1.3. Creation of Custom IAM Role with minimum permissions

Refer to https://github.com/santoshkothapalli/s3/blob/main/IAMRole.yaml

1.4. Assign the Role created in 1.3 to the service account

1.5. Download the key , this is required to be uploaded in the Jenkins Google Kubernetes Plugin to connect to the GKE Cluster

Step2 : There are various plugins provided to connect to Kubernetes clusters , we will leverage the Google Kubernetes Engine Plugin

2.1 Installation of Plugin

Navigate to Jenkins Home Page and then to Manage Jenkins -> Manage Plugins -> Available

Search for Google Kubernetes Engine Plugin and install the plugin.

2.2 Configuration of Plugin

Once the Plugin is installed navigate to Manage Jenkins -> Manage Credentials -> Store (Name would depend upon Jenkins configuration)

Add the Credential with the name , note the name as this will be used in your pipeline , upload the key downloaded in step 1.5 . Refer to below screen shot

Sample Pipeline script which is self explanatory is available at below path which would create a pod with nginx image on your cluster.

https://github.com/santoshkothapalli/s3/blob/main/env/Jenkinsfile_gke1


Only registered users can post comments. Please, login or signup.

Start blogging about your favorite technologies, reach more readers and earn rewards!

Join other developers and claim your FAUN account now!

User Popularity
34

Influence

3k

Total Hits

1

Posts