SlideShare ist ein Scribd-Unternehmen logo
1 von 58
Downloaden Sie, um offline zu lesen
Three Years Of Running Containers on
Kubernetes in Production
June 13, 2018
OSDC Berlin
thomas@endocode.com
HI!
Thomas Fricke
thomas@endocode.com
CTO Endocode
● System Automation
● DevOps
● Cloud, Database and Software
Architect
● K8S since September 2015
ENDOCODE
● high-quality software solutions
● best software engineering practices: test driven
● well known open source projects: https://github.com/endocode
● diverse range of technologies
● decades of experience
○ software development,
○ team management
○ 100000s of server years in public and private clouds
● Be it web, mobile, server or desktop we use:
open source to meet any challenge
AGENDA
○ The Basics: Containers
○ Kubernetes
■ Pods
■ Networks
■ Services
○ Case Studies
■ Telephony: immmr
■ On Premises: ERP Customer
■ Machine Learning
*AAS Pyramide
Functions
App Engine
Containers
Virtual Machines
Google Infrastructure
Event driven functions
Web apps & APIs
GKE
Infrastructure
http://www.commitstrip.com/en/2016/06/24/how-to-host-a-coder-dinner-party/
CONTAINERS OR VIRTUALIZATION
Topic Container Virtualization
Isolation OS Level,
OS namespaces
CPU Level:
Ring 0/Ring 3
foreign CPU no yes, with emulation
foreign kernels, OS no yes kernel is
common
emulated devices no yes security
host devices direct virtio driver security
CPU performance 100% 95%
IO performance 100% <<100%
root isolation yes yes USER
directive
CPU cache attacks easy possible PoC ?
CAN WE MIX CONTAINERS AND HYPERVISORS?
● gVisor
● Intel Clear Container
● kvm in containers
● Docker on non Linux OS
● Mac OS: xhyve
● Windows: Hyper-V
LINUX NAMESPACES
Namespace Constant Isolates
Cgroup CLONE_NEWCGROUP Cgroup root directory
IPC CLONE_NEWIPC System V IPC, POSIX message queues
Network CLONE_NEWNET Network devices, stacks, ports, etc.
Mount CLONE_NEWNS Mount points
PID CLONE_NEWPID Process IDs
User CLONE_NEWUSER User and group IDs
UTS CLONE_NEWUTS Hostname and NIS domain name
CONTROL GROUPS
● cpuset
● cpu
● cpuacct
● memory
● devices
● freezer
● net_cls
● ns
● blkio
these are directories with fine grained sub folders
KERNEL CAPABILITIES
CAP_AUDIT_CONTROL, CAP_AUDIT_READ, CAP_AUDIT_WRITE, CAP_BLOCK_SUSPEND,
CAP_CHOWN,CAP_DAC_OVERRIDE, CAP_DAC_READ_SEARCH, CAP_FOWNER, CAP_FSETID,
CAP_IPC_LOCK, CAP_IPC_OWNER, CAP_KILL, CAP_LEASE, CAP_LINUX_IMMUTABLE,
CAP_MAC_ADMIN,CAP_MAC_OVERRIDE, CAP_MKNOD, CAP_NET_ADMIN,
CAP_NET_BIND_SERVICE, CAP_NET_BROADCAST, CAP_NET_RAW, CAP_SETGID,
CAP_SETFCAP, CAP_SETPCAP, CAP_SETUID, CAP_SYS_ADMIN, CAP_SYS_BOOT,
CAP_SYS_CHROOT, CAP_SYS_MODULE, CAP_SYS_NICE, CAP_SYS_PACCT,
CAP_SYS_PTRACE, CAP_SYS_RAWIO, CAP_SYS_RESOURCE, CAP_SYS_TIME,
CAP_SYS_TTY_CONFIG, CAP_SYSLOG, CAP_WAKE_ALARM, CAP_INIT_EFF_SET
These are a lot! Use profiles to group them together!
man capabilities
Greek for “Helmsman”; also the root of the
words “governor” and “cybernetic”
● Runs and manages containers
● Inspired and informed by Google’s
experiences and internal systems
● Supports multiple cloud and bare-metal
environments
● Supports multiple container runtimes
● 100% Open source, written in Go
Manage applications, not machines
Kubernetes
kubelet
UI
kubeletCLI
API
users master nodes
The 10000 foot view
etcd
kubelet
scheduler
controllers
apiserver
UI
All you really care about
API
Container
Cluster
KUBERNETES PODS
● Core Concept the Kubernetes Microservice
● Bunch of Containers with the same
○ Lifecycle: live together, die together
○ Network: same ip address,
same 127.0.0.0/8
○ Volumes: can share data
○ One common task
○ Init Tasks
○ Live and Readiness Checks
apiVersion: v1
kind: Pod
metadata:
name: nginx
labels:
env: test
spec:
containers:
- name: nginx
image: nginx
PODS SHOULD NEVER BE DEPLOYED ALONE
● deployments
○ replicasets
■ pods
● containers
● Jobs: pods that terminate
● Replicationcontrollers, Replicasets,
(don’t use directly)
● Daemonset: one per node
● StatefulSets (aka PetSets): predictable names
○ volumes
○ database clusters
apiVersion: apps/v1 #since 1.9
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80
Deployment
Replicaset
v1.7.9 v1.7.9 v1.7.9
Replicaset
v1.14.0 v1.14.0 v1.14.0
POD in K8S
Pod Centric View
from Roland Huss
https://github.com/ro14nd-talks/kubernetes-patterns
The Network
Flannel
● Flannel
○ simplest version
○ IP over IP
● Calico
○ dam’n complicated
○ much more
sophisticated
● Network Policies
○ Security
○ Partitioning a cluster
TYPICAL APPLICATIONS
- Programming languages and their runtimes
- Various databases from various generations
- SQL
- NoSQL
- Local and sessions storage
- Message queueing
KUBERNETES SERVICES
● Connecting Pods to the
outside world
● identified by the selector
○ key value pair
○ app name
● ports
○ pod
○ node
○ loadbalancer
needs external support
kind: Service
apiVersion: v1
metadata:
name: nginx-service
spec:
selector:
app: nginx
type: Loadbalancer
ports:
- protocol: TCP
port: 80
targetPort: 80
● strictly tiered
architecture
○ separation of
stateless
○ and persistent data
● inside the pods
○ developers are free
to use what they
want
○ contract is binding
to the outside
Network
stateless
Frontend
stateless
WebportalWebportal
Webportal
Frontend
Cache
stateless
Backend
Services
stateless
WebportalWebportalWeb Main
App
WebportalWebportal
Notification
WebportalWebportal
User Profile
Persistent
services
stateful
Networking Endpoints
Dataflow
Bigquery
Storage
Datastore
SQL
Pub Sub
MINDSET CHANGE
Ancient Times
● System Engineering
● Hardware Centric
● Virtual Machine
https://12factor.net/
Today
● DevOps
● Application Management
● Managed Service
● Pods
FROM VMs TO PODS
OS instances microservices in Pods
FROM VMs TO PODS
VM cluster Pods running on Kubernetes
- cattle: stateless containers
- pets:
- databases
- use managed services
FROM VMs TO PODS
configuration management separation of build time
and run time
BUSINESS VALUE
- faster deployments:
- faster time to market
- more and faster testing
- more teams possible
- faster deployment
- better quality
- less maintenance in operations
- less load
- simpler deployments
SUMMARY
Separation of build-time and run-time (12factor.net commandmend V)
- PODs should require only minimal parametrization for being deployed
- Secrets
- Config Maps
- Environment variables
- No Config Management necessary
CONTAINER LIFECYCLE MANAGEMENT
Part 1: Build-time related
- Audits, scanning of container content in the registry
- Management of ephemeral configuration
(as in regular scheduled updates of keys, …)
- Stop-gap: rebuild container often, deploy new versions
- Leaner containers
- immutable containers
- incredibly shrinking deployments
CONTAINER LIFECYCLE MANAGEMENT
Part 2: Runtime related
- Monitoring of pods, containers and apps/processes
- Lifecycle management
- Cleanup of nodes (minions) after POD end-of-live
- Issue with multi-tenant readiness
- Clean-up, … - issue of isolation beyond individual process (in container)
CASE STUDY: IMMMR
immmr - one number for every need
immmr combines the best
of Internet base
communication with the
advantages of mobile
communication
immmr makes it possible
to use a single mobile
number from any device
http://www.immmr.com/
CHALLENGES
● G10 Compliance
● Every connection must be encrypted
● Vault for Key Management
FROM THE TRENCHES
- Easy:
- Java with SpringBoot
- Python
- Hard:
- Ruby Gems
- Separation
- build
- deployment
- no compiler in production
- change to a static Ruby binary traveling ruby
- adapt to database supported by your cloud provider
- ruby version hell: rvm
FROM THE TRENCHES
- Lessons learned preparing for a security audit:
- this needed to be done anyway
- separation of stateless and persistent services is
a good idea anyway and with containers really important
- Dockerfiles need careful design to be fast
- private registry for images recommended (same region)
- quay.io
- container life cycle monitoring
- CVE database
RESULTS AND EXPERIENCES
- Scalable, kubified application
- Service architecture as it always should have been :-)
- Reduced technical debt and implicit knowledge
- Standardised processes and APIs for services management
- Previously, practises varied between projects
- Pod as deployment unit, single process per container
- Pods are containers sharint the same fate
- Service as load-balanced entry point
- external service
- no LB cluster hassle
- smaller deployments
RESILIENCE
High Availibility works
- CoreOS automatic cluster update at immmr
- no outage
- cluster continued to work
- monitoring showed all services available
BUSINESS VALUE
- faster deployments:
- faster time to market
- more and faster testing
- more teams possible
- faster deployment
- better quality
- less maintenance in operations
- less load
- simpler deployments
- higher availibility
RESULTS AND EXPERIENCES
Separation of build-time and run-time
- PODs: minimal parametrization
- config maps
- Secrets
- Environment variables
- Configuration management inside the container
- build-time issue
- It should not be deployed with the container
CASE STUDY: ON PREMISES
ERP COMPANY
CHALLENGES
● 1TB machines
● 80 cores
● 80 GB Containers
● Windows in KVM Containers
● Docker socket is a bottle neck
WAIT, WAIT, WAIT: DID HE SAY WINDOWS IN K8S?
CASE STUDY: MACHINE
LEARNING ON PREMISES
kubectl create
-f ml-job.yaml
call
all necessary libraries
config map
apiVersion: v1
kind: Pod
metadata:
name: machine-learning-job
spec:
containers:
- name: machine-learning-job
image: machine-learning
command:
["python","/opt/ml/ml.py" ]
...
tf.device('/cpu:0')
tf.device('/cpu:9')
tf.device('/cpu:1')
TENSORFLOW IN KUBERNETES
all necessary librariesapiVersion: v1
kind: Pod
metadata:
name: machine-learning-notebook
spec:
containers:
- name: ml-notebook
image: ml-notebook
command: [“ start-notebook.sh”]
...
Interactive Version
● Jupyter notebook
as Web Frontend
Kubernetes service
● persistent storage
for the model
datasets
JUPYTER NOTEBOOKS
1. Kernel Module creation:
a. time consuming
b. extremely version sensitive
c. needed only once / version
i. distributed in an image (preferred for production)
ii. or in an highly priviledged container (dev and test only)
2. Library Images
a. need development packages
b. can be very time consuming
c. large, should be optimized for large scale rollout
d. might need GPU optimization tweaks
3. Once the images are created, starting a job is a task of minutes
4. ML handles large datasets
5. Interactive Services necessary
6. GPUs don’t have load balancing, but maybe we need a time limit
7. Container image creation itself could be delegated to priviledged containers using the wormhole pattern
8. Distributed Workloads
CHALLENGES
wormhole
pattern
docker in
docker
or with
builda
apiVersion: v1
kind: Pod
metadata:
name: debian-jessie-wormhole
spec:
containers:
- image: debian:jessie
command:
- docker
- build
- /library
name: debian-jessie-wormhole
volumeMounts:
- mountPath: /var/run/docker.sock
name: docker-socket
- mountPath: /bin/docker
name: docker-binary
...
bokeh
coverage
decorator
discover
docopt
jinja2
matplotlib
mysql-connector-python
nose
numpy
pyftpdlib
scipy
SQLAlchemy
sqlacodegen
xmltodict
zipline
requirements.txt
config map
build container
build
library image
BUILD WORKFLOW
TF Worker NodesTF Parameter ServerTF Client
tensorflow::Session
worker_service.proto
https://www.tensorflow.org/deploy/distributed
https://github.com/dask/dask
DISTRIBUTED TENSORFLOW
CASE STUDY: BIG NETWORK
BIG PRICE COMPARISON SITE
Compute Node
Kubernetes Layer
Calico
CNI
Plugin
KernelIP TablesIP Routes
RR Route
Reflector
BIRD
BGP
Felix
RR Route
ReflectorRR Route
Reflector
eth0 eth1
Physical fabric (L2, L3, MPLS)
Pods
Pods
Pods
Pods
Pods
Pods
Pods
Pods
Pods
Pods
CALICO Network
QUESTIONS?
Watch our Webinar ‘Dive into Kubernetes’ on our YouTube Channel
https://youtu.be/8694GGJlpZ8
Register for a free Google Cloud Platform Trial with $300 Google Cloud
Platform Credits
https://goo.gl/dUzDWi
Use another $200 partner credits
https://goo.gl/eYldnT
OSDC 2018 | Three years running containers with Kubernetes in Production by Thomas Fricke

