Jenkins X: Preview Environment

Jenkins X

Preview environment

Continuous delivery by Jenkins X. Source: https://jenkins-x.io.

Creating Preview environment

  • builds the application
  • packages it into a Helm chart
  • creates a unique Kubernetes namespace -only on first build
  • deploys the application into the namespace
  • adds a pull request comment with preview environment URL
Pull request comment with preview environment URL
$ jx get previews

Dependencies of Preview environment

  • link Kubernetes service from other environment /namespace
  • create an instance of a dependency in the preview environment through Helm chart.

Service Linking

Link service to MySQL in staging environment.
$ kubectl get svc -n <preview environment namespace>

Creating a dependency instance

$ helm search mysql
$ helm search mysql
charts/preview/requirements.yaml
$ kubectl get svc,pod,pv -n <preview-env-NS>
  1. MySQL service is called <preview-env-NS>-mysql, in my case it is jx-michalfoksa-bellonda-pr-11-mysql.
  2. new, 8GB, persisted volume was claimed
  3. my-app1 cannot start. It is in ChrashLoopBackOff status and has already been restarted 6 times and counting.
  • service name is due to how Helm 2.x creates service names. More on it in The problem with Tiller
  • by default, MySQL chart claims 8GB persistent volume
  • my-app1 expects database to be available under `mysql` domain name. See data source URL: spring.datasource.url: jdbc:mysql://mysql:3306/db_example
charts/preview/values.yaml
$ kubectl get svc,pod,pv -n <preview-env-NS>

Cleanup

Automatically

$ jx garbage collect previews

Manually

My environment

Cloud provider:      GKE$ jx version
NAME VERSION
jx 1.3.701
jenkins x platform 0.0.3125
Kubernetes cluster v1.10.9-gke.5
kubectl v1.10.7
helm client v2.12.1+g02a47c7
helm server v2.12.0+gd325d2a
git git version 2.11.0
Operating System Debian GNU/Linux 9.6 (stretch)

--

--

--

Enthusiastic software engineer and passionate learner with a focus for open source, Java, Spring ecosystem and micro-services.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Easy Level Python Interview Coding Questions.

CS 373 Fall 2021 Week 6: Kevin Li

Top 10 Templates to Build a Software Development Status Report

Automate On-Premise Performance Testing With Azure DevOps and Linux

runner crouched at the starting line

HEADLESS! — Vulnerable Machine

Working with Images and Videos in OpenCV and Python

Software Engineering management is way more art than we want to admit

Blog Article 01 — About S.O.L.I.D Principles

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Michal Foksa

Michal Foksa

Enthusiastic software engineer and passionate learner with a focus for open source, Java, Spring ecosystem and micro-services.

More from Medium

Configuring Argo CD on a multi-node Hetzner Cloud

Istio — A K8s must-have tool

Gitlab runner in EKS

Setting custom headers using Ingress with Helm Chart