From chroot to Docker to Kubernetes
Alex Glikson aglikson@cs.cmu.edu
April 29th, 2019
* Trivia: in what year was chroot introduced?
CMU Cloud Workshop (Internal), April 29th, 2019 1
Outline
2
Background • Containers
• Cloud-Native Applications
K8s Overview • K8s In a Nutshell
• Architecture
Applications • Unit of Deployment: Pod
• Composite Applications
Ecosystem • K8s Open Source Community
• Commercial Ecosystem, CNCF
CMU Cloud Workshop (Internal), April 29th, 2019
Linux Containers
• Linux features providing isolation within a single OS:
o Hardware resources: cgroups
• CPU, RAM, I/O devices, etc
o OS resources: namespaces, e.g.:
• USER, PID, NET, MNT
• De-facto standard to efficiently run services/jobs at scale
o Enable workload consolidation, infrastructure elasticity
o Pioneered by Google (Linux features, massive internal use*)
• 2 billion containers per week! (>3000 per second on average)
3CMU Cloud Workshop (Internal), April 29th, 2019
Linux Containers – Implementations
• Example (open source) implementations:
o LXC, Cloud Foundry, Mesos, YARN, …
• Docker (Moby*)
o Targeting arbitrary applications, e.g. by offering:
• Flexible packaging
• Seamless inter-container network communication
• Configurable cluster-wide storage/network (SDN, NAS, etc)
o Developer-friendly
• Lightweight standalone engine
• Intuitive git-style image management
• Easy sharing and reuse of images - Docker Hub
4CMU Cloud Workshop (Internal), April 29th, 2019
Linux Containers – Popular Docker Images*
Programming LanguageData ProcessingWeb ServerOperating System
5
CMU Cloud Workshop (Internal), April 29th, 2019
Outline
6
Background  Containers
• Cloud-Native Applications
K8s Overview • K8s In a Nutshell
• Architecture
Applications • Unit of Deployment: Pod
• Composite Applications
Ecosystem • K8s Open Source Community
• Commercial Ecosystem, CNCF
CMU Cloud Workshop (Internal), April 29th, 2019
Cloud-Native Applications: Motivation
• Elasticity and ubiquity of cloud infrastructure enabled new
generation of applications, with a potential to disrupt their
markets, or to create new markets, e.g.:
o Netflix
o Airbnb
o Spotify
o Pinterest
o Snapchat
o Whatsapp
7CMU Cloud Workshop (Internal), April 29th, 2019
Cloud-Native Applications: Example, Requirements
• Example: Netflix
o Value proposition (competitive advantage):
• Low cost video streaming with superb user experience, at scale
o Application properties and unique requirements:
• >100 millions of users in 190 countries (most of them in the US)
– Vast variance in load, within minutes (evenings, campaigns, etc)
• 10s of thousands of servers
– At least one server will fail every day
• 1000s of daily application changes, across 100s of functions
– Video streaming, catalog, recommendations, subscription, etc
– ~1 update every minute
8CMU Cloud Workshop (Internal), April 29th, 2019
Cloud-Native Applications: Requirements  Design Principles
• Low Cost + Variance in Load (+User Experience)
o Can’t afford over- or under-provisioning  Auto-Scaling
• Hardware Failures + High Scale (+User Experience)
o Accommodate HW failures without downtime  Design for Failure
• Frequent Application Updates + High Scale (+User Experience)
o Can’t afford redeploying everything every time  Modularity
o Can’t afford testing everything every time  Stable Internal APIs
• Frequent Application Updates + Low Cost (+User Experience)
o Can’t afford manual QA/admin effort for each update  Automation
9CMU Cloud Workshop (Internal), April 29th, 2019
Cloud–Native Applications: Design  Common Services
Design Principle Common Service
Auto-Scaling
Horizontal Auto-Scaling
Elastic Load Balancing
Design for Failure Replication
Health Monitoring
Modularity
Decoupling into homogenous (micro)services*
Unified packaging (across dev/test/prod) with Docker
API-driven composition
Discovery
Routing
Automation
Fully programmable life cycle of components*
Observability (monitoring, tracing, etc)
10* not a serviceCMU Cloud Workshop (Internal), April 29th, 2019
Cloud–Native Applications: Platforms
• New platforms emerged, offering common services (features)
that make it easier to develop cloud-native applications
o Auto-scaling, replication, load balancing, health monitoring,
service discovery, application-level routing, programmability
o Commonly referred as ‘Platform as a Service’ (PaaS)
11
Google App Engine
Kubernetes
CMU Cloud Workshop (Internal), April 29th, 2019
12
Cloud-
Native
PaaS
+ =
Container-native
Platforms
(e.g., Kubernetes)
Docker
Pre-history
1979: chroot
Job scheduling
1999: VMware
2003: Xen
2004:
UnionFS
2006:
cgroups
2008:
LXC
2013:
Docker
2017:
moby
containerd
2004 2006 2008 2010 2012 2014 2016 2018
2006:
EC2
2012:
YARN
2011:
Mesos
200?:
Borg
2013:
Omega
2002:
ns
2011:
Cloud Foundry
AWS Beanstalk
OpenShift
2008:
GAE
2007:
Heroku 2014:
Kubernetes
2010:
Azure
CMU Cloud Workshop (Internal), April 29th, 2019
Outline
13
Background  Containers
 Cloud-Native Applications
