SlideShare a Scribd company logo
1 of 19
Download to read offline
Kubernetes for beginners
Dominique Dumont
Debian Project
Nov 2017
Dominique Dumont k8s for beginners
Why Kubernetes ?
docker is nice, but containers tend to multiply
needs to manage / orchestrate them
need to handle network setup between all these images (micro
services beget mega network)
handle ”smooth” updates
Solutions: docker swarm, Kubernetes (other ?)
Dominique Dumont k8s for beginners
New concepts and terminology
New concepts compared to docker:
pod: a group of containers that provide a functionality
node: a worker machine (or VM). old term: minion
deployment: controls lifecycle of a group of pods (rolling
upgrades)
service: deployment frontend. Configure load-balancer and
external access
Dominique Dumont k8s for beginners
Pod in more details
A pod is a group of containers:
share the same IP address.
Must set different listening
ports on each container
declare external ports that
are mapped to container
ports
can mount shared volumes
can be configured with
ConfigMaps and Secrets
through environment
variables or files
Pod
Container
Dominique Dumont k8s for beginners
Deployment
A deployment with its
ReplicaSet is a group of
pods (of the same kind):
ReplicaSet ensures
failover
manage liveness and
readiness probes
manage rolling
upgrades
Deployment
Pod
Container
Replica
controler
Pod
Container
Pod
Container
Dominique Dumont k8s for beginners
Services
A Service is the external front end of a Deployment:
manage load balancing between the pod instances of a
Deployment
map port between external port (e.g. 80) and container ports
(e.g. 8080)
Deployment
Service
Pod
Container
Replica
controler
Balancer
Load
Pod
Container
Pod
Container
Dominique Dumont k8s for beginners
Pod example
Inside a deployment:
spec:
containers:
- name: my-contained-server
image: my-contained-image:latest
imagePullPolicy: Always
livenessProbe:
httpGet: { path: /ping, scheme: HTTPS }
initialDelaySeconds: 15
periodSeconds: 10
timeoutSeconds: 3
readinessProbe: # similar
volumeMounts:
- name: shared-stuff
mountPath: "/var/lib/shared"
- name: side-car
image: side-car:latest
Dominique Dumont k8s for beginners
Deployment example
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: super-duper-server
spec:
replicas: 1
strategy:
type: RollingUpdate
rollingUpdate: { maxUnavailable: 0, maxSurge: 2 }
template:
metadata:
name: super-mega-server
labels: # used by Service
my-server: mega-server
spec:
containers:
[ pod specification ]
Dominique Dumont k8s for beginners
Service example
apiVersion: v1
kind: Service
metadata:
labels:
name: my-super-service
name: super-service
spec:
ports:
- {port: 443, targetPort: 8090}
type: LoadBalancer
# load balancer target
selector:
my-server: mega-server
Dominique Dumont k8s for beginners
Config
namespace: isolated sandboxes within a cluster. Great for
tests
context: associate cluster and namespace
Commands:
$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
minikube minikube minikube
* dev-us-west-2 k-uw2.xxx.com us-west-2-user
dod-dev-us-w2 k-uw2.xxx.com us-west-2-user dod-playground
$ kubectl config use-context dod-dev-us-w2
$ kubectl config set-context ...
Dominique Dumont k8s for beginners
Config
namespace: isolated sandboxes within a cluster. Great for
tests
context: associate cluster and namespace
Commands:
$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
minikube minikube minikube
* dev-us-west-2 k-uw2.xxx.com us-west-2-user
dod-dev-us-w2 k-uw2.xxx.com us-west-2-user dod-playground
$ kubectl config use-context dod-dev-us-w2
$ kubectl config set-context ...
Dominique Dumont k8s for beginners
Sending config
Create Deployment or services:
$ kubectl apply -f .../file.yaml
Update a deployment:
$ kubectl replace -f .../file.yaml
Dominique Dumont k8s for beginners
Kubernetes console
If enabled by admin, cluster can be controled with a web interface
$ kubectl proxy
Starting to serve on 127.0.0.1:8001
Dominique Dumont k8s for beginners
Connecting to a container
In enabled by sys admin, you can connect to a container in the
cluster:
$ kubectl exec --namespace francois-sandbox 
fco-mode1-n9r-812209105-9wfcs -c omg date
Thu Oct 26 18:01:58 UTC 2017
$ kubectl exec --namespace francois-sandbox
fco-mode1-n9r-812209105-9wfcs -c omg -ti sh / #
Dominique Dumont k8s for beginners
Getting logs
Getting log may be the only way to get debug information. To get
log from a container:
$ kubectl logs --namespace francois-sandbox 
fco-mode1-n9r-812209105-9wfcs omg --since 10s
$ kubectl logs --namespace francois-sandbox 
fco-mode1-n9r-812209105-9wfcs omg -f
Logs from many pods
Problems can occur in any deployed pod. You need to setup a log
aggregator (kibana...)
Dominique Dumont k8s for beginners
Auto-completion
Typings all these options and arguments is tedious and error prone.
Add this in your ~/.bashrc
KFILE=/tmp/kube-completion
if [ -f /usr/local/bin/kubectl ]; then
/usr/local/bin/kubectl completion bash > $KFILE
. $KFILE
rm $KFILE
fi
Dominique Dumont k8s for beginners
Other tools
You can have your prompt display the current environment:
For a command prompt that shows your context, add this in your
~/.bashrc
NORMAL="[033[00m]"
YELLOW="[e[1;33m]"
__kube_prompt() {
# Get current context
CONTEXT=$(perl -nE ’print if s/current-context: //;’ 
~/.kube/config)
if [[ -n "$CONTEXT" ]]
then
echo "$YELLOW(k8s: ${CONTEXT})$NORMALn"
fi
}
PS1=$(__kube_prompt)’${USER}@${HOSTNAME}:${PWD/$HOME/~}$ ’
Dominique Dumont k8s for beginners
Other tools
You can have your prompt display the current environment:
For a command prompt that shows your context, add this in your
~/.bashrc
NORMAL="[033[00m]"
YELLOW="[e[1;33m]"
__kube_prompt() {
# Get current context
CONTEXT=$(perl -nE ’print if s/current-context: //;’ 
~/.kube/config)
if [[ -n "$CONTEXT" ]]
then
echo "$YELLOW(k8s: ${CONTEXT})$NORMALn"
fi
}
PS1=$(__kube_prompt)’${USER}@${HOSTNAME}:${PWD/$HOME/~}$ ’
Dominique Dumont k8s for beginners
MiniKube
MiniKube lets you play with kubernetes your laptop.
Can use kubernetes console to control your minikube
Note: docker commands deal with a docker daemon running
in minikube, not with your ”regular” docker daemon
Dominique Dumont k8s for beginners