Weitere ähnliche Inhalte

Was ist angesagt?

Kubernetes One-Click Deployment: Hands-on Workshop (Munich)
Kubernetes One-Click Deployment: Hands-on Workshop (Munich)Kubernetes One-Click Deployment: Hands-on Workshop (Munich)
Kubernetes One-Click Deployment: Hands-on Workshop (Munich)
QAware GmbH
 

Was ist angesagt? (20)

K8S in prod
K8S in prodK8S in prod
K8S in prod
 
Docker for HPC in a Nutshell
Docker for HPC in a NutshellDocker for HPC in a Nutshell
Docker for HPC in a Nutshell
 
HPC in a Box - Docker Workshop at ISC 2015
HPC in a Box - Docker Workshop at ISC 2015HPC in a Box - Docker Workshop at ISC 2015
HPC in a Box - Docker Workshop at ISC 2015
 
Running and Managing Kubernetes on OpenStack
Running and Managing Kubernetes on OpenStackRunning and Managing Kubernetes on OpenStack
Running and Managing Kubernetes on OpenStack
 
A Million ways of Deploying a Kubernetes Cluster
A Million ways of Deploying a Kubernetes ClusterA Million ways of Deploying a Kubernetes Cluster
A Million ways of Deploying a Kubernetes Cluster
 