K8s Overview • K8s In a Nutshell
• Architecture
Applications • Unit of Deployment: Pod
• Composite Applications
Ecosystem • K8s Open Source Community
• Commercial Ecosystem, CNCF
CMU Cloud Workshop (Internal), April 29th, 2019
Kubernetes (k8s):
Open-Source, Cloud-Native & Container-Based Platform
Open source platform for
deployment and management of
arbitrary container-based, cloud-native
applications on clusters of servers
14
• Originally developed by Google,
based on Borg and Omega ideas
• Available to all on github.com
• As of 02’2019: ~2000 contributors
• Common Services
• Programmable
• Extensible
Physical or virtual, public or private
cloud (e.g., EC2,OpenStack)
• Specification
• Provisioning
• Monitoring
• Logging
• HA
• Scaling
• Updates
Packaging and runtime
isolation using Docker
• Auto-Scaling
• Design for Failure
• Modularity, APIs
• Automation
CMU Cloud Workshop (Internal), April 29th, 2019
Kubernetes in a Nutshell
15
https://www.youtube.com/embed/4ht22ReBjno?start=0&end=220&autoplay=1
CMU Cloud Workshop (Internal), April 29th, 2019
Kubernetes in a Nutshell
16CMU CS 15719 Advanced Cloud Computing S19February 25, 2019
Kubernetes Architecture
17
Inspired by: https://x-team.com/blog/introduction-kubernetes-architecture/
Master Node
API Server
DB Proxy
ControllersControllersControllers
DB
(etcd)
Scheduler
Worker Node
Docker
…Pod Pod Pod
kubelet
Worker Node
Docker
…Pod Pod Pod
kubelet
kubectl, dashboard, SDKs
CMU Cloud Workshop (Internal), April 29th, 2019
Outline
18
Background  Containers
 Cloud-Native Applications
K8s Overview  K8s In a Nutshell
 Architecture
