1 of 33

Higher-Order Deployments

Reducing Boilerplate With Kubernetes Custom Resource Definitions

@jrbowes

April 18, 2018

2 of 33

}}

{{

@jrbowes

3 of 33

a puppet

(also a chef)

@jrbowes

4 of 33

5 of 33

Y

@jrbowes

6 of 33

CUSTOM

RESOURCE

DEFINITIONS.

CONTROLLERS.

ADMISSION

CONTROLLERS.

JAVASCRIPT?

@jrbowes

7 of 33

YES, WE

ARE HIRING

SIGN UP

TODAY

8 of 33

Photo by Caleb Jones on Unsplash

9 of 33

10 of 33

@jrbowes

11 of 33

Photo by chuttersnap on Unsplash

@jrbowes

12 of 33

13 of 33

By Frank Vincentz (Own work) GFDL via Wikimedia Commons

14 of 33

apiVersion: extensions/v1beta1

kind: Deployment

metadata:

name: worker

spec:

replicas: 2

strategy:

15 of 33

@jrbowes

16 of 33

@jrbowes

17 of 33

@jrbowes

18 of 33

Kubernetes is

Composition

@jrbowes

19 of 33

Kubernetes is

a Database

@jrbowes

20 of 33

Photo by Wine Dharma on Unsplash

  • 1 Custom Resource Definition
  • 1 Controller
  • Admission Controllers to taste

@jrbowes

21 of 33

apiVersion: apiextensions.k8s.io/v1beta1

kind: CustomResourceDefinition

metadata:

name: applications.manifold.co

spec:

group: stable.manifold.co

version: v1

scope: Namespaced

names:

plural: applications

singular: application

kind: Application

@jrbowes

22 of 33

validation:

openAPIV3Schema:

properties:

spec:

properties:

replicas:

type: integer

minimum: 2

image:

type: string

@jrbowes

23 of 33

@jrbowes

24 of 33

Start with

Metacontroller

@jrbowes

25 of 33

@jrbowes

26 of 33

Why?

27 of 33

@jrbowes

28 of 33

@jrbowes

29 of 33

@jrbowes

30 of 33

- name: Create my app's deployment

k8s_raw:

state: present

definition:

apiVersion: extensions/v1beta1

kind: Deployment

metadata:

name: my-app

spec:

replicas: 2

- name: Create all of my app

k8s_raw:

state: present

definition:

apiVersion: manifold.co/v1

kind: Application

metadata:

name: my-app

spec:

external: true

@jrbowes

31 of 33

  • CRDs are new & incomplete
    • No multi-version support yet

  • Many moving parts
    • Definition and controller

  • Attempts to simplify are still early
    • Metacontroller
    • Kubekit
    • Your cool project?

@jrbowes

32 of 33

33 of 33

Thank you!

@jrbowes

April 18, 2018