How to Prepare for CKA Exam
How to Prepare for CKA ExamHow to Prepare for CKA Exam
How to Prepare for CKA Exam
 
Kubernetes One-Click Deployment: Hands-on Workshop (Munich)
Kubernetes One-Click Deployment: Hands-on Workshop (Munich)Kubernetes One-Click Deployment: Hands-on Workshop (Munich)
Kubernetes One-Click Deployment: Hands-on Workshop (Munich)
 
Best practices in Deploying SUSE CaaS Platform v3
Best practices in Deploying SUSE CaaS Platform v3Best practices in Deploying SUSE CaaS Platform v3
Best practices in Deploying SUSE CaaS Platform v3
 
OSDC 2018 | Hardware-level data-center monitoring with Prometheus by Conrad H...
OSDC 2018 | Hardware-level data-center monitoring with Prometheus by Conrad H...OSDC 2018 | Hardware-level data-center monitoring with Prometheus by Conrad H...
OSDC 2018 | Hardware-level data-center monitoring with Prometheus by Conrad H...
 
使用 Prometheus 監控 Kubernetes Cluster
使用 Prometheus 監控 Kubernetes Cluster 使用 Prometheus 監控 Kubernetes Cluster
使用 Prometheus 監控 Kubernetes Cluster
 
KubeCon EU 2016: Heroku to Kubernetes
KubeCon EU 2016: Heroku to KubernetesKubeCon EU 2016: Heroku to Kubernetes
KubeCon EU 2016: Heroku to Kubernetes
 