More Related Content

What's hot

WSO2Con US 2015 Kubernetes: a platform for automating deployment, scaling, an...
WSO2Con US 2015 Kubernetes: a platform for automating deployment, scaling, an...WSO2Con US 2015 Kubernetes: a platform for automating deployment, scaling, an...
WSO2Con US 2015 Kubernetes: a platform for automating deployment, scaling, an...Brian Grant
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to KubernetesRoss Kukulinski
 
Kubernetes 101 for Beginners
Kubernetes 101 for BeginnersKubernetes 101 for Beginners
Kubernetes 101 for BeginnersOktay Esgul
 
DevOps in AWS with Kubernetes
DevOps in AWS with KubernetesDevOps in AWS with Kubernetes
DevOps in AWS with KubernetesOleg Chunikhin
 
Scaling Microservices with Kubernetes
Scaling Microservices with KubernetesScaling Microservices with Kubernetes
Scaling Microservices with KubernetesDeivid Hahn Fração
 
Hands-On Introduction to Kubernetes at LISA17
Hands-On Introduction to Kubernetes at LISA17Hands-On Introduction to Kubernetes at LISA17
Hands-On Introduction to Kubernetes at LISA17Ryan Jarvinen
 
Introduction to Kubernetes Workshop
Introduction to Kubernetes WorkshopIntroduction to Kubernetes Workshop
Introduction to Kubernetes WorkshopBob Killen
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes IntroductionEric Gustafson
 
Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)Megan O'Keefe
 
Scaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceScaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceBen Hall
 
Kubernetes Basic Operation
Kubernetes Basic OperationKubernetes Basic Operation
Kubernetes Basic OperationSimon Su
 
Monitoring, Logging and Tracing on Kubernetes
Monitoring, Logging and Tracing on KubernetesMonitoring, Logging and Tracing on Kubernetes
Monitoring, Logging and Tracing on KubernetesMartin Etmajer
 
Platform Orchestration with Kubernetes and Docker
Platform Orchestration with Kubernetes and DockerPlatform Orchestration with Kubernetes and Docker
Platform Orchestration with Kubernetes and DockerJulian Strobl
 
Docker and Kubernetes 101 workshop
Docker and Kubernetes 101 workshopDocker and Kubernetes 101 workshop
Docker and Kubernetes 101 workshopSathish VJ
 
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 Mario Ishara Fernando
 

What's hot (20)

WSO2Con US 2015 Kubernetes: a platform for automating deployment, scaling, an...
WSO2Con US 2015 Kubernetes: a platform for automating deployment, scaling, an...WSO2Con US 2015 Kubernetes: a platform for automating deployment, scaling, an...
WSO2Con US 2015 Kubernetes: a platform for automating deployment, scaling, an...
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
 
Kubernetes 101
Kubernetes 101Kubernetes 101
Kubernetes 101
 
Kubernetes 101 for Beginners
Kubernetes 101 for BeginnersKubernetes 101 for Beginners
Kubernetes 101 for Beginners
 
DevOps in AWS with Kubernetes
DevOps in AWS with KubernetesDevOps in AWS with Kubernetes
DevOps in AWS with Kubernetes
 
Kubernetes 101
Kubernetes 101Kubernetes 101
Kubernetes 101
 
Scaling Microservices with Kubernetes
Scaling Microservices with KubernetesScaling Microservices with Kubernetes
Scaling Microservices with Kubernetes
 
Intro to Kubernetes
Intro to KubernetesIntro to Kubernetes
Intro to Kubernetes
 
Hands-On Introduction to Kubernetes at LISA17
Hands-On Introduction to Kubernetes at LISA17Hands-On Introduction to Kubernetes at LISA17
Hands-On Introduction to Kubernetes at LISA17
 
Introduction to Kubernetes Workshop
Introduction to Kubernetes WorkshopIntroduction to Kubernetes Workshop
Introduction to Kubernetes Workshop
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes Introduction
 
Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)
 
Scaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceScaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container Service
 
Kubernetes Basic Operation
Kubernetes Basic OperationKubernetes Basic Operation
Kubernetes Basic Operation
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes Introduction
 
Rex gke-clustree
Rex gke-clustreeRex gke-clustree
Rex gke-clustree
 
Monitoring, Logging and Tracing on Kubernetes
Monitoring, Logging and Tracing on KubernetesMonitoring, Logging and Tracing on Kubernetes
Monitoring, Logging and Tracing on Kubernetes
 
Platform Orchestration with Kubernetes and Docker
Platform Orchestration with Kubernetes and DockerPlatform Orchestration with Kubernetes and Docker
Platform Orchestration with Kubernetes and Docker
 
Docker and Kubernetes 101 workshop
Docker and Kubernetes 101 workshopDocker and Kubernetes 101 workshop
Docker and Kubernetes 101 workshop
 
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
 

Viewers also liked

Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetesrajdeep
 
An Introduction to Kubernetes
An Introduction to KubernetesAn Introduction to Kubernetes
An Introduction to KubernetesImesh Gunaratne
 
Kubernetes project update and how to contribute
Kubernetes project update and how to contributeKubernetes project update and how to contribute
Kubernetes project update and how to contributeinwin stack
 
Scaling Docker with Kubernetes
Scaling Docker with KubernetesScaling Docker with Kubernetes
Scaling Docker with KubernetesCarlos Sanchez
 
Kubernetes Architecture and Introduction – Paris Kubernetes Meetup
Kubernetes Architecture and Introduction – Paris Kubernetes MeetupKubernetes Architecture and Introduction – Paris Kubernetes Meetup
Kubernetes Architecture and Introduction – Paris Kubernetes MeetupStefan Schimanski
 
