Top Banner
openSUSE Kubic exploring the containerized frontiers Thorsten Kukuk Distinguished Engineer Future Technologies [email protected]
48

openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

Jul 22, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

openSUSE Kubicexploring the containerized frontiers

Thorsten Kukuk

Distinguished Engineer

Future Technologies

[email protected]

Page 2: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

2

Agenda

• What is Kubic?• openSUSE MicroOS• openSUSE Kubic• Transactional Update• Health Checker• Container Runtime• Kubernetes• Demo Time!• How we build openSUSE Kubic

Page 3: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

3

Kubic Project

Founded in May 2017

Sub-Project of the openSUSE Project

Focused on Container and Core Operating System Technologies

Project: https://kubic.opensuse.org

Page 4: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

4

Kubic Project

Based on openSUSE Tumbleweed• openSUSE MicroOS• openSUSE Kubic

Targeting the latest upstream container technologie• Simple Installer• Transactional Operating System Updates• Podman and CRI-O as container runtime• Kubeadm cluster bootstrapper• Whatever our community want to explore

Page 5: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

5

openSUSE MicroOS

Page 6: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

6

What is openSUSE MicroOS?

openSUSE MicroOS: Modern, Single Service Linux Operating

System, optimized for containers and large deployments.

openSUSE MicroOS inherits the openSUSE Tumbleweed knowledge while redefining the operating system into a small, efficient and

reliable distribution.

openSUSE MicroOS

Kubernetes

Contai

ners

Page 7: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

7

Single Service:

I get all the required support

from the OS

I’m small but powerful to run

as many containers as

needed

Page 8: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

8

Multi Purpose:

Roger Green from BEDFORD, UK, derivative work Lämpel - Airbus A380, CC BY 2.0

I’m designed to carry more than

what fit’s into me.Too heavy, too

expensive

Page 9: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

9

openSUSE MicroOS – Highlights

● The “Perfect” Container Host● Read-only root filesystem● Fully automated Transactional-Updates● Automatic initial configuration during first boot (Account, Network)● Podman as default container runtime● Rolling Release (openSUSE Tumbleweed based)

Page 10: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

10

Why MicroOS as OS development platform?

● Limited number of packages● But: full access to all openSUSE Tumbleweed packages

● Limited scope● SELinux on SLES: lot of functionality to cover● SELinux on MicroOS: very limited functionality, easy to keep running and

current (if you have somebody with the knowledge to get it running first!)● Quick rollback● Very flexible with system roles and patterns● Single Service → no breakage of other functionality

Page 11: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

11

What are we developing with it?

● Transactional updates● Security:

● Apparmor – read-only root filesystem ● SELinux – Framework, Policy, integration in transactional-update● IMA/EVM

● Rolling out of Kubernetes via kubeadm● Cluster Management

● Installation● Update

● IoT● https://kubic.opensuse.org/blog/2019-01-30-kubiconaarch64/

Page 12: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

12

openSUSE Kubic

Page 13: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

13

Pets or Cattle?

“In the old way of doing things, we treat our servers like pets, for example Bob the mail server. If Bob goes down, it’s all hands on deck. The CEO can’t get his email and it’s the end of the world. In the new way, servers are numbered, like cattle in a herd. For example, www001 to www100. When one server goes down, it’s taken out back, shot, and replaced on the line.”