Applications • Unit of Deployment: Pod
• Composite Applications
Ecosystem • K8s Open Source Community
• Commercial Ecosystem, CNCF
CMU Cloud Workshop (Internal), April 29th, 2019
Pod: One or More Containers + Resources + Labels
Why Multi-Container Pods?
• Scaling/replication unit: runtime
components that must run together
• Sidecar pattern: “secondary” functions
deployed in separate containers
– e.g., web content synchronization
• Ambassador/Proxy pattern: simplify
access to an external system
– e.g., key-value store
• Adapter pattern: simplify access from
an external system
– e.g., monitoring
• Source: https://www.usenix.org/node/196347
19
Source: https://www.slideshare.net/ssuser6bb12d/kubernetes-
introduction-71846110
Containers in a Pod often share (some) namespaces
Labels
app: myApp
Horse +
saddle
CMU Cloud Workshop (Internal), April 29th, 2019
Event-Driven Architecture in k8s: Pod Creation
20
Source: https://blog.heptio.com/core-kubernetes-jazz-improv-over-orchestration-a7903ea92ca
From Pods to Applications: Deployment, Replica Set
• Goal: Maintain a given number of replica’s of a given Pod
o HA, load balancing
• Example: NGiNX web server
21
Pod
template
Containers specification
Resource type
Desired # of replicas
Reference by labels
nginx.yml
Polo
team
Replica Set
properties
CMU Cloud Workshop (Internal), April 29th, 2019
Surfacing Applications to Users: Service
• Goal: Maintain a given number of replica’s of a given Pod
o HA, load balancing
• Example: NGiNX web server
22
Pod
template
Resource type
Port mapping
Reference by labels
“Deployment”
resource
“Service”
resource
Polo
team
CMU Cloud Workshop (Internal), April 29th, 2019
Another Example of Composite Application Type: Job
• Goal: enforce policies for execution and completion of groups
of tasks (batch jobs, scheduled jobs)
23
Relay
race
CMU Cloud Workshop (Internal), April 29th, 2019
Composite Application Types in Kubernetes
• Deployment (Replica Set)
o Maintains a given number of replica’s of a given Pod
• High availability, load balancing
• Daemon Set
o Runs exactly one instance of a given Pod on every node
• Access to unique host resources, load balancing
• Stateful Set
o Maintains a scalable collection of Pods with unique roles
• Persistent resource and identities
• Job
o Enforces policies for execution and completion of groups of tasks (e.g., MPI)
• Controlled parallelism, work queues, schedule-based execution, etc
• Custom
• Your own
24
Polo
team
Life
guard
Goal
keeper
Relay team
CMU Cloud Workshop (Internal), April 29th, 2019
Outline
25
Background  Containers
 Cloud-Native Applications
K8s Overview  K8s In a Nutshell
 Architecture
Applications  Unit of Deployment: Pod
 Composite Applications