Kubernetes Architecture and Introduction
Kubernetes Architecture and IntroductionKubernetes Architecture and Introduction
Kubernetes Architecture and IntroductionStefan Schimanski
 

Viewers also liked (7)

Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
 
An Introduction to Kubernetes
An Introduction to KubernetesAn Introduction to Kubernetes
An Introduction to Kubernetes
 
Kubernetes project update and how to contribute
Kubernetes project update and how to contributeKubernetes project update and how to contribute
Kubernetes project update and how to contribute
 
DevOpsDays Brasilia 2017
DevOpsDays Brasilia 2017DevOpsDays Brasilia 2017
DevOpsDays Brasilia 2017
 
Scaling Docker with Kubernetes
Scaling Docker with KubernetesScaling Docker with Kubernetes
Scaling Docker with Kubernetes
 
Kubernetes Architecture and Introduction – Paris Kubernetes Meetup
Kubernetes Architecture and Introduction – Paris Kubernetes MeetupKubernetes Architecture and Introduction – Paris Kubernetes Meetup
Kubernetes Architecture and Introduction – Paris Kubernetes Meetup
 
Kubernetes Architecture and Introduction
Kubernetes Architecture and IntroductionKubernetes Architecture and Introduction
Kubernetes Architecture and Introduction
 

Similar to kubernetes for beginners

Scaling docker with kubernetes
Scaling docker with kubernetesScaling docker with kubernetes
Scaling docker with kubernetesLiran Cohen
 
Docker: A New Way to Turbocharging Your Apps Development
Docker: A New Way to Turbocharging Your Apps DevelopmentDocker: A New Way to Turbocharging Your Apps Development
Docker: A New Way to Turbocharging Your Apps Developmentmsyukor
 
Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020CloudHero
 
Get you Java application ready for Kubernetes !
Get you Java application ready for Kubernetes !Get you Java application ready for Kubernetes !
Get you Java application ready for Kubernetes !Anthony Dahanne
 
Kubernetes laravel and kubernetes
Kubernetes   laravel and kubernetesKubernetes   laravel and kubernetes
Kubernetes laravel and kubernetesWilliam Stewart
 
IBM MQ in containers MQTC 2017
IBM MQ in containers MQTC 2017IBM MQ in containers MQTC 2017
IBM MQ in containers MQTC 2017Robert Parker
 
Be a happier developer with Docker: Tricks of the trade
Be a happier developer with Docker: Tricks of the tradeBe a happier developer with Docker: Tricks of the trade
Be a happier developer with Docker: Tricks of the tradeNicola Paolucci
 
Docker HK Meetup - 201707
Docker HK Meetup - 201707Docker HK Meetup - 201707
Docker HK Meetup - 201707Clarence Ho
 
When Docker Engine 1.12 features unleashes software architecture
When Docker Engine 1.12 features unleashes software architectureWhen Docker Engine 1.12 features unleashes software architecture
When Docker Engine 1.12 features unleashes software architecture Adrien Blind
 
Using Docker For Development
Using Docker For DevelopmentUsing Docker For Development
Using Docker For DevelopmentLaura Frank Tacho
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionBen Hall
 
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz LachJDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz LachPROIDEA
 
Rooting Out Root: User namespaces in Docker
Rooting Out Root: User namespaces in DockerRooting Out Root: User namespaces in Docker
Rooting Out Root: User namespaces in DockerPhil Estes
 
DockerCon 18 docker storage
DockerCon 18 docker storageDockerCon 18 docker storage
DockerCon 18 docker storageDaniel Finneran
 
Docker Basic to Advance
Docker Basic to AdvanceDocker Basic to Advance
Docker Basic to AdvanceParas Jain
 
BBL Premiers pas avec Docker
BBL Premiers pas avec DockerBBL Premiers pas avec Docker
BBL Premiers pas avec Dockerkanedafromparis
 
Dayta AI Seminar - Kubernetes, Docker and AI on Cloud
Dayta AI Seminar - Kubernetes, Docker and AI on CloudDayta AI Seminar - Kubernetes, Docker and AI on Cloud
Dayta AI Seminar - Kubernetes, Docker and AI on CloudJung-Hong Kim
 

