Create docker/container images in a Kubernetes Jenkins pipeline
The challenge is quite simple: To deploy a pice of software to Kubernetes it's necessary to create the (docker) container image in a pipeline.
But the solution was not found directly. The most articles found show how to use the docker socket or tcp port to create images but since docker is no more part of Kubernetes this will not work any more.
The solution is to use 'kaniko'. Looks like the project is able to master image creation.
1) First install and configure Jenkins
- id: "admin"
name: "Jenkins Admin"
2) To push images in a repository (e.g. sonatype nexus) it's necessary to configure the repository credentials:
Create a file 'config.json' (the name must fit) and import it into the Jenkins namespace:
3) Create a pipeline:
4) Create a pod configuration
5) Create a Jenkins pipeline
In Jenkins create a new pipeline using the 'Jenkins' file as pipeline. Create a Dockerfile in the project root to create the container image.
Post a Comment