You are on page 1of 22

Kubernetes CI/CD with Helm:

Checking in your deployment configuration as code

Adnan Abdulhussein - @prydonius


Software Engineer, Bitnami
Agenda

Benefits of configuration/infrastructure as code

Managing Kubernetes deployments

Introduction to Helm

Demo CI/CD pipeline with Helm


Configuration and Infrastructure
as Code

Host Management CI/CD Packaging Infrastructure


Configuration and Infrastructure
as Code

Why?

Version Control

Consistent

Reproducible

Rollbacks

Auditing
Tools

Source Code Orchestration


CI/CD Platform Deployment Tool
Management Platform
Kubernetes Resource Definitions

Service Service Service


resource resource resource

Secret Config Map


resource resource

Deployment Deployment Deployment


resource resource resource

MariaDB Application Nginx

Database tier Backend tier Frontend tier


Example: Kubernetes Resource

apiVersion: v1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 3
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-app
image: prydonius/node-todo:v1.0.0
ports:
- containerPort: 8080
livenessProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: 120
timeoutSeconds: 5
Example: Deploying to Kubernetes

$ kubectl apply -f ./mariadb-secret.yaml


secret "mariadb" configured
$ kubectl apply -f ./mariadb-deployment.yaml
deployment "mariadb" configured
$ kubectl apply -f ./mariadb-service.yaml
service "mariadb" configured

$ kubectl apply -f ./application-configmap.yaml


configmap "application" configured
$ kubectl apply -f ./application-deployment.yaml
deployment "application" configured
$ kubectl apply -f ./application-service.yaml
service "application" configured

$ kubectl apply -f ./nginx-deployment.yaml


deployment "nginx" configured
$ kubectl apply -f ./nginx-service.yaml
service "nginx" configured
Managing raw
manifests can be
difficult
No template parameterization

No application lifecycle hooks

No history of releases
Tool for managing
resources as a
single unit
Reuse resources

Logically group app resources

Manage app lifecycles


Application definitions

Consist of

Metadata (Chart.yaml)

Charts Kubernetes templates

(packages) Configuration file (values.yaml)

Documentation

Can depend on other charts


Navigating a Chart

Service Service Service


resource resource resource

Secret Config Map


Metadata resource resource

Deployment Deployment Deployment


Documentation resource resource resource

MariaDB Application Nginx

Config File Database tier Backend tier Frontend tier

helm install my-app


Navigating a Chart

myapp
├── Chart.yaml
├── README.md
├── charts
│ └── mariadb-0.5.8.tgz
├── templates
│ ├── deployment.yaml
│ └── ...
└── values.yaml
Public charts repository
How the Helm can I setup CD?

CLI tool

Takes a local Chart path

Set parameters used in Chart templates

Release state stored in cluster


Generic CI/CD pipeline

Code/config change

Build

Test

Publish artifacts

Staging/QA Deployment
Manual verification

Production Deployment
Demo: CI/CD Pipeline

Code/config change

Build

Test

Push Docker image

Staging/QA Deployment
Manual verification

Production Deployment
Demo: Todo List App

Helm Chart

Amazing Todo App


Jenkinsfile

● Express.js server
Dockerfile
● Angular frontend
● MongoDB database
Application Code

prydonius/node-todo
Demo
Helm + Jenkins vs. Spinnaker
Helm and Jenkins

+ config as code, single source of truth

+ multi-branch support (including pull requests)

+ rich source of plugins

+ single platform for CI and CD

Spinnaker

- more deployment strategies


Join
Helm Community us!

Over 100 contributors

1.5 years old

Slack channel: Kubernetes/#Helm

Public dev meetings: Thursdays @ 9:30 pacific

Weekly updates & demos at SIG-Apps meetings: Mondays @ 9am pacific


Thank you
Time for questions and (hopefully) answers...

You might also like