Similar to kubernetes for beginners (20)

Scaling docker with kubernetes
Scaling docker with kubernetesScaling docker with kubernetes
Scaling docker with kubernetes
 
Docker: A New Way to Turbocharging Your Apps Development
Docker: A New Way to Turbocharging Your Apps DevelopmentDocker: A New Way to Turbocharging Your Apps Development
Docker: A New Way to Turbocharging Your Apps Development
 
Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020
 
Get you Java application ready for Kubernetes !
Get you Java application ready for Kubernetes !Get you Java application ready for Kubernetes !
Get you Java application ready for Kubernetes !
 
Cloud RPI4 tomcat ARM64
Cloud RPI4 tomcat ARM64Cloud RPI4 tomcat ARM64
Cloud RPI4 tomcat ARM64
 
Kubernetes laravel and kubernetes
Kubernetes   laravel and kubernetesKubernetes   laravel and kubernetes
Kubernetes laravel and kubernetes
 
IBM MQ in containers MQTC 2017
IBM MQ in containers MQTC 2017IBM MQ in containers MQTC 2017
IBM MQ in containers MQTC 2017
 
Be a happier developer with Docker: Tricks of the trade
Be a happier developer with Docker: Tricks of the tradeBe a happier developer with Docker: Tricks of the trade
Be a happier developer with Docker: Tricks of the trade
 
Docker HK Meetup - 201707
Docker HK Meetup - 201707Docker HK Meetup - 201707
Docker HK Meetup - 201707
 
When Docker Engine 1.12 features unleashes software architecture
When Docker Engine 1.12 features unleashes software architectureWhen Docker Engine 1.12 features unleashes software architecture
When Docker Engine 1.12 features unleashes software architecture
 
Using Docker For Development
Using Docker For DevelopmentUsing Docker For Development
Using Docker For Development
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and Production
 
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz LachJDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
 
Rooting Out Root: User namespaces in Docker
Rooting Out Root: User namespaces in DockerRooting Out Root: User namespaces in Docker
Rooting Out Root: User namespaces in Docker
 
DockerCon 18 docker storage
DockerCon 18 docker storageDockerCon 18 docker storage
DockerCon 18 docker storage
 
Docker Basic to Advance
Docker Basic to AdvanceDocker Basic to Advance
Docker Basic to Advance
 
Docker advance1
Docker advance1Docker advance1
Docker advance1
 
From a cluster to the Cloud
From a cluster to the CloudFrom a cluster to the Cloud
From a cluster to the Cloud
 
BBL Premiers pas avec Docker
BBL Premiers pas avec DockerBBL Premiers pas avec Docker
BBL Premiers pas avec Docker
 
Dayta AI Seminar - Kubernetes, Docker and AI on Cloud
Dayta AI Seminar - Kubernetes, Docker and AI on CloudDayta AI Seminar - Kubernetes, Docker and AI on Cloud
Dayta AI Seminar - Kubernetes, Docker and AI on Cloud
 

More from Dominique Dumont

Quelques astuces pour débogguer Terraform.pdf
Quelques astuces pour débogguer Terraform.pdfQuelques astuces pour débogguer Terraform.pdf
Quelques astuces pour débogguer Terraform.pdfDominique Dumont
 
Terraform - IAC - de quoi s'agit t'il ?.pdf
Terraform - IAC - de quoi s'agit t'il ?.pdfTerraform - IAC - de quoi s'agit t'il ?.pdf
Terraform - IAC - de quoi s'agit t'il ?.pdfDominique Dumont
 
Comment contribuer à un projet open source ?
Comment contribuer à un projet open source ?Comment contribuer à un projet open source ?
Comment contribuer à un projet open source ?Dominique Dumont
 
Cme: a tool to edit and validate configuration files
Cme: a tool to edit and validate configuration filesCme: a tool to edit and validate configuration files
Cme: a tool to edit and validate configuration filesDominique Dumont
 
