kubernetes ci/cd with helm

Post on 19-Mar-2017

363 Views

Category:

Software

8 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Kubernetes CI/CD with Helm:Checking in your deployment configuration as code

Adnan Abdulhussein - @prydoniusSoftware Engineer, Bitnami

Agenda

Benefits of configuration/infrastructure as code

Managing Kubernetes deployments

Introduction to Helm

Demo CI/CD pipeline with Helm

Configuration and Infrastructureas Code

Host Management CI/CD InfrastructurePackaging

Configuration and Infrastructureas Code

Why?

Version Control

Consistent

Reproducible

Rollbacks

Auditing

Code Review

Tools

Source Code Management CI/CD Platform Deployment Tool Orchestration

Platform

Kubernetes Resource Definitions

MariaDB

Serviceresource

Database tier

Secretresource

Deploymentresource

Application

Serviceresource

Backend tier

Config Mapresource

Deploymentresource

Nginx

Serviceresource

Frontend tier

Deploymentresource

Example: Kubernetes Resource

apiVersion: v1kind: Deploymentmetadata: name: my-appspec: 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.yamlsecret "mariadb" configured$ kubectl apply -f ./mariadb-deployment.yamldeployment "mariadb" configured$ kubectl apply -f ./mariadb-service.yamlservice "mariadb" configured

$ kubectl apply -f ./application-configmap.yamlconfigmap "application" configured$ kubectl apply -f ./application-deployment.yamldeployment "application" configured$ kubectl apply -f ./application-service.yamlservice "application" configured

$ kubectl apply -f ./nginx-deployment.yamldeployment "nginx" configured$ kubectl apply -f ./nginx-service.yamlservice "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

Charts(packages)

Application definitions

Consist ofMetadata (Chart.yaml)

Kubernetes templates

Configuration file (values.yaml)

Documentation

Can depend on other charts

Navigating a Chart

MariaDB

Serviceresource

Database tier

Secretresource

Deploymentresource

Application

Serviceresource

Backend tier

Config Mapresource

Deploymentresource

Nginx

Serviceresource

Frontend tier

DeploymentresourceDocumentation

Metadata

Config File

helm install my-app

myapp├── Chart.yaml├── README.md├── charts│ └── mariadb-0.5.8.tgz├── templates│ ├── deployment.yaml│ └── ...└── values.yaml

Navigating a Chart

Public charts repository

CLI tool

Takes a local Chart path

Set parameters used in Chart templates

Release state stored in cluster

How the Helm can I setup CD?

Generic CI/CD pipeline

Code/config change

Build

Test

Publish artifacts

Staging/QA Deployment

Production Deployment

Manual verification

Demo: CI/CD Pipeline

Code/config change

Build

Test

Push Docker image

Staging/QA Deployment

Production Deployment

Manual verification

Demo: Todo List App

Application Code

Dockerfile

Jenkinsfile

Helm Chart

prydonius/node-todo

Amazing Todo App

● Express.js server

● Angular frontend

● MongoDB database

Demo

Helm + Jenkins vs. SpinnakerHelm 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

- more opinionated

- standardized configurations

- deploy multiple clouds/platforms

Helm Community

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

Join us!

Thank youTime for questions and (hopefully) answers...

top related