Kubernetes' Architecture Deep Dive - Umeå May 2019
Kubernetes' Architecture Deep Dive - Umeå May 2019
Deep Dive
Lucas Käldström - CNCF Ambassador
7th of May 2019 - Umeå
1 Image credit: @ashleymcnamara
$ whoami
Lucas Käldström, High School Student, 19 years old
4
Source
Orchestration Monitoring Distributed Tracing Logging Remote Container Runtime Container Runtime Networking API Distributed Tracing Software Update
API Procedure Call Spec
Service Proxy Security Storage Service Discovery Messaging Service Mesh Package Storage Registry Key/Value
Management Store
• Platinum members:
5
Source
CNCF Project Maturities
LATE MAJORITY
GRADUATED “CONSERVATIVES”
“THE CHASM”
INCUBATING
INNOVATORS
“TECHIES”
SANDBOX
SANDBOX
Identity Spec Identity Policy Serverless Tooling Metrics Spec Key/Value Store Monitoring Packaging Container Image Nodeless
6 Spec Security Distribution
7
Cloud Native
Trail Map
8 Source
Source
9
Online, Proctored Kubernetes Exams
10 Source
Certified Kubernetes Conformance
11 Source
75 Certified Kubernetes Partners
12 Source
KubeCon + CloudNativeCon
• Europe 2019 (sponsorships and CFP open)
– Barcelona: May 20-23, 2019
13 Source
KubeCon + CloudNativeCon Attendance
14 Source
Kubernetes on a
high-level
Kubernetes lets you efficiently declaratively manage your apps at any scale
Most importantly: What does “Kubernetes” mean?
16
What is Kubernetes?
= A Production-Grade Container Orchestration System
● Autoscale Workloads
● Blue/Green Deployments
● Fire off Jobs and scheduled CronJobs
● Manage Stateless and Stateful Applications
● Built-in Service Discovery
● ~Easily integrate and support 3rd party apps~
20
Most Importantly...
21
Kubernetes’ incredible velocity (last 365 days!)
32 000+ 15 000+
human commits
50 000+ contributors
55 000+ edX course enrolls
users on Slack
51 000+
opened
Pull Requests
318 000+
35 000+ Github comments
Kubernetes jobs 73 000+
opened issues
88 000+
Kubernetes
professionals Last updated: 09.01.2019
23
Kubernetes’
Architecture
Kubernetes’ high-level component architecture
Control Plane etcd (key-value DB, SSOT)
Nodes
Legend: Networking Networking Networking
CNI
CRI
Kubelet Kubelet Kubelet
OCI Container Container Container
Protobuf
gRPC Runtime Runtime Runtime
JSON
OS OS OS
Node 1 Node 2 Node 3
25
kube-apiserver, the heart of the cluster
● Provides a forward facing REST interface into the
Kubernetes control plane and datastore.
● All clients and other applications interact with
Kubernetes strictly through the API Server.
● Acts as the gatekeeper to the cluster by handling
authentication and authorization, request
validation, mutation, and admission control in
addition to being the front-end to the backing
26 datastore.
etcd, the key-value datastore
28
kube-scheduler, the placement engine
32
Kubernetes Networking
33
kube-proxy, the Service proxier
35
Cluster DNS, today CoreDNS
36
The Kubernetes Dashboard
37
Kubernetes is extensible (!)
● CNI (Container Network Interface) - write your own network plugin for the
cluster
● CRI (Container Runtime Interface) - write your own container runtime for
Kubernetes
● CSI (Container Storage Interface) - write your own persistent storage plugin
● Device Plugins - register custom devices present on your Node
● Pluggable cloud providers - write your own extension that integrates with your
cloud
● CustomResourceDefinitions - create your own Kubernetes Resources easily
● API Aggregation - proxy a new API group from the core API server to your
38 extension
Kubernetes Applied
Dive into how to use Kubernetes in practice
Create a cluster with kubeadm
1. Provision a Linux machine
2. Install kubeadm from package repos or by hand:
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
echo “deb http://apt.kubernetes.io/ kubernetes-xenial main” > /etc/apt/sources.list.d/k8s.list
apt-get update && apt-get install -y kubeadm docker.io
Layer 3
Addons Addon Operators
Cloud Provider Load Balancers Monitoring Logging
Kubernetes API
Layer 2
Bootstrapping kubeadm
kubeadm kubeadm kubeadm kubeadm
Layer 1
Cluster API
Infrastructure
41
kubeadm vs an “end-to-end solution”
kubeadm is built to be part of a higher-level solution
end-to-end solution
Kubernetes API
Infrastructure
42
75 Certified Kubernetes Partners
43 Source
The core primitive: A Pod
apiVersion: v1
● The basic, atomically deployable unit. kind: Pod
metadata:
name: nginx
● Consists of one or many co-located namespace: default
labels:
containers. app: nginx
spec:
containers:
● Represents a single instance of an - image: nginx:1.13.9
name: nginx
application. ports:
- name: http
containerPort: 80
44
The core primitive: A Pod
apiVersion: v1
kind: Pod
metadata:
● Has its own random internal IP address name: nginx
namespace: default
● Containers share network & volumes labels:
app: nginx
48
app: nginx
Access your replicated Pods via a Service
apiVersion: v1
kind: Service
● Accessible in the cluster through its IP metadata:
name: nginx
namespace: default
address or via its internal DNS name labels:
app: nginx
(here: nginx.default.svc.cluster.local) spec:
type: ClusterIP
ports:
● Can expose multiple ports - name: http
port: 80
targetPort: 80
selector: Pod Selector
49
app: nginx
Expose your Service to the world with an Ingress
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: nginx
● Expose your Service to the outer namespace: default
labels:
50
Expose your Service to the world with an Ingress
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: nginx
● The Ingress Implementation is namespace: default
labels:
51
Internet
Namespace: default
used for grouping and policy
nginx Ingress Rule
● Role Based Access Control (RBAC), and
nginx Service
other Policies operate based on
nginx nginx nginx
Namespaces Pod 1 Pod 2 Pod 3
nginx Deployment
52
What happens
when you create
a Deployment?
53
Kubernetes’ Community
Navigate the community with this map
How do I kick the tires with Kubernetes?
55
Everything is done in Special Interest Groups
Special Interest Groups (SIGs)
manage Kubernetes’ various
components and features.
58
Next step: Check out this AWESOME
182-slide Kubernetes workshop presentation,
made by Bob Killen and Jeffrey Sica from the
University of Michigan.
Kubernetes
An Introduction
CC-BY 4.0
59
Kubernetes v1.12 11/2018
Various excellent blog posts
Core Kubernetes: Jazz Improv over Orchestration - Joe Beda, 30th of May
2017
Kubernetes deep dive: API Server, Part 1 - Michael Hausenblas & Stefan
Schimanski, 28th April 2017
Kubernetes deep dive: API Server, Part 2 - Michael & Stefan, 21st July 2017
Kubernetes deep dive: API Server, Part 3 - Michael & Stefan, 15th August
2017
Reasons Kubernetes is cool - Julia Evans, 5th October 2017
How Kubernetes certificate authorities work - Julia Evans, 5th August
2017
Operating a Kubernetes network - Julia Evans, 10th October 2017
60
Join the community in Barcelona, Shanghai and San Diego!
61
Thank you!
@luxas on Github
@luxas on Kubernetes’ Slack
@kubernetesonarm on Twitter
[email protected]