Jenkins X is a CI / CD platform for Kubernetes. Jenkins X offers you the possibility to create or import applications, automatically built them and deploy them to Kubernetes. Each code change will results in a new deploy of your application, all automated because of the hooks.
In this tutorial I'll show you create a new Kubernetes cluster using Jenkins X . After the installation we will introduce CI / CD for a simple Spring Boot Rest Service from my GitHub. After I deploy him in a pod in staging environment, scale the amount of pods and promote the application to production environment.
- Install gcloud SDK
- Create a Google Cloud account
Install a Kubernetes cluster using Jenkins X
$ brew update $ brew tap jenkins-x/jx $ brew install jx $ jx --version
Create new project or use existing project, in my case the project name is devops-project (id = devops-project-225710 ) and the Kubernetes cluster is devops-project-kubernetes
Create a default Kubernetes cluster using
$ jx create cluster gke --skip-login --default-admin-password=xxxxxx -n devops-projet-kubernetes
Your Kubernetes context is now set to the namespace: jx To switch back to your original namespace use: jx namespace default For help on switching contexts see: https://jenkins-x.io/developing/kube-context/ To import existing projects into Jenkins: jx import To create a new Spring Boot microservice: jx create spring -d web -d actuator To create a new microservice from a quickstart: jx create quickstart
When everything is running, your browser will automatically open http://jenkins.jx.xx.xx.xx.xx.nip.io . Just be patient. There will follow an automated login and your Jenkins instance will be configured automatically.
In my case http://jenkins.jx.22.214.171.124.nip.io/
The install will also create two repositories and push them to your GitHub account.
Import our Spring Boot application as a pipeline with Jenkins X
It’s also possible to import a git project using a URL.
$ jx import --url https://github.com/Reddah-Cherara/rest-rcherara-book.git
Execute the commands which are returned in the output above.
Created Jenkins Project: http://jenkins.jx.126.96.36.199.nip.io/job/Reddah-Cherara/job/rest-rcherara-book/