Setup Hybrid Clusters Using Kubernetes Federation
Setup Hybrid Clusters Using Kubernetes FederationSetup Hybrid Clusters Using Kubernetes Federation
Setup Hybrid Clusters Using Kubernetes Federation
 
5 - Hands-on Kubernetes Workshop:
5 - Hands-on Kubernetes Workshop:5 - Hands-on Kubernetes Workshop:
5 - Hands-on Kubernetes Workshop:
 
Web後端技術的演變
Web後端技術的演變Web後端技術的演變
Web後端技術的演變
 
Containers and HPC
Containers and HPCContainers and HPC
Containers and HPC
 
SUSE CaaSP: deploy OpenFaaS and Ethereum Blockchain on Kubernetes
SUSE CaaSP: deploy OpenFaaS and Ethereum Blockchain on KubernetesSUSE CaaSP: deploy OpenFaaS and Ethereum Blockchain on Kubernetes
SUSE CaaSP: deploy OpenFaaS and Ethereum Blockchain on Kubernetes
 
Sf bay area Kubernetes meetup dec8 2016 - deployment models
Sf bay area Kubernetes meetup dec8 2016 - deployment modelsSf bay area Kubernetes meetup dec8 2016 - deployment models
Sf bay area Kubernetes meetup dec8 2016 - deployment models
 
Linuxcon secureefficientcontainerimagemanagementharbor
Linuxcon secureefficientcontainerimagemanagementharborLinuxcon secureefficientcontainerimagemanagementharbor
Linuxcon secureefficientcontainerimagemanagementharbor
 
