Skip to content

jangboa/jenkins-pipeline-kubernetes

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CI/CD to Kubernetes using Jenkins and Helm

This project is an example of a complete CI/CD pipeline of a simple static web application from sources to deployed Kubernetes pods.

Artifactory as Docker registry

This project uses Artifactory as its Docker registry. You can get a free trial and try it out!

Follow the documentation for setting up your Docker registry.

Artifactory as Helm repository

This project uses Artifactory as its Helm repository. You can get a free trial and try it out!

Follow the documentation for setting up your Helm repository.

Jenkins

Setup a Jenkins running with

  • Docker. Can build and push images
  • Kubectl. Kubernetes CLI that will link Jenkins with the Kubernetes cluster
  • Helm. Kubernetes package manager to simplify deployment of your Docker containers to Kubernetes

There is a GitHub example of such a Docker image, to be used in Kubernetes.

Jenkins in Kubernetes

Jenkins running in Kubernetes can be found in this GitHub example.

  • This project is used to build a Jenkins master that has the required tools (docker, kubectl and helm) already installed
  • You can deploy this Jenkins to Kubernetes using the helm chart in the same repository
  • Notice that this is an example, and should not be used for production

General notes

  • The Jenkins pipeline example (Jenkinsfile) is using calls to external cli tools such as docker, kubectl, curl and other shell commands. Some of these can be replaced with groovy code and functions or built in pipeline steps, but are implemented like this to demonstrate the simple use of these tools.
  • The kubectl and helm clients are not configured in this example. It's assumed the Jenkins instance is pre-configured, or run it in your Kubernetes cluster, where it picks up the local pod credentials to access the Kubernetes API.

Build the web application

You can build the web application directly by running build.sh. You can create the Docker image and run it locally. See the build.sh options.

# See options
$ ./build.sh --help

You can also pack and push the Docker image and Helm chart.

About

An example of a Jenkins CI/CD pipeline to Kubernetes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 79.3%
  • HTML 10.3%
  • Smarty 7.6%
  • CSS 1.6%
  • Dockerfile 1.2%