A gentle introduction
to containers and
Kubernetes
Nills Franssens - @nillsf
Goals for this session:
About Nills
https://blog.nillsf.com
From traditional app to modern app
Existing
Application
APP
Modern
Microservices
Add new services
or start peeling off
services from
monolithic code.
Modern
Methodologies
Implement CI/CD
and automation.
Modern
Infrastructure
Move to the
cloud as VMs
or Containers
or refresh HW.
Containerize
Applications
Re-architect
apps for scale
with containers.
What is a container?
Static
website
Web frontend
User DB
Queue Analytics DB
Background workers
API endpoint
nginx 1.5 + modsecurity + openssl + bootstrap 2
postgresql + pgv8 + v8
hadoop + hive + thrift + OpenJDK
Ruby + Rails + sass + Unicorn
Redis + redis-sentinel
Python 3.0 + celery + pyredis + libcurl + ffmpeg + libopencv + nodejs +
phantomjs
Python 2.7 + Flask + pyredis + celery + psycopg + postgresql-client
Development
VM
QA server
Public Cloud
Disaster recovery
Contributor’s laptop
Production Servers
The Problem in 2020: Distributed ApplicationsMultiplicityof
Stacks
Multiplicityof
hardware
environments
Production Cluster
Customer Data Center
Doservicesand
appsinteract
appropriately?
CanImigrate
smoothlyand
quickly?
The Matrix From Hell
Static website
Web frontend
Background workers
User DB
Analytics DB
Queue
Development
VM
QA Server
Single Prod
Server
Onsite Cluster Public Cloud
Contributor’s
laptop
Customer
Servers
? ? ? ? ? ? ?
? ? ? ? ? ? ?
? ? ? ? ? ? ?
? ? ? ? ? ? ?
? ? ? ? ? ? ?
? ? ? ? ? ? ?
Multiplicityof
Goods
Multiplicityof
methodsfor
transporting/storing
DoIworryabout
howgoodsinteract
(e.g.coffeebeans
nexttospices)
CanItransport
quicklyand
smoothly
(e.g.fromboatto
traintotruck)
Solution: Intermodal Shipping Container
Ecosystem
…in between, can be loaded and
unloaded, stacked, transported
efficiently over long distances,
and transferred from one mode
of transport to another
A standard container that is
loaded with virtually any
goods, and stays sealed until
it reaches final delivery.
Static
website Web frontendUser DB Queue Analytics DB
Development VM
QA server Public Cloud
Contributor’s laptop
Let’s create an ecosystem for distributed applications
Multiplicityof
Stacks
Multiplicityof
hardware
environments
Production ClusterCustomer Data Center
Doservicesand
appsinteract
appropriately?
CanImigrate
smoothlyand
quickly
…that can be manipulated using
standard operations and run
consistently on virtually any
hardware platform
An engine that enables any
payload to be encapsulated
as a lightweight, portable,
self-sufficient container…
Static website
Web frontend
Background workers
User DB
Analytics DB
Queue
Development
VM
QA Server
Single Prod
Server
Onsite Cluster Public Cloud
Contributor’s
laptop
Customer
Servers
And eliminate the matrix from Hell
FROM alpine:3.12.0
LABEL maintainer="nills.franssens@microsoft.com"
RUN apk --no-cache add curl jq openssl
RUN curl https://storage.googleapis.com/hey-release/hey_linux_amd64 -o
hey
RUN chmod +x hey
COPY send_event.sh send_event.sh
RUN chmod +x send_event.sh
ENTRYPOINT sh send_event.sh
0 B
1.895 KB
176.7 KB
192.50 KB
192.5 KB
167.2 MB
Web App
Demo
Building a Docker container
Developing Kubernetes Applications
The elements of orchestration
Scheduling Affinity/anti-
affinity
Health
monitoring
Failover
Scaling Networking Service
discovery
Coordinated
app upgrades
How Kubernetes works internally
1. Kubernetes users communicate
with API server and apply
desired state
2. Master nodes actively enforce
desired state on worker nodes
3. Worker nodes support
communication between
containers
4. Worker nodes support
communication from the
Internet
Kubernetes
control
API server
replication, namespace,
serviceaccounts, etc.
-controller-
manager -scheduler
etcd
Master node
Worker node
kubelet kube-proxy
Docker
Pod Pod
Containers Containers
Worker node
kubelet kube-proxy
Docker
Pod Pod
Containers Containers
Internet
Internet
How Kubernetes works
Source: Kubernetes in Action book by Marko Lukša
Manage and
operate Kubernetes
with ease
Build on an
enterprise-grade,
secure platform
Accelerate
containerized app
development
Run any
workload
anywhere
Kubernetes on Azure
Portable Extensible Self-healing
Simplify the deployment, management, and operations of Kubernetes
Manage Kubernetes with ease
API server
Controller
ManagerScheduler
etcd
Store
Cloud
Controller
Self-managed master node(s)
Customer VMs
App/
workload
definitionUser
Docker
Pods
Docker
Pods
Docker
Pods
Docker
Pods
Docker
Pods
Schedule pods over
private tunnel
Kubernetes
API endpoint
Azure managed control plane
Focus on your containers and code, not the plumbing of them
Responsibilities
DIY with
Kubernetes
Managed
Kubernetes
on Azure
Containerization
Application iteration,
debugging
CI/CD
Provisioning, upgrades,
patches
Reliability availability
Scaling
Monitoring and logging
Customer Microsoft
Task The Old Way With Azure
Create a cluster Provision network and VMs
Install dozens of system components including etcd
Create and install certificates
Register agent nodes with control plane
az aks create
Upgrade a cluster Upgrade your master nodes
Cordon/drain and upgrade worker nodes individually
az aks upgrade
Scale a cluster Provision new VMs
Install system components
Register nodes with API server
az aks scale
Azure makes Kubernetes easier
Manage and operate Kubernetes with ease
Demo
Running containers at scale
in Kubernetes
Build/CI,
Integrate,
Test
3.
1.
Outer-Loop
Push
code
Production
environments
Run, Manage
5.
Code
Run
Validate
Debug
Inner-Loop
CD, Deploy
4.
Source Code
Control
(SCC)
2.
6.
Azure
Container
Registry
Azure
Monitoring
https://aka.ms/handson-aks-book
https://aka.ms/IntrotoKubernetes-7
Gentle introduction to containers and kubernetes

