How to do it...

There are two important parts to go through in the Jenkins setup:

  1. Jenkins needs to run a docker command to build your application to compose your container image
  2. Jenkins need to communicate with the Kubernetes master to control deployment

To achieve step 1, there is a tricky part that needs something like a Docker-in-Docker (dind). This is because Jenkins is run by Kubernetes as a pod (Docker container), and Jenkins also needs to invoke a docker command to build your application. It can be achieved by mounting /var/run/docker.sock from the Kubernetes node to the Jenkins pod that can communicate with Jenkins, the Kubernetes node, and the Docker daemon.

In order to achieve step 2, we will set up a Kubernetes service account and assign one ClusterRole so that the Jenkins service account can have a necessary privilege.

Let's do it step by step.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.230.81