2. Agenda
โ What is Kubernetes?
โ Architecture
โ Main concepts with hands on examples
3. Pre-check: who doesnโt know what a container is?
โ โContainers are an abstraction at the app layer that packages code and
dependencies together.โ
โ They donโt really existโฆ
โ CGroups
โ Namespaces
โ Docker: nice UX on top of running isolated self contained applications
โ Immutable artifacts
4. Kubernetes
โ Open Source container orchestration system
โ Inspired by Borg, Omega, Mesos
โ Started at Google, donated to CNCF
18. Pod
โ The โscheduling unitโ of Kubernetes
โ Doesnโt get restarted when terminates (can be one shot)
โ Pods are collection of one or more containers
19. Pod in one picture
Instance (node 1)
Pod 1 Pod 2
Container 1
Container 2
Container 3
Container 4
Instance (node 2)
Pod 3 Pod 4
Container 5
Container 6
Container 7
Container 8
20. Pod
โ Containers in the same pod are guaranteed to be on the same host
โ Containers in the same pod can talk via localhost
โ Every pod gets a dedicated virtual IP address in the โpod networkโ
โ Analogy: your application instance in AWS
22. Kubernetes patterns: reconciler
โ Controllers in Kubernetes are built by implementing the reconciler pattern
โ GetCurrentState()
โ GetDesiredState()
โ Apply()
โ Controller manager: enforces deployment replicas
23. Deployment
โ Defines a single application in Kubernetes handled by the system
โ Analogy: Autoscaling Group in AWS
โ You set the desired state, Kubernetes enforces it
24. Deployment
apiVersion: apps/v1beta1
kind: Deployment
metadata:
# Unique key of the Deploymentinstance
name: deployment-example
spec:
# 3 Pods should exist at all times.
replicas: 3
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
# Run this image
image: nginx:1.10
26. Kubernetesโ overlay networking
โ Every pod gets its own IP from a dedicated overlay network
โ Solves the problem of port mapping
โ No NAT needed
โ Implemented via software solution (flannel, calico, weave, โฆ)
โ Iptables everywhere!
27. Service
โ Defines how to to reach your app
โ Internal Service: cluster valid IP + DNS
โ Can use service as Service Discovery (DNS based)
โ Label based selection of targets
30. ConfigMap & Secrets
โ Object containing a K/V storage for configuration purposes
โ Can be โmountedโ:
โ File
โ Environment variable
โ Keep your configuration for the app generic and customize via ConfigMap
โ Secret: like a ConfigMap with hidden fields :-)
31. DaemonSet
โ Run one instance of the pod for each node of the cluster
โ Useful mostly for cluster ops
โ Ideal for โsystem agentsโ