Real-Time Data Processing Pipeline & Visualization with Docker, Spark, Kafka ...
Real-Time Data Processing Pipeline & Visualization with Docker, Spark, Kafka ...Real-Time Data Processing Pipeline & Visualization with Docker, Spark, Kafka ...
Real-Time Data Processing Pipeline & Visualization with Docker, Spark, Kafka ...
 
OSDC 2018 | Highly Available Cloud Foundry on Kubernetes by Cornelius Schumacher
OSDC 2018 | Highly Available Cloud Foundry on Kubernetes by Cornelius SchumacherOSDC 2018 | Highly Available Cloud Foundry on Kubernetes by Cornelius Schumacher
OSDC 2018 | Highly Available Cloud Foundry on Kubernetes by Cornelius Schumacher
 

Ähnlich wie OSDC 2018 | Three years running containers with Kubernetes in Production by Thomas Fricke

Kubernetes: від знайомства до використання у CI/CD
Kubernetes: від знайомства до використання у CI/CDKubernetes: від знайомства до використання у CI/CD
Kubernetes: від знайомства до використання у CI/CD
Stfalcon Meetups
 
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
QAware GmbH
 

Ähnlich wie OSDC 2018 | Three years running containers with Kubernetes in Production by Thomas Fricke (20)

Microservices , Docker , CI/CD , Kubernetes Seminar - Sri Lanka
Microservices , Docker , CI/CD , Kubernetes Seminar - Sri Lanka Microservices , Docker , CI/CD , Kubernetes Seminar - Sri Lanka
Microservices , Docker , CI/CD , Kubernetes Seminar - Sri Lanka
 
The App Developer's Kubernetes Toolbox
The App Developer's Kubernetes ToolboxThe App Developer's Kubernetes Toolbox
The App Developer's Kubernetes Toolbox
 
Building Cloud-Native Applications with Kubernetes, Helm and Kubeless
Building Cloud-Native Applications with Kubernetes, Helm and KubelessBuilding Cloud-Native Applications with Kubernetes, Helm and Kubeless
Building Cloud-Native Applications with Kubernetes, Helm and Kubeless
 
Kubernetes: від знайомства до використання у CI/CD
Kubernetes: від знайомства до використання у CI/CDKubernetes: від знайомства до використання у CI/CD
Kubernetes: від знайомства до використання у CI/CD
 
Net core, mssql, container und kubernetes
Net core, mssql, container und kubernetesNet core, mssql, container und kubernetes
Net core, mssql, container und kubernetes
 
introduction to micro services
introduction to micro servicesintroduction to micro services
introduction to micro services
 
Open shift and docker - october,2014
Open shift and docker - october,2014Open shift and docker - october,2014
Open shift and docker - october,2014
 
Develop and deploy Kubernetes applications with Docker - IBM Index 2018
Develop and deploy Kubernetes  applications with Docker - IBM Index 2018Develop and deploy Kubernetes  applications with Docker - IBM Index 2018
Develop and deploy Kubernetes applications with Docker - IBM Index 2018
 
Build your own private Cloud environment
Build your own private Cloud environmentBuild your own private Cloud environment
Build your own private Cloud environment
 
DNUG46 - Build your own private Cloud environment
DNUG46 - Build your own private Cloud environmentDNUG46 - Build your own private Cloud environment
DNUG46 - Build your own private Cloud environment
 
01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware
01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware
01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware
 
IBM Think Session 8598 Domino and JavaScript Development MasterClass
IBM Think Session 8598 Domino and JavaScript Development MasterClassIBM Think Session 8598 Domino and JavaScript Development MasterClass
IBM Think Session 8598 Domino and JavaScript Development MasterClass
 
Oscon 2017: Build your own container-based system with the Moby project
Oscon 2017: Build your own container-based system with the Moby projectOscon 2017: Build your own container-based system with the Moby project
Oscon 2017: Build your own container-based system with the Moby project
 
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
 
Mattia Gandolfi - Improving utilization and portability with Containers and C...
Mattia Gandolfi - Improving utilization and portability with Containers and C...Mattia Gandolfi - Improving utilization and portability with Containers and C...
Mattia Gandolfi - Improving utilization and portability with Containers and C...
 
Kubernetes - how to orchestrate containers
Kubernetes - how to orchestrate containersKubernetes - how to orchestrate containers
Kubernetes - how to orchestrate containers
 
.NET Cloud-Native Bootcamp- Los Angeles
.NET Cloud-Native Bootcamp- Los Angeles.NET Cloud-Native Bootcamp- Los Angeles
.NET Cloud-Native Bootcamp- Los Angeles
 
Cloud Native Camel Design Patterns
Cloud Native Camel Design PatternsCloud Native Camel Design Patterns
Cloud Native Camel Design Patterns
 