The reports of Perl's death have been greatly exaggerated
The reports of Perl's death have been greatly exaggeratedThe reports of Perl's death have been greatly exaggerated
The reports of Perl's death have been greatly exaggeratedDominique Dumont
 

More from Dominique Dumont (8)

Quelques astuces pour débogguer Terraform.pdf
Quelques astuces pour débogguer Terraform.pdfQuelques astuces pour débogguer Terraform.pdf
Quelques astuces pour débogguer Terraform.pdf
 
Terraform - IAC - de quoi s'agit t'il ?.pdf
Terraform - IAC - de quoi s'agit t'il ?.pdfTerraform - IAC - de quoi s'agit t'il ?.pdf
Terraform - IAC - de quoi s'agit t'il ?.pdf
 
Démarrer avec Helm
Démarrer avec HelmDémarrer avec Helm
Démarrer avec Helm
 
Comment contribuer à un projet open source ?
Comment contribuer à un projet open source ?Comment contribuer à un projet open source ?
Comment contribuer à un projet open source ?
 
Cme: a tool to edit and validate configuration files
Cme: a tool to edit and validate configuration filesCme: a tool to edit and validate configuration files
Cme: a tool to edit and validate configuration files
 
How to keep promises
How to keep promisesHow to keep promises
How to keep promises
 
The reports of Perl's death have been greatly exaggerated
The reports of Perl's death have been greatly exaggeratedThe reports of Perl's death have been greatly exaggerated
The reports of Perl's death have been greatly exaggerated
 
Magit
MagitMagit
Magit
 

Recently uploaded

VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 

Recently uploaded (20)

VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 

