1 of 41

Config Management and Containers

Charles Butler

Fosdem 2016

2 of 41

@lazypower

charles.butler@ubuntu.com

http://blog.dasroot.net

http://github.com/chuckbutler

3 of 41

We are the company

behind Ubuntu.

4 of 41

5 of 41

Genesis

6 of 41

“Operational pain can neither be created nor destroyed - only moved to someone else”

  • Nick Galbreath

7 of 41

Well… You can create it… :)

  • Joshua Corman

8 of 41

System Management Patterns

Divergence

Convergence

Congruence

9 of 41

Config Management Solved Problems

Stopped divergent delivery patterns from a pre-virtualized world

Best Attempt to eliminate snowflakes

Frameworks to describe machine state

Support upstream packaging (or from source deployments)

resource abstraction

1

2

3

4

5

10 of 41

Emergent issues w/ Config Management

Domain specific configuration managers

Context Sensitive Knowledge barriers.

10% technological—the rest is improved management, process, and user training. [1]

1

2

3

11 of 41

Enter Containers

The New Stack

12 of 41

Containers offer a way to virtualize an operating system.

This virtualization isolates processes, providing limited visibility and resource utilization to each, such that the processes appear to be running on separate machines.

13 of 41

Flavors

  • Many processes
  • runs /sbin/init
  • Has amenities like cron
  • SSH’able
  • Can be treated as immutable or mutable. But designed to be mutable

  • Single Process
  • No init
  • No amenities like cron
  • No SSH
  • typically run/handled as immutable objects

Application Containers

System Containers

Confidential Canonical™

14 of 41

image credit: https://www.howtoforge.com/tutorial/how-to-use-docker-introduction/

15 of 41

Benefits of “the new stack”

Resource Constraints

Density

Super Fast (often sub second)

No VM Overhead

1

2

3

4

16 of 41

Why Config Management & Containers

A critical look

17 of 41

Model Everything

18 of 41

Model containers and non-containers

manage not only the containers, but the environments around the containers

This is especially important, as containerized applications are nearly always talking to components

  • storage
  • database
  • networking

that are not in containers, and in some (rare) cases: unable to be placed in a container.

19 of 41

Chuck’s Adventure

20 of 41

Chuck’s Adventure

21 of 41

Delivery Patterns

Application containers vs uncontained delivery

22 of 41

Before

23 of 41

Kubernetes Charm as a Case Study

2283 total LOC

  • No Build Env
  • 8 Min Delivery
  • ~ 1 min upgrade cycle
  • Same model suggested by google

5317 total LOC

  • Required a Build Env
  • 15 Min Delivery
  • 8 min upgrade cycle
  • Different model than suggested by google

3,034 LOC reduction in cost of ownership

uncontained Delivery

containerized Delivery

Confidential Canonical™

24 of 41

After (mid flight)

25 of 41

26 of 41

Take a closer look @ the

Kubernetes Example

27 of 41

layer-docker

  • Delivers the latest -Stable engine from Docker’s PPA�
  • Provides a consistent interface to work with charming application containers.�
  • meaningful synthetic states - @when(‘docker.ready’)
  • Includes charms.docker

http://github.com/juju-solutions/layer-docker

28 of 41

charms.docker

  • Configure and interact with a Docker Daemon
    • Manage DOCKEROPTS

opts = DockerOpts()

opts.add(‘allow-insecure-registry’, True)

opts.to_string()

29 of 41

charms.docker

  • Interact with a docker-engine

from charms.docker import Docker�d = Docker()�pid = d.up('lazypower/idlerpg:latest', � dirs={"files/idlerpg":"/files/idlerpg"}, � ports=["8000:8000"])

30 of 41

charms.docker

  • Manage docker-compose templates

from charms.docker.compose import Compose

compose = Compose(‘files/tikiwiki’)

compose.up(‘mysql’)

compose.kill()

compose.rm()

31 of 41

Containers as Payloads

32 of 41

Containers as Payloads

  • System Containers can be delivered in a similar fashion
    • Pack in a quick-configuration script to carry your CM configuration values into the environment
    • lxd run /opt/configure_my_service foo=bar baz=bam

  • Generate the pre-configured containers with CM tooling
    • Juju, Chef, Puppet, Ansible, Saltstack, Foreman, CFEngine, or whatever strikes your fancy

33 of 41

LXD ships with everything you need

LXD can act as a hosting image server

  • Warehouse base images
  • Push container snapshots for migration / distribution
  • Trusted Registry by default, they’re all your containers

34 of 41

Where is charms.lxd then?

35 of 41

Simply stated:

LXC/LXD is natively supported in Juju. These “primitives” are exposed as a native “machine” to create units for an Application.

36 of 41

These principles work in every CM toolkit

37 of 41

Ansible Modules

38 of 41

Chef Cookbooks

https://supermarket.chef.io/cookbooks/container

Deliver and manage System Containers

https://supermarket.chef.io/cookbooks/docker

Deliver and manage Application Containers

39 of 41

Puppet Modules

https://github.com/tripledes/sjimenez-lxc

Deliver and manage System Containers

https://forge.puppetlabs.com/garethr/docker

Deliver and manage Application Containers

40 of 41

Salt Stack

41 of 41

Thanks for your time

Come see us @ CFGMGMTCAMP 2016 in Gent

http://summit.juju.solutions