DevEx | there’s no place like k3s
DevEx | there’s no place like k3sDevEx | there’s no place like k3s
DevEx | there’s no place like k3s
 
Docker & aPaaS: Enterprise Innovation and Trends for 2015
Docker & aPaaS: Enterprise Innovation and Trends for 2015Docker & aPaaS: Enterprise Innovation and Trends for 2015
Docker & aPaaS: Enterprise Innovation and Trends for 2015
 

Kürzlich hochgeladen

%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 

Kürzlich hochgeladen (20)

Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 

OSDC 2018 | Three years running containers with Kubernetes in Production by Thomas Fricke

  • 1. Three Years Of Running Containers on Kubernetes in Production June 13, 2018 OSDC Berlin thomas@endocode.com
  • 2. HI! Thomas Fricke thomas@endocode.com CTO Endocode ● System Automation ● DevOps ● Cloud, Database and Software Architect ● K8S since September 2015
  • 3. ENDOCODE ● high-quality software solutions ● best software engineering practices: test driven ● well known open source projects: https://github.com/endocode ● diverse range of technologies ● decades of experience ○ software development, ○ team management ○ 100000s of server years in public and private clouds ● Be it web, mobile, server or desktop we use: open source to meet any challenge
  • 4. AGENDA ○ The Basics: Containers ○ Kubernetes ■ Pods ■ Networks ■ Services ○ Case Studies ■ Telephony: immmr ■ On Premises: ERP Customer ■ Machine Learning
  • 5. *AAS Pyramide Functions App Engine Containers Virtual Machines Google Infrastructure Event driven functions Web apps & APIs GKE Infrastructure
  • 7. CONTAINERS OR VIRTUALIZATION Topic Container Virtualization Isolation OS Level, OS namespaces CPU Level: Ring 0/Ring 3 foreign CPU no yes, with emulation foreign kernels, OS no yes kernel is common emulated devices no yes security host devices direct virtio driver security CPU performance 100% 95% IO performance 100% <<100% root isolation yes yes USER directive CPU cache attacks easy possible PoC ?
  • 8.
  • 9. CAN WE MIX CONTAINERS AND HYPERVISORS? ● gVisor ● Intel Clear Container ● kvm in containers ● Docker on non Linux OS ● Mac OS: xhyve ● Windows: Hyper-V
  • 10. LINUX NAMESPACES Namespace Constant Isolates Cgroup CLONE_NEWCGROUP Cgroup root directory IPC CLONE_NEWIPC System V IPC, POSIX message queues Network CLONE_NEWNET Network devices, stacks, ports, etc. Mount CLONE_NEWNS Mount points PID CLONE_NEWPID Process IDs User CLONE_NEWUSER User and group IDs UTS CLONE_NEWUTS Hostname and NIS domain name
  • 11. CONTROL GROUPS ● cpuset ● cpu ● cpuacct ● memory ● devices ● freezer ● net_cls ● ns ● blkio these are directories with fine grained sub folders
  • 12. KERNEL CAPABILITIES CAP_AUDIT_CONTROL, CAP_AUDIT_READ, CAP_AUDIT_WRITE, CAP_BLOCK_SUSPEND, CAP_CHOWN,CAP_DAC_OVERRIDE, CAP_DAC_READ_SEARCH, CAP_FOWNER, CAP_FSETID, CAP_IPC_LOCK, CAP_IPC_OWNER, CAP_KILL, CAP_LEASE, CAP_LINUX_IMMUTABLE, CAP_MAC_ADMIN,CAP_MAC_OVERRIDE, CAP_MKNOD, CAP_NET_ADMIN, CAP_NET_BIND_SERVICE, CAP_NET_BROADCAST, CAP_NET_RAW, CAP_SETGID, CAP_SETFCAP, CAP_SETPCAP, CAP_SETUID, CAP_SYS_ADMIN, CAP_SYS_BOOT, CAP_SYS_CHROOT, CAP_SYS_MODULE, CAP_SYS_NICE, CAP_SYS_PACCT, CAP_SYS_PTRACE, CAP_SYS_RAWIO, CAP_SYS_RESOURCE, CAP_SYS_TIME, CAP_SYS_TTY_CONFIG, CAP_SYSLOG, CAP_WAKE_ALARM, CAP_INIT_EFF_SET These are a lot! Use profiles to group them together! man capabilities
  • 13. Greek for “Helmsman”; also the root of the words “governor” and “cybernetic” ● Runs and manages containers ● Inspired and informed by Google’s experiences and internal systems ● Supports multiple cloud and bare-metal environments ● Supports multiple container runtimes ● 100% Open source, written in Go Manage applications, not machines Kubernetes
  • 14. kubelet UI kubeletCLI API users master nodes The 10000 foot view etcd kubelet scheduler controllers apiserver
  • 15. UI All you really care about API Container Cluster
  • 16.
  • 17. KUBERNETES PODS ● Core Concept the Kubernetes Microservice ● Bunch of Containers with the same ○ Lifecycle: live together, die together ○ Network: same ip address, same 127.0.0.0/8 ○ Volumes: can share data ○ One common task ○ Init Tasks ○ Live and Readiness Checks apiVersion: v1 kind: Pod metadata: name: nginx labels: env: test spec: containers: - name: nginx image: nginx
  • 18. PODS SHOULD NEVER BE DEPLOYED ALONE ● deployments ○ replicasets ■ pods ● containers ● Jobs: pods that terminate ● Replicationcontrollers, Replicasets, (don’t use directly) ● Daemonset: one per node ● StatefulSets (aka PetSets): predictable names ○ volumes ○ database clusters apiVersion: apps/v1 #since 1.9 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.7.9 ports: - containerPort: 80
  • 20.
  • 21.
  • 22. POD in K8S Pod Centric View from Roland Huss https://github.com/ro14nd-talks/kubernetes-patterns
  • 23.
  • 24. The Network Flannel ● Flannel ○ simplest version ○ IP over IP ● Calico ○ dam’n complicated ○ much more sophisticated ● Network Policies ○ Security ○ Partitioning a cluster
  • 25. TYPICAL APPLICATIONS - Programming languages and their runtimes - Various databases from various generations - SQL - NoSQL - Local and sessions storage - Message queueing
  • 26. KUBERNETES SERVICES ● Connecting Pods to the outside world ● identified by the selector ○ key value pair ○ app name ● ports ○ pod ○ node ○ loadbalancer needs external support kind: Service apiVersion: v1 metadata: name: nginx-service spec: selector: app: nginx type: Loadbalancer ports: - protocol: TCP port: 80 targetPort: 80
  • 27. ● strictly tiered architecture ○ separation of stateless ○ and persistent data ● inside the pods ○ developers are free to use what they want ○ contract is binding to the outside Network stateless Frontend stateless WebportalWebportal Webportal Frontend Cache stateless Backend Services stateless WebportalWebportalWeb Main App WebportalWebportal Notification WebportalWebportal User Profile Persistent services stateful Networking Endpoints Dataflow Bigquery Storage Datastore SQL Pub Sub
  • 28. MINDSET CHANGE Ancient Times ● System Engineering ● Hardware Centric ● Virtual Machine https://12factor.net/ Today ● DevOps ● Application Management ● Managed Service ● Pods
  • 29. FROM VMs TO PODS OS instances microservices in Pods
  • 30. FROM VMs TO PODS VM cluster Pods running on Kubernetes - cattle: stateless containers - pets: - databases - use managed services
  • 31. FROM VMs TO PODS configuration management separation of build time and run time
  • 32. BUSINESS VALUE - faster deployments: - faster time to market - more and faster testing - more teams possible - faster deployment - better quality - less maintenance in operations - less load - simpler deployments
  • 33. SUMMARY Separation of build-time and run-time (12factor.net commandmend V) - PODs should require only minimal parametrization for being deployed - Secrets - Config Maps - Environment variables - No Config Management necessary
  • 34. CONTAINER LIFECYCLE MANAGEMENT Part 1: Build-time related - Audits, scanning of container content in the registry - Management of ephemeral configuration (as in regular scheduled updates of keys, …) - Stop-gap: rebuild container often, deploy new versions - Leaner containers - immutable containers - incredibly shrinking deployments
  • 35. CONTAINER LIFECYCLE MANAGEMENT Part 2: Runtime related - Monitoring of pods, containers and apps/processes - Lifecycle management - Cleanup of nodes (minions) after POD end-of-live - Issue with multi-tenant readiness - Clean-up, … - issue of isolation beyond individual process (in container)
  • 37. immmr - one number for every need immmr combines the best of Internet base communication with the advantages of mobile communication immmr makes it possible to use a single mobile number from any device http://www.immmr.com/
  • 38. CHALLENGES ● G10 Compliance ● Every connection must be encrypted ● Vault for Key Management
  • 39. FROM THE TRENCHES - Easy: - Java with SpringBoot - Python - Hard: - Ruby Gems - Separation - build - deployment - no compiler in production - change to a static Ruby binary traveling ruby - adapt to database supported by your cloud provider - ruby version hell: rvm
  • 40. FROM THE TRENCHES - Lessons learned preparing for a security audit: - this needed to be done anyway - separation of stateless and persistent services is a good idea anyway and with containers really important - Dockerfiles need careful design to be fast - private registry for images recommended (same region) - quay.io - container life cycle monitoring - CVE database
  • 41. RESULTS AND EXPERIENCES - Scalable, kubified application - Service architecture as it always should have been :-) - Reduced technical debt and implicit knowledge - Standardised processes and APIs for services management - Previously, practises varied between projects - Pod as deployment unit, single process per container - Pods are containers sharint the same fate - Service as load-balanced entry point - external service - no LB cluster hassle - smaller deployments
  • 42. RESILIENCE High Availibility works - CoreOS automatic cluster update at immmr - no outage - cluster continued to work - monitoring showed all services available
  • 43. BUSINESS VALUE - faster deployments: - faster time to market - more and faster testing - more teams possible - faster deployment - better quality - less maintenance in operations - less load - simpler deployments - higher availibility
  • 44. RESULTS AND EXPERIENCES Separation of build-time and run-time - PODs: minimal parametrization - config maps - Secrets - Environment variables - Configuration management inside the container - build-time issue - It should not be deployed with the container
  • 45. CASE STUDY: ON PREMISES ERP COMPANY
  • 46. CHALLENGES ● 1TB machines ● 80 cores ● 80 GB Containers ● Windows in KVM Containers ● Docker socket is a bottle neck
  • 47. WAIT, WAIT, WAIT: DID HE SAY WINDOWS IN K8S?
  • 49. kubectl create -f ml-job.yaml call all necessary libraries config map apiVersion: v1 kind: Pod metadata: name: machine-learning-job spec: containers: - name: machine-learning-job image: machine-learning command: ["python","/opt/ml/ml.py" ] ... tf.device('/cpu:0') tf.device('/cpu:9') tf.device('/cpu:1') TENSORFLOW IN KUBERNETES
  • 50. all necessary librariesapiVersion: v1 kind: Pod metadata: name: machine-learning-notebook spec: containers: - name: ml-notebook image: ml-notebook command: [“ start-notebook.sh”] ... Interactive Version ● Jupyter notebook as Web Frontend Kubernetes service ● persistent storage for the model datasets JUPYTER NOTEBOOKS
  • 51. 1. Kernel Module creation: a. time consuming b. extremely version sensitive c. needed only once / version i. distributed in an image (preferred for production) ii. or in an highly priviledged container (dev and test only) 2. Library Images a. need development packages b. can be very time consuming c. large, should be optimized for large scale rollout d. might need GPU optimization tweaks 3. Once the images are created, starting a job is a task of minutes 4. ML handles large datasets 5. Interactive Services necessary 6. GPUs don’t have load balancing, but maybe we need a time limit 7. Container image creation itself could be delegated to priviledged containers using the wormhole pattern 8. Distributed Workloads CHALLENGES
  • 52. wormhole pattern docker in docker or with builda apiVersion: v1 kind: Pod metadata: name: debian-jessie-wormhole spec: containers: - image: debian:jessie command: - docker - build - /library name: debian-jessie-wormhole volumeMounts: - mountPath: /var/run/docker.sock name: docker-socket - mountPath: /bin/docker name: docker-binary ... bokeh coverage decorator discover docopt jinja2 matplotlib mysql-connector-python nose numpy pyftpdlib scipy SQLAlchemy sqlacodegen xmltodict zipline requirements.txt config map build container build library image BUILD WORKFLOW
  • 53. TF Worker NodesTF Parameter ServerTF Client tensorflow::Session worker_service.proto https://www.tensorflow.org/deploy/distributed https://github.com/dask/dask DISTRIBUTED TENSORFLOW
  • 54. CASE STUDY: BIG NETWORK BIG PRICE COMPARISON SITE
  • 55.
  • 56. Compute Node Kubernetes Layer Calico CNI Plugin KernelIP TablesIP Routes RR Route Reflector BIRD BGP Felix RR Route ReflectorRR Route Reflector eth0 eth1 Physical fabric (L2, L3, MPLS) Pods Pods Pods Pods Pods Pods Pods Pods Pods Pods CALICO Network
  • 57. QUESTIONS? Watch our Webinar ‘Dive into Kubernetes’ on our YouTube Channel https://youtu.be/8694GGJlpZ8 Register for a free Google Cloud Platform Trial with $300 Google Cloud Platform Credits https://goo.gl/dUzDWi Use another $200 partner credits https://goo.gl/eYldnT