kubernetes for beginners

  • 1. Kubernetes for beginners Dominique Dumont Debian Project Nov 2017 Dominique Dumont k8s for beginners
  • 2. Why Kubernetes ? docker is nice, but containers tend to multiply needs to manage / orchestrate them need to handle network setup between all these images (micro services beget mega network) handle ”smooth” updates Solutions: docker swarm, Kubernetes (other ?) Dominique Dumont k8s for beginners
  • 3. New concepts and terminology New concepts compared to docker: pod: a group of containers that provide a functionality node: a worker machine (or VM). old term: minion deployment: controls lifecycle of a group of pods (rolling upgrades) service: deployment frontend. Configure load-balancer and external access Dominique Dumont k8s for beginners
  • 4. Pod in more details A pod is a group of containers: share the same IP address. Must set different listening ports on each container declare external ports that are mapped to container ports can mount shared volumes can be configured with ConfigMaps and Secrets through environment variables or files Pod Container Dominique Dumont k8s for beginners
  • 5. Deployment A deployment with its ReplicaSet is a group of pods (of the same kind): ReplicaSet ensures failover manage liveness and readiness probes manage rolling upgrades Deployment Pod Container Replica controler Pod Container Pod Container Dominique Dumont k8s for beginners
  • 6. Services A Service is the external front end of a Deployment: manage load balancing between the pod instances of a Deployment map port between external port (e.g. 80) and container ports (e.g. 8080) Deployment Service Pod Container Replica controler Balancer Load Pod Container Pod Container Dominique Dumont k8s for beginners
  • 7. Pod example Inside a deployment: spec: containers: - name: my-contained-server image: my-contained-image:latest imagePullPolicy: Always livenessProbe: httpGet: { path: /ping, scheme: HTTPS } initialDelaySeconds: 15 periodSeconds: 10 timeoutSeconds: 3 readinessProbe: # similar volumeMounts: - name: shared-stuff mountPath: "/var/lib/shared" - name: side-car image: side-car:latest Dominique Dumont k8s for beginners
  • 8. Deployment example apiVersion: extensions/v1beta1 kind: Deployment metadata: name: super-duper-server spec: replicas: 1 strategy: type: RollingUpdate rollingUpdate: { maxUnavailable: 0, maxSurge: 2 } template: metadata: name: super-mega-server labels: # used by Service my-server: mega-server spec: containers: [ pod specification ] Dominique Dumont k8s for beginners
  • 9. Service example apiVersion: v1 kind: Service metadata: labels: name: my-super-service name: super-service spec: ports: - {port: 443, targetPort: 8090} type: LoadBalancer # load balancer target selector: my-server: mega-server Dominique Dumont k8s for beginners
  • 10. Config namespace: isolated sandboxes within a cluster. Great for tests context: associate cluster and namespace Commands: $ kubectl config get-contexts CURRENT NAME CLUSTER AUTHINFO NAMESPACE minikube minikube minikube * dev-us-west-2 k-uw2.xxx.com us-west-2-user dod-dev-us-w2 k-uw2.xxx.com us-west-2-user dod-playground $ kubectl config use-context dod-dev-us-w2 $ kubectl config set-context ... Dominique Dumont k8s for beginners
  • 11. Config namespace: isolated sandboxes within a cluster. Great for tests context: associate cluster and namespace Commands: $ kubectl config get-contexts CURRENT NAME CLUSTER AUTHINFO NAMESPACE minikube minikube minikube * dev-us-west-2 k-uw2.xxx.com us-west-2-user dod-dev-us-w2 k-uw2.xxx.com us-west-2-user dod-playground $ kubectl config use-context dod-dev-us-w2 $ kubectl config set-context ... Dominique Dumont k8s for beginners
  • 12. Sending config Create Deployment or services: $ kubectl apply -f .../file.yaml Update a deployment: $ kubectl replace -f .../file.yaml Dominique Dumont k8s for beginners
  • 13. Kubernetes console If enabled by admin, cluster can be controled with a web interface $ kubectl proxy Starting to serve on 127.0.0.1:8001 Dominique Dumont k8s for beginners
  • 14. Connecting to a container In enabled by sys admin, you can connect to a container in the cluster: $ kubectl exec --namespace francois-sandbox fco-mode1-n9r-812209105-9wfcs -c omg date Thu Oct 26 18:01:58 UTC 2017 $ kubectl exec --namespace francois-sandbox fco-mode1-n9r-812209105-9wfcs -c omg -ti sh / # Dominique Dumont k8s for beginners
  • 15. Getting logs Getting log may be the only way to get debug information. To get log from a container: $ kubectl logs --namespace francois-sandbox fco-mode1-n9r-812209105-9wfcs omg --since 10s $ kubectl logs --namespace francois-sandbox fco-mode1-n9r-812209105-9wfcs omg -f Logs from many pods Problems can occur in any deployed pod. You need to setup a log aggregator (kibana...) Dominique Dumont k8s for beginners
  • 16. Auto-completion Typings all these options and arguments is tedious and error prone. Add this in your ~/.bashrc KFILE=/tmp/kube-completion if [ -f /usr/local/bin/kubectl ]; then /usr/local/bin/kubectl completion bash > $KFILE . $KFILE rm $KFILE fi Dominique Dumont k8s for beginners
  • 17. Other tools You can have your prompt display the current environment: For a command prompt that shows your context, add this in your ~/.bashrc NORMAL="[033[00m]" YELLOW="[e[1;33m]" __kube_prompt() { # Get current context CONTEXT=$(perl -nE ’print if s/current-context: //;’ ~/.kube/config) if [[ -n "$CONTEXT" ]] then echo "$YELLOW(k8s: ${CONTEXT})$NORMALn" fi } PS1=$(__kube_prompt)’${USER}@${HOSTNAME}:${PWD/$HOME/~}$ ’ Dominique Dumont k8s for beginners
  • 18. Other tools You can have your prompt display the current environment: For a command prompt that shows your context, add this in your ~/.bashrc NORMAL="[033[00m]" YELLOW="[e[1;33m]" __kube_prompt() { # Get current context CONTEXT=$(perl -nE ’print if s/current-context: //;’ ~/.kube/config) if [[ -n "$CONTEXT" ]] then echo "$YELLOW(k8s: ${CONTEXT})$NORMALn" fi } PS1=$(__kube_prompt)’${USER}@${HOSTNAME}:${PWD/$HOME/~}$ ’ Dominique Dumont k8s for beginners
  • 19. MiniKube MiniKube lets you play with kubernetes your laptop. Can use kubernetes console to control your minikube Note: docker commands deal with a docker daemon running in minikube, not with your ”regular” docker daemon Dominique Dumont k8s for beginners