Gentle introduction to containers and kubernetes

  • 1.
    A gentle introduction tocontainers and Kubernetes Nills Franssens - @nillsf
  • 2.
  • 3.
  • 4.
    From traditional appto modern app Existing Application APP Modern Microservices Add new services or start peeling off services from monolithic code. Modern Methodologies Implement CI/CD and automation. Modern Infrastructure Move to the cloud as VMs or Containers or refresh HW. Containerize Applications Re-architect apps for scale with containers.
  • 5.
    What is acontainer?
  • 6.
    Static website Web frontend User DB QueueAnalytics DB Background workers API endpoint nginx 1.5 + modsecurity + openssl + bootstrap 2 postgresql + pgv8 + v8 hadoop + hive + thrift + OpenJDK Ruby + Rails + sass + Unicorn Redis + redis-sentinel Python 3.0 + celery + pyredis + libcurl + ffmpeg + libopencv + nodejs + phantomjs Python 2.7 + Flask + pyredis + celery + psycopg + postgresql-client Development VM QA server Public Cloud Disaster recovery Contributor’s laptop Production Servers The Problem in 2020: Distributed ApplicationsMultiplicityof Stacks Multiplicityof hardware environments Production Cluster Customer Data Center Doservicesand appsinteract appropriately? CanImigrate smoothlyand quickly?
  • 7.
    The Matrix FromHell Static website Web frontend Background workers User DB Analytics DB Queue Development VM QA Server Single Prod Server Onsite Cluster Public Cloud Contributor’s laptop Customer Servers ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
  • 8.
    Multiplicityof Goods Multiplicityof methodsfor transporting/storing DoIworryabout howgoodsinteract (e.g.coffeebeans nexttospices) CanItransport quicklyand smoothly (e.g.fromboatto traintotruck) Solution: Intermodal ShippingContainer Ecosystem …in between, can be loaded and unloaded, stacked, transported efficiently over long distances, and transferred from one mode of transport to another A standard container that is loaded with virtually any goods, and stays sealed until it reaches final delivery.
  • 9.
    Static website Web frontendUserDB Queue Analytics DB Development VM QA server Public Cloud Contributor’s laptop Let’s create an ecosystem for distributed applications Multiplicityof Stacks Multiplicityof hardware environments Production ClusterCustomer Data Center Doservicesand appsinteract appropriately? CanImigrate smoothlyand quickly …that can be manipulated using standard operations and run consistently on virtually any hardware platform An engine that enables any payload to be encapsulated as a lightweight, portable, self-sufficient container…
  • 10.
    Static website Web frontend Backgroundworkers User DB Analytics DB Queue Development VM QA Server Single Prod Server Onsite Cluster Public Cloud Contributor’s laptop Customer Servers And eliminate the matrix from Hell
  • 12.
    FROM alpine:3.12.0 LABEL maintainer="nills.franssens@microsoft.com" RUNapk --no-cache add curl jq openssl RUN curl https://storage.googleapis.com/hey-release/hey_linux_amd64 -o hey RUN chmod +x hey COPY send_event.sh send_event.sh RUN chmod +x send_event.sh ENTRYPOINT sh send_event.sh 0 B 1.895 KB 176.7 KB 192.50 KB 192.5 KB 167.2 MB Web App
  • 14.
  • 15.
  • 20.
    The elements oforchestration Scheduling Affinity/anti- affinity Health monitoring Failover Scaling Networking Service discovery Coordinated app upgrades
  • 21.
    How Kubernetes worksinternally 1. Kubernetes users communicate with API server and apply desired state 2. Master nodes actively enforce desired state on worker nodes 3. Worker nodes support communication between containers 4. Worker nodes support communication from the Internet Kubernetes control API server replication, namespace, serviceaccounts, etc. -controller- manager -scheduler etcd Master node Worker node kubelet kube-proxy Docker Pod Pod Containers Containers Worker node kubelet kube-proxy Docker Pod Pod Containers Containers Internet Internet
  • 22.
    How Kubernetes works Source:Kubernetes in Action book by Marko Lukša
  • 23.
    Manage and operate Kubernetes withease Build on an enterprise-grade, secure platform Accelerate containerized app development Run any workload anywhere Kubernetes on Azure Portable Extensible Self-healing Simplify the deployment, management, and operations of Kubernetes
  • 24.
    Manage Kubernetes withease API server Controller ManagerScheduler etcd Store Cloud Controller Self-managed master node(s) Customer VMs App/ workload definitionUser Docker Pods Docker Pods Docker Pods Docker Pods Docker Pods Schedule pods over private tunnel Kubernetes API endpoint Azure managed control plane Focus on your containers and code, not the plumbing of them Responsibilities DIY with Kubernetes Managed Kubernetes on Azure Containerization Application iteration, debugging CI/CD Provisioning, upgrades, patches Reliability availability Scaling Monitoring and logging Customer Microsoft
  • 25.
    Task The OldWay With Azure Create a cluster Provision network and VMs Install dozens of system components including etcd Create and install certificates Register agent nodes with control plane az aks create Upgrade a cluster Upgrade your master nodes Cordon/drain and upgrade worker nodes individually az aks upgrade Scale a cluster Provision new VMs Install system components Register nodes with API server az aks scale Azure makes Kubernetes easier Manage and operate Kubernetes with ease
  • 26.
    Demo Running containers atscale in Kubernetes
  • 27.
  • 28.