(http://cloudscaling.com/blog/cloud-computing/the-history-of-pets-vs-cattle/)

Page 14: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

14

openSUSE Kubic

• Kubernetes Cluster using • openSUSE MicroOS as OS• CRI-O

• “Cattle”• System Roles:

• MicroOS with OCI Container• kubeadm (master)• kubeadm (salt minion)• …

• Contains everything to install, run and maintain a kubernetes cluster

Page 15: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

15

openSUSE Tumbleweed

• Multipurpose OS• “Pet”• Useable for everything

• Universal• With the overhead to be useable for everything• With the limitations to be useable for everything

Page 16: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

16

Common Mistakes

Treat a container like a virtual machine• This will reduce most of the advantages of the container model

(https://cloud.google.com/solutions/best-practices-for-building-containers)• Look at Native Cloud Applications

• Auto-scaling on any managed infrastructure

Treat your cattle's like a PET• May work with 10-30 node beginner cluster, but average is > 100 Nodes

Hardware consolidation• Workload for 4.5 Nodes → Cluster size of 5 Nodes

=> How do you want to schedule an update or replacement of a Node?

Page 17: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

17

Transactional Update

Page 18: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

18

“I NEVER want to touch a running system”- Every SysAdmin, ever

Page 19: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

19

Upgrading a Running System Is DANGEROUS

• Services are running• Users are doing things• Software changes things (sometimes on purpose!)• Not all packages are packaged properly (sorry!)

Page 20: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

20

Reality does not make things easy

openSUSE Tumbleweed – rolling release since many years

→ everything must be fine, or?

Rolling Releases bring larger challenges• Intrusive Updates (SysV init → systemd)• Major version updates of complex stacks (GNOME, KDE)• What should I do if the update breaks my system?

Page 21: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

21

Critical Mission Systems are even worse

• Update should not interrupt services

Service interruption more expensive than regular reboots

• Updates need to be fully applied perfectly, or not changes made

System state should never be undefined or questionable

RPM post-installation scripting can lead to an undefined state

Page 22: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

22

What is a Transactional Update

An update that• Is atomic

– Either fully applied, or not applied at all

– Update does not influence the running system

• Can be rolled back– A failed or incompatible update can be quickly discarded to restore the previous system

condition

Page 23: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

23

Updates with transactional-update

current/

Backup/ (pre)

1. new/ (post)

2.

3.

1. Snapshot of current system2. Create new target snapshot3. Update system and set as default for next boot

Current root file system is not modified!

Active system

Page 24: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

24

Learn More about Transactional Updates

Transactional Updates in SLE15 SP1 [TUT1110]

Wednesday, 10:00am – 11:00 am, Fisk 1

Page 25: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

25

Health Checker

Page 26: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

26

Health Checker

Checks for errors during boot phase● Error with new snapshot:

● Rollback to last known working snapshot● Error with already successful booted snapshot:

● Try reboot● Shutdown services, inform admin

● Needs access to harddisk

Page 27: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

27

Container Runtime

Page 28: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

28

CRI-O

• Kubernetes focused container runtime• Official Kubernetes Project with aligned releases• Open Project with broad contributor base including Red Hat, SUSE, Intel,

Google, IBM, Alibaba, etc• No large daemon• Lightweight, more easily securable with apparmor, seccomp, cgroups, etc

Page 29: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

29

Podman

• CLI tool for running OCI-containers in Pods• Shares core concepts and libraries with CRI-O

• Roadmap includes integration with CRI-O, replacing current container management layer

• Capable tool for standalone container hosts

• Able to pull & run cotnainers from any OCI registry (includes Docker Hub)• Syntax very similar to Docker Engine

• podman run <=> docker run• podman pull <=> docker pull

Page 30: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

30

Podman ‘pods’

• Additional functionality for managing k8s-like ‘pods’• podman pod create|rm|start|stop|ps

• Bulk manage containers and images• podman rm --all• podman rmi --all

• Supports systemd socket activation• Only start a container when a user tries to connect to the service

Page 31: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

31

Buildah

• Builds containers• From scratch, based on images, or using a Dockerfile• OCI or Docker Image Format• Mount/unmount live containers root filesystem• Create new container layers from filesystem changes

Page 32: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

32

Skopeo

Manages registries• Copying containers to and from registries• Inspecting a remote image showing its properties and layers without pulling• Deleting an image from an image repository.• Authentication supported

Page 33: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

33

Kubernetes/kubeadm

Page 34: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

34

kubeadm

• Upstream Kubernetes cluster bootstrapping tool• Under Active Development with expanding feature set• Released as GA since v1.13• Decoupled from kubelet (Kubernetes Node Agent)

• Allows upgrade of OS + kubelet independently of control plane• Control plane upgrades require user interaction eg. “kubeadm upgrade v1.13.0”

Page 35: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

35

Cluster Setup with kubeadm

• Check https://en.opensuse.org/Kubic:kubeadm for updates to this procedure• Install 2+ (recommended 3+) systems with openSUSE Kubic• Choose kubeadm Node system role

• Start install with defaults, or customise network, software, etc as you wish• Once installed, ssh / login to system that will be Master Node

• Run the following• kubeadm init --cri-socket=/var/run/crio/crio.sock --pod-network-cidr=10.244.0.0/16 • Copy/record the the “kubeadm join” command provided by the successful “kubeadm init”

Page 36: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

36

openSUSE Kubic and kubeadm

Page 37: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

37

Demo Time!

Page 38: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

38

What you should have seen

• Boot three images Kubic-1, Kubic-2 and Kubic-3• Run “kubeadm init” on first image• mkdir ${HOME}/.kube; cp “/etc/kubernetes/admin.conf ${HOME}/.kube/config• Setup flannel• Deploy kured• Setup salt master on first machine, accept minions

• Salt master is salt minion, too

• Run “salt -G 'roles:kube-worker' cmd.run kubeadm join <token>”• Install MetalLB Loadbalancer• Deploy “Hello World” on the kubernetes cluster

Page 39: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

39

How we build openSUSE Kubic

Page 40: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

40

Open Source, Unique Challenges

Upstream software projects move very fast• Linux Kernel – New version every 3 months• Kubernetes – New version every 3 months• Salt – New version every 3-6 months• Podman/skopeo/buildah – New version all the time

Page 41: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

41

Anatomy of a Linux Distribution

• “How to condense thousands of packages from thousands of different people into something which people can use?”

• Must be coherent, consistent, and operational• Linux Kernel + Toolchain + 1000’s of additional software packages

Page 42: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

42

DevOps OS Development

Page 43: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

43

Building Linux Better

https://openbuildservice.org/• Open Build Service started in February 2006• Used to build the openSUSE® & SUSE® distributions• Can also build packages for other distributions (Fedora/Red Hat, Ubuntu, Debian,

Arch, etc)• Also used by ownCloud, Linux Foundation, VideoLAN (VLC), Dell, Cray, Intel and

more.• Builds containers, and publishes in a notarised OCI registry:

• registry.opensuse.org

Page 44: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

44

Testing Linux Better

https://open.qa/ • openQA started in November 2009• Able to fully test Linux distributions from install to user applications• Integral part of the openSUSE® Kubic, Tumbleweed & Leap process• Used by SUSE® to test SUSE Linux Enterprise• Also used by Red Hat to test Fedora

Page 45: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

45

“Fancy, but I don’t want to wait for all that build & test nonsense”

Page 46: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

46

Working with Upstream Projects

• Kubernetes 1.13 – Released Dec 3rd, shipped Dec 10th

• CRI-O 1.13 – Released Jan 7th, shipped Jan 10th

• Podman 1.0.0 – Released Jan 16th, shipped Jan 15th (oops)

Page 47: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot

47

Thank you. See you on https://kubic.opensuse.org/!

Questions?

Page 48: openSUSE Kubic€¦ · 10 Why MicroOS as OS development platform? Limited number of packages But: full access to all openSUSE Tumbleweed packages Limited scope SELinux on SLES: lot