KEMBAR78
Kubernetes101 - Pune Kubernetes Meetup 6 | PPTX
KUBERNETES 101
HANDS ON WORKSHOP
KUBERNETES MEETUP PUNE
10 June 2017
HARSHAL SHAH
Solutions Architect
infraCloud technologies (www.infracloud.io )
https://twitter.com/harshal2623
1st Kubernetes partner India
2nd in APAC region
Rancher partner - APAC
InfraCloud has published a FREE eBook on
“Scaling and deploying Kubernetes”
http://info.rancher.com/deploying-scaling-kubernetes-ebook
TIMELINES
Time (Minutes - total 135) Agenda
00 - 15 Introduction & Setting up
15 - 45 Quick walkthrough of concepts
45 - 75 3 concepts, code & labs - 10 minute each
75 - 80 Break
80 - 110 3 concept, code & labs - 10 min each
110 - 135 Open House
Lab - Setup Kubernetes in GKE & laptop
• GKE Cluster creation
• Kubectl on Google Cloud Console
• Run command “kubectl proxy --port=8080”
• Click this button
• Append “/ui/” as shown in below highlight to
open the Kubernetes Dashboard
● git clone https://github.com/infracloudio/kubernetes-101
TABLE OF CONTAINERS.. ..
• What is Kubernetes, exactly?
• How to setup a Kubernetes Cluster?
• Various ways to get started with a Kubernetes cluster
• Kubernetes Architecture
• Kubernetes Concepts
• POD, Deployments, Services, Labels & Selectors etc.
• Kubectl Usage
• Deploying app with Helm
KUBERNETES - THE BOOKISH DEFINITION
• Kubernetes is an open-source
platform for automating
deployment, scaling, and
operations of application
containers across clusters of
hosts, providing container-
centric infrastructure (From
http://kubernetes.io/docs/whatisk8s/)
Open source project by
Google
Primarily targeted
at containerized
workloads
Platform - automates
deployment, scaling etc.
Abstracts hosts and
underlying
infrastructure from you
Portable - Run on
public/private cloud, data
center, your laptop -
doesn’t matter
Self - healing: It restarts,
replaces, scales, monitors
Containers
Extensible - replace certain
components if you want
to. Extend with pluggable
architecture
KUBERNETES HAS COMMON PATTERNS/DESIGNS
Need to run related
processes together in a
shared context
Integrating with underlying
storage (Block or Bucket
based)
Check health of
applications and maintain
certain number of
instances.
Scale instances based on
triggers.
Load balancing between
multiple instances of a
container
Provide easy and scalable
way to locate and reach
services (Aka service
discovery and naming)
Monitoring and log
management
Tagging and searching
instances dynamically to
do certain operations (For
example list all web servers
across all applications)
Rolling updates, Canary
deployments
Everything is API based- so
can be integrated with
external systems.
SETTING UP KUBERNETES
On Cloud & managed
Google
Container
Engine
StackpointCloud
Tectonic from
CoreOS
OpenShift
Online
DIY - any cloud/data center
Kubeadm
(official utility)
DIY On steroids
KOPS
(Targeted to
AWS)
Kismatic from
Apprenda
Rancher -
provides
enterprise
features, multi
cluster support
Redhat
OpenShift -
comes with
complete
lifecycle
features
Many more: http://kubernetes.io/docs/getting-started-guides
Platform9
KUBERNETES ARCHITECTURE
Image Source: info.rancher.com/deploying-scaling-kubernetes-ebook
POD
• Related containers together
• Share same IP, port space & storage
etc.
• It’s a single unit for all practical
purposes
Code & Demo: Pod - create and destroy
Pod
flask
redis
NFSiSCSIGCE
10.10.1.100
POD - LAB
What just happened?
* Courtesy Julia Evans blog which
is an awesome place to learn many
things http://jvns.ca
Twitter : @b0rk
HEALTHCHECK
Hey, app v1... You
ready?
Kubelet
Pod
app v1
HEALTHCHECK - LAB
DEPLOYMENT
• Drive desired state
• Maintain desired POD instances
• Enable deployment mechanisms
such as rolling deploy, Canary,
pause/resume etc.
Deployment
ReplicaSet
Pod
DEPLOYMENT LAB
ROLLING UPGRADE - DEPLOYMENT LAB
SERVICES
• Provide a fixed endpoint for PODs irrespective of
deletion/movement/modification of POD
• Expose services/endpoints to outside cluster or to world
• Services utilize labels to target PODs to represent
SERVICE TYPES
ExternalName (Kubernetes 1.5 onwards)
• Serves as a way to return an alias to an external service residing outside the cluster.
ClusterIP (Default)
• Exposes service only within cluster
NodePort
• Creates a ClusterIP + exposes the same port on every node/host. This is typically used if
you want to use an external loadBalancer
LoadBalancer
• NodePort+Creates a LB in cloud provider (Such as ELB) and points to respective ports
SERVICES- LAB
LABELS AND SELECTORS
Labels:
“relase”:”1.4”
“environment”:”QA”
“app”:”billing”
Selectors:
env = prod
release in (1.3, 1.4)
app != payment
• Classification mechanism
• Labels
• Tag things
• Think like “roles”
• Selectors
• Filters & conditions
EXAMPLE
Pod
hello
Pod
hello
labels:
version: v1
track: stable
labels:
version: v1
track: test
selector: “version=v1” selector: “track=stable”
Pod
hello
Pod
hello
labels:
version: v1
track: stable
labels:
version: v1
track: test
SECRETS & CONFIG MAPS
• Secrets
• Deliver sensitive data to intended target
• ConfigMap
• Configuration properties
NAMESPACES & NODES
• Namespaces
• Logically separate cluster
• Nodes
• Info about nodes
MORE TYPES
Storage classes for
handling persistent data.
They interact with cloud
provider's storage.
StatefulSet - for
managing clusters with
strong identity
requirements (Kafka,
Elastic, Zookeeper etc.)
DaemonSet - things
which need to run on a
set or all nodes of
cluster. For example
logging agents
Job - ensures a certain
number of PODs execute
the process and upon
completion terminates.
(For batch jobs)
RESOURCES
• The workshop material & codelabs at
https://github.com/GoogleCloudPlatform/kubernetes-
workshops
• http://kubernetesbyexample.com
• http://info.rancher.com/deploying-scaling-kubernetes-
ebook
• Another awesome resource for kubernetes hands on is
from Kamal Marhubi at Part1, Part2, Part3
Scalable Microservices with Kubernetes
https://www.udacity.com/course/scalable-microservices-with-kubernetes--ud615
ধন্যবাদ!
Dank je!
Kiitos!
આભાર!
धन्यवाद!
Grazie!
Je vous remercie!
ありがとうございました
!
ਤੁਹਾਡਾ ਧੰਨਵਾਦ!
நன்றி!
ధన్యవాదాలు!
നന്ദി!
THANK YOU!

Kubernetes101 - Pune Kubernetes Meetup 6

  • 1.
    KUBERNETES 101 HANDS ONWORKSHOP KUBERNETES MEETUP PUNE 10 June 2017
  • 2.
    HARSHAL SHAH Solutions Architect infraCloudtechnologies (www.infracloud.io ) https://twitter.com/harshal2623 1st Kubernetes partner India 2nd in APAC region Rancher partner - APAC
  • 3.
    InfraCloud has publisheda FREE eBook on “Scaling and deploying Kubernetes” http://info.rancher.com/deploying-scaling-kubernetes-ebook
  • 4.
    TIMELINES Time (Minutes -total 135) Agenda 00 - 15 Introduction & Setting up 15 - 45 Quick walkthrough of concepts 45 - 75 3 concepts, code & labs - 10 minute each 75 - 80 Break 80 - 110 3 concept, code & labs - 10 min each 110 - 135 Open House
  • 5.
    Lab - SetupKubernetes in GKE & laptop • GKE Cluster creation • Kubectl on Google Cloud Console • Run command “kubectl proxy --port=8080” • Click this button • Append “/ui/” as shown in below highlight to open the Kubernetes Dashboard ● git clone https://github.com/infracloudio/kubernetes-101
  • 6.
    TABLE OF CONTAINERS.... • What is Kubernetes, exactly? • How to setup a Kubernetes Cluster? • Various ways to get started with a Kubernetes cluster • Kubernetes Architecture • Kubernetes Concepts • POD, Deployments, Services, Labels & Selectors etc. • Kubectl Usage • Deploying app with Helm
  • 7.
    KUBERNETES - THEBOOKISH DEFINITION • Kubernetes is an open-source platform for automating deployment, scaling, and operations of application containers across clusters of hosts, providing container- centric infrastructure (From http://kubernetes.io/docs/whatisk8s/) Open source project by Google Primarily targeted at containerized workloads Platform - automates deployment, scaling etc. Abstracts hosts and underlying infrastructure from you Portable - Run on public/private cloud, data center, your laptop - doesn’t matter Self - healing: It restarts, replaces, scales, monitors Containers Extensible - replace certain components if you want to. Extend with pluggable architecture
  • 8.
    KUBERNETES HAS COMMONPATTERNS/DESIGNS Need to run related processes together in a shared context Integrating with underlying storage (Block or Bucket based) Check health of applications and maintain certain number of instances. Scale instances based on triggers. Load balancing between multiple instances of a container Provide easy and scalable way to locate and reach services (Aka service discovery and naming) Monitoring and log management Tagging and searching instances dynamically to do certain operations (For example list all web servers across all applications) Rolling updates, Canary deployments Everything is API based- so can be integrated with external systems.
  • 9.
    SETTING UP KUBERNETES OnCloud & managed Google Container Engine StackpointCloud Tectonic from CoreOS OpenShift Online DIY - any cloud/data center Kubeadm (official utility) DIY On steroids KOPS (Targeted to AWS) Kismatic from Apprenda Rancher - provides enterprise features, multi cluster support Redhat OpenShift - comes with complete lifecycle features Many more: http://kubernetes.io/docs/getting-started-guides Platform9
  • 10.
    KUBERNETES ARCHITECTURE Image Source:info.rancher.com/deploying-scaling-kubernetes-ebook
  • 11.
    POD • Related containerstogether • Share same IP, port space & storage etc. • It’s a single unit for all practical purposes Code & Demo: Pod - create and destroy Pod flask redis NFSiSCSIGCE 10.10.1.100
  • 12.
  • 13.
    What just happened? *Courtesy Julia Evans blog which is an awesome place to learn many things http://jvns.ca Twitter : @b0rk
  • 14.
    HEALTHCHECK Hey, app v1...You ready? Kubelet Pod app v1
  • 15.
  • 16.
    DEPLOYMENT • Drive desiredstate • Maintain desired POD instances • Enable deployment mechanisms such as rolling deploy, Canary, pause/resume etc. Deployment ReplicaSet Pod
  • 17.
  • 18.
    ROLLING UPGRADE -DEPLOYMENT LAB
  • 19.
    SERVICES • Provide afixed endpoint for PODs irrespective of deletion/movement/modification of POD • Expose services/endpoints to outside cluster or to world • Services utilize labels to target PODs to represent
  • 20.
    SERVICE TYPES ExternalName (Kubernetes1.5 onwards) • Serves as a way to return an alias to an external service residing outside the cluster. ClusterIP (Default) • Exposes service only within cluster NodePort • Creates a ClusterIP + exposes the same port on every node/host. This is typically used if you want to use an external loadBalancer LoadBalancer • NodePort+Creates a LB in cloud provider (Such as ELB) and points to respective ports
  • 21.
  • 22.
    LABELS AND SELECTORS Labels: “relase”:”1.4” “environment”:”QA” “app”:”billing” Selectors: env= prod release in (1.3, 1.4) app != payment • Classification mechanism • Labels • Tag things • Think like “roles” • Selectors • Filters & conditions
  • 23.
    EXAMPLE Pod hello Pod hello labels: version: v1 track: stable labels: version:v1 track: test selector: “version=v1” selector: “track=stable” Pod hello Pod hello labels: version: v1 track: stable labels: version: v1 track: test
  • 24.
    SECRETS & CONFIGMAPS • Secrets • Deliver sensitive data to intended target • ConfigMap • Configuration properties
  • 25.
    NAMESPACES & NODES •Namespaces • Logically separate cluster • Nodes • Info about nodes
  • 26.
    MORE TYPES Storage classesfor handling persistent data. They interact with cloud provider's storage. StatefulSet - for managing clusters with strong identity requirements (Kafka, Elastic, Zookeeper etc.) DaemonSet - things which need to run on a set or all nodes of cluster. For example logging agents Job - ensures a certain number of PODs execute the process and upon completion terminates. (For batch jobs)
  • 27.
    RESOURCES • The workshopmaterial & codelabs at https://github.com/GoogleCloudPlatform/kubernetes- workshops • http://kubernetesbyexample.com • http://info.rancher.com/deploying-scaling-kubernetes- ebook • Another awesome resource for kubernetes hands on is from Kamal Marhubi at Part1, Part2, Part3
  • 28.
    Scalable Microservices withKubernetes https://www.udacity.com/course/scalable-microservices-with-kubernetes--ud615
  • 29.
    ধন্যবাদ! Dank je! Kiitos! આભાર! धन्यवाद! Grazie! Je vousremercie! ありがとうございました ! ਤੁਹਾਡਾ ਧੰਨਵਾਦ! நன்றி! ధన్యవాదాలు! നന്ദി! THANK YOU!