Ecosystem • K8s Open Source Community
• Commercial Ecosystem, CNCF
CMU Cloud Workshop (Internal), April 29th, 2019
• One of the most vibrant projects on Github
o 48K stars, 16K forks, 44K PRs, 75K commits, 2000 contributors
https://github.com/kubernetes/kubernetes/pulse/monthly
Kubernetes: Open Source Project and Community
26
9 lines of code
per minute
CMU Cloud Workshop (Internal), April 29th, 2019
Kubernetes: Commercial Ecosystem
• Governed by Cloud Native Computing Foundation (CNCF)
o Industry-wide consensus among leading (and competing) companies
•
• Multiple commercial Kubernetes products and hosted offerings
o On prem (Red Hat, IBM, CoreOS, etc), Public (Google GKE, Amazon EKS,
Azure AKS, etc), Multi-Cloud (Google Anthos, Spotinst Ocean)
27CMU Cloud Workshop (Internal), April 29th, 2019
CNCF Project (https://www.cncf.io/)
28CMU CS 15719 Advanced Cloud Computing S19February 25, 2019
Graduated
CNCF Project (https://www.cncf.io/)
29CMU CS 15719 Advanced Cloud Computing S19February 25, 2019
Incubating
Sandbox
QUESTIONS?
30CMU Cloud Workshop (Internal), April 29th, 2019

From chroot to Docker to Kubernetes

  • 1.
    From chroot toDocker to Kubernetes Alex Glikson aglikson@cs.cmu.edu April 29th, 2019 * Trivia: in what year was chroot introduced? CMU Cloud Workshop (Internal), April 29th, 2019 1
  • 2.
    Outline 2 Background • Containers •Cloud-Native Applications K8s Overview • K8s In a Nutshell • Architecture Applications • Unit of Deployment: Pod • Composite Applications Ecosystem • K8s Open Source Community • Commercial Ecosystem, CNCF CMU Cloud Workshop (Internal), April 29th, 2019
  • 3.
    Linux Containers • Linuxfeatures providing isolation within a single OS: o Hardware resources: cgroups • CPU, RAM, I/O devices, etc o OS resources: namespaces, e.g.: • USER, PID, NET, MNT • De-facto standard to efficiently run services/jobs at scale o Enable workload consolidation, infrastructure elasticity o Pioneered by Google (Linux features, massive internal use*) • 2 billion containers per week! (>3000 per second on average) 3CMU Cloud Workshop (Internal), April 29th, 2019
  • 4.
    Linux Containers –Implementations • Example (open source) implementations: o LXC, Cloud Foundry, Mesos, YARN, … • Docker (Moby*) o Targeting arbitrary applications, e.g. by offering: • Flexible packaging • Seamless inter-container network communication • Configurable cluster-wide storage/network (SDN, NAS, etc) o Developer-friendly • Lightweight standalone engine • Intuitive git-style image management • Easy sharing and reuse of images - Docker Hub 4CMU Cloud Workshop (Internal), April 29th, 2019
  • 5.
    Linux Containers –Popular Docker Images* Programming LanguageData ProcessingWeb ServerOperating System 5 CMU Cloud Workshop (Internal), April 29th, 2019
  • 6.
    Outline 6 Background  Containers •Cloud-Native Applications K8s Overview • K8s In a Nutshell • Architecture Applications • Unit of Deployment: Pod • Composite Applications Ecosystem • K8s Open Source Community • Commercial Ecosystem, CNCF CMU Cloud Workshop (Internal), April 29th, 2019
  • 7.
    Cloud-Native Applications: Motivation •Elasticity and ubiquity of cloud infrastructure enabled new generation of applications, with a potential to disrupt their markets, or to create new markets, e.g.: o Netflix o Airbnb o Spotify o Pinterest o Snapchat o Whatsapp 7CMU Cloud Workshop (Internal), April 29th, 2019
  • 8.
    Cloud-Native Applications: Example,Requirements • Example: Netflix o Value proposition (competitive advantage): • Low cost video streaming with superb user experience, at scale o Application properties and unique requirements: • >100 millions of users in 190 countries (most of them in the US) – Vast variance in load, within minutes (evenings, campaigns, etc) • 10s of thousands of servers – At least one server will fail every day • 1000s of daily application changes, across 100s of functions – Video streaming, catalog, recommendations, subscription, etc – ~1 update every minute 8CMU Cloud Workshop (Internal), April 29th, 2019
  • 9.
    Cloud-Native Applications: Requirements Design Principles • Low Cost + Variance in Load (+User Experience) o Can’t afford over- or under-provisioning  Auto-Scaling • Hardware Failures + High Scale (+User Experience) o Accommodate HW failures without downtime  Design for Failure • Frequent Application Updates + High Scale (+User Experience) o Can’t afford redeploying everything every time  Modularity o Can’t afford testing everything every time  Stable Internal APIs • Frequent Application Updates + Low Cost (+User Experience) o Can’t afford manual QA/admin effort for each update  Automation 9CMU Cloud Workshop (Internal), April 29th, 2019
  • 10.
    Cloud–Native Applications: Design Common Services Design Principle Common Service Auto-Scaling Horizontal Auto-Scaling Elastic Load Balancing Design for Failure Replication Health Monitoring Modularity Decoupling into homogenous (micro)services* Unified packaging (across dev/test/prod) with Docker API-driven composition Discovery Routing Automation Fully programmable life cycle of components* Observability (monitoring, tracing, etc) 10* not a serviceCMU Cloud Workshop (Internal), April 29th, 2019
  • 11.
    Cloud–Native Applications: Platforms •New platforms emerged, offering common services (features) that make it easier to develop cloud-native applications o Auto-scaling, replication, load balancing, health monitoring, service discovery, application-level routing, programmability o Commonly referred as ‘Platform as a Service’ (PaaS) 11 Google App Engine Kubernetes CMU Cloud Workshop (Internal), April 29th, 2019
  • 12.
    12 Cloud- Native PaaS + = Container-native Platforms (e.g., Kubernetes) Docker Pre-history 1979:chroot Job scheduling 1999: VMware 2003: Xen 2004: UnionFS 2006: cgroups 2008: LXC 2013: Docker 2017: moby containerd 2004 2006 2008 2010 2012 2014 2016 2018 2006: EC2 2012: YARN 2011: Mesos 200?: Borg 2013: Omega 2002: ns 2011: Cloud Foundry AWS Beanstalk OpenShift 2008: GAE 2007: Heroku 2014: Kubernetes 2010: Azure CMU Cloud Workshop (Internal), April 29th, 2019
  • 13.
    Outline 13 Background  Containers Cloud-Native Applications K8s Overview • K8s In a Nutshell • Architecture Applications • Unit of Deployment: Pod • Composite Applications Ecosystem • K8s Open Source Community • Commercial Ecosystem, CNCF CMU Cloud Workshop (Internal), April 29th, 2019
  • 14.
    Kubernetes (k8s): Open-Source, Cloud-Native& Container-Based Platform Open source platform for deployment and management of arbitrary container-based, cloud-native applications on clusters of servers 14 • Originally developed by Google, based on Borg and Omega ideas • Available to all on github.com • As of 02’2019: ~2000 contributors • Common Services • Programmable • Extensible Physical or virtual, public or private cloud (e.g., EC2,OpenStack) • Specification • Provisioning • Monitoring • Logging • HA • Scaling • Updates Packaging and runtime isolation using Docker • Auto-Scaling • Design for Failure • Modularity, APIs • Automation CMU Cloud Workshop (Internal), April 29th, 2019
  • 15.
    Kubernetes in aNutshell 15 https://www.youtube.com/embed/4ht22ReBjno?start=0&end=220&autoplay=1 CMU Cloud Workshop (Internal), April 29th, 2019
  • 16.
    Kubernetes in aNutshell 16CMU CS 15719 Advanced Cloud Computing S19February 25, 2019
  • 17.
    Kubernetes Architecture 17 Inspired by:https://x-team.com/blog/introduction-kubernetes-architecture/ Master Node API Server DB Proxy ControllersControllersControllers DB (etcd) Scheduler Worker Node Docker …Pod Pod Pod kubelet Worker Node Docker …Pod Pod Pod kubelet kubectl, dashboard, SDKs CMU Cloud Workshop (Internal), April 29th, 2019
  • 18.
    Outline 18 Background  Containers Cloud-Native Applications K8s Overview  K8s In a Nutshell  Architecture Applications • Unit of Deployment: Pod • Composite Applications Ecosystem • K8s Open Source Community • Commercial Ecosystem, CNCF CMU Cloud Workshop (Internal), April 29th, 2019
  • 19.
    Pod: One orMore Containers + Resources + Labels Why Multi-Container Pods? • Scaling/replication unit: runtime components that must run together • Sidecar pattern: “secondary” functions deployed in separate containers – e.g., web content synchronization • Ambassador/Proxy pattern: simplify access to an external system – e.g., key-value store • Adapter pattern: simplify access from an external system – e.g., monitoring • Source: https://www.usenix.org/node/196347 19 Source: https://www.slideshare.net/ssuser6bb12d/kubernetes- introduction-71846110 Containers in a Pod often share (some) namespaces Labels app: myApp Horse + saddle CMU Cloud Workshop (Internal), April 29th, 2019
  • 20.
    Event-Driven Architecture ink8s: Pod Creation 20 Source: https://blog.heptio.com/core-kubernetes-jazz-improv-over-orchestration-a7903ea92ca
  • 21.
    From Pods toApplications: Deployment, Replica Set • Goal: Maintain a given number of replica’s of a given Pod o HA, load balancing • Example: NGiNX web server 21 Pod template Containers specification Resource type Desired # of replicas Reference by labels nginx.yml Polo team Replica Set properties CMU Cloud Workshop (Internal), April 29th, 2019
  • 22.
    Surfacing Applications toUsers: Service • Goal: Maintain a given number of replica’s of a given Pod o HA, load balancing • Example: NGiNX web server 22 Pod template Resource type Port mapping Reference by labels “Deployment” resource “Service” resource Polo team CMU Cloud Workshop (Internal), April 29th, 2019
  • 23.
    Another Example ofComposite Application Type: Job • Goal: enforce policies for execution and completion of groups of tasks (batch jobs, scheduled jobs) 23 Relay race CMU Cloud Workshop (Internal), April 29th, 2019
  • 24.
    Composite Application Typesin Kubernetes • Deployment (Replica Set) o Maintains a given number of replica’s of a given Pod • High availability, load balancing • Daemon Set o Runs exactly one instance of a given Pod on every node • Access to unique host resources, load balancing • Stateful Set o Maintains a scalable collection of Pods with unique roles • Persistent resource and identities • Job o Enforces policies for execution and completion of groups of tasks (e.g., MPI) • Controlled parallelism, work queues, schedule-based execution, etc • Custom • Your own 24 Polo team Life guard Goal keeper Relay team CMU Cloud Workshop (Internal), April 29th, 2019
  • 25.
    Outline 25 Background  Containers Cloud-Native Applications K8s Overview  K8s In a Nutshell  Architecture Applications  Unit of Deployment: Pod  Composite Applications Ecosystem • K8s Open Source Community • Commercial Ecosystem, CNCF CMU Cloud Workshop (Internal), April 29th, 2019
  • 26.
    • One ofthe most vibrant projects on Github o 48K stars, 16K forks, 44K PRs, 75K commits, 2000 contributors https://github.com/kubernetes/kubernetes/pulse/monthly Kubernetes: Open Source Project and Community 26 9 lines of code per minute CMU Cloud Workshop (Internal), April 29th, 2019
  • 27.
    Kubernetes: Commercial Ecosystem •Governed by Cloud Native Computing Foundation (CNCF) o Industry-wide consensus among leading (and competing) companies • • Multiple commercial Kubernetes products and hosted offerings o On prem (Red Hat, IBM, CoreOS, etc), Public (Google GKE, Amazon EKS, Azure AKS, etc), Multi-Cloud (Google Anthos, Spotinst Ocean) 27CMU Cloud Workshop (Internal), April 29th, 2019
  • 28.
    CNCF Project (https://www.cncf.io/) 28CMUCS 15719 Advanced Cloud Computing S19February 25, 2019 Graduated
  • 29.
    CNCF Project (https://www.cncf.io/) 29CMUCS 15719 Advanced Cloud Computing S19February 25, 2019 Incubating Sandbox
  • 30.
    QUESTIONS? 30CMU Cloud Workshop(Internal), April 29th, 2019

Editor's Notes

  • #6 Alpine Linux, Apache, Redis, Busybox, Ubuntu, Mongo, Golang, Elasticsearch, Wordpress, Python, Logstash
  • #17 Fibi
  • #20 Horse with saddle
  • #22 Polo team
  • #24 Relay race
  • #25 Polo team, Logstash, Life guards, goal keeper, relay race team