SlideShare ist ein Scribd-Unternehmen logo
1 von 40
Downloaden Sie, um offline zu lesen
Orchestrating Containers
Kubernetes Basics
Eueung Mulyana
http://eueung.github.io/docker-stuff/kubernetes
CodeLabs | Attribution-ShareAlike CC BY-SA
1 / 40
Outline
Kubernetes - Short Introduction
Parts & Components
Getting Started
kubectl run + kubectl expose
2 / 40
Kubernetes
Short Introduction
3 / 40
Kubernetes is an open-source platform for automating
deployment, scaling, and operations of application containers
across clusters of hosts, providing container-centric
infrastructure.
With Kubernetes, you are able to quickly and e ciently respond
to customer demand:
Deploy your applications quickly and predictably.
Scale your applications on the y.
Seamlessly roll out new features.
Optimize use of your hardware by using only the
resources you need
Kubernetes is:
portable: public, private, hybrid, multi-cloud
extensible: modular, pluggable, hookable, composable
self-healing: auto-placement, auto-restart, auto-
replication, auto-scaling
Ref: kubernetes.io
4 / 40
What is Kubernetes?
The name Kubernetes originates from Greek, meaning
"helmsman" or "pilot", and is the root of "governor" and
"cybernetic".
K8s is an abbreviation derived by replacing the 8 letters
"ubernete" with 8.
With Kubernetes you can deploy a full cluster of multi-tiered
containers (frontend, backend, etc.) with a single
con guration le and a single command (Ref).
Kubernetes
Container orchestrator
Runs and manages containers
Supports multiple cloud and bare-metal environments
Inspired and informed by Google's experiences and
internal systems
100% Open source, written in Go
Manage applications, not machines
Ref: Kubernetes Intro and Update @thockin
5 / 40
6 / 40
Architecture
A running Kubernetes cluster
contains node agents (kubelet)
and master components
(apiserver, scheduler, etc), on
top of a distributed storage
solution.
7 / 40
K8s Node
Worker / Minion
The Kubernetes node has the
services necessary to run
application containers and be
managed from the master
systems.
Each node runs container engine
e.g. Docker. This engine takes
care of the details of
downloading images and
running containers.
kubelet
kube-proxy
8 / 40
K8s Node
kubelet
The kubelet manages pods and
their containers, their images,
their volumes, etc.
kube-proxy
Each node also runs a simple
network proxy and load
balancer. This re ects services as
de ned in the Kubernetes API
(apiserver) on each node and
can do simple TCP and UDP
stream forwarding (round robin)
across a set of backends.
9 / 40
K8s Master
Control Plane
The Kubernetes control plane is
split into a set of components.
Currently they all run on a single
master node. These components
work together to provide a
uni ed view of the cluster.
etcd
All persistent master state is
stored in an instance of etcd.
This provides a great way to
store con guration data reliably.
With watch support,
coordinating components can be
noti ed very quickly of changes.
10 / 40
K8s Master
etcd
API Server
The apiserver serves up the Kubernetes API. It
is intended to be a CRUD-y server, with
most/all business logic implemented in
separate components or in plug-ins. It mainly
processes REST operations, validates them,
and updates the corresponding objects in etcd
(and eventually other stores).
11 / 40
Scheduler
The scheduler binds unscheduled pods to
nodes via the /binding API. The scheduler is
pluggable, support for multiple cluster
schedulers and user-provided schedulers in
the plan.
Controller Manager
All other cluster-level functions are currently
performed by the Controller Manager.
For instance, Endpoints objects are created
and updated by the endpoints controller, and
nodes are discovered, managed, and
monitored by the node controller. These could
eventually be split into separate components
to make them independently pluggable. The
replicationcontroller is a mechanism that is
layered on top of the simple pod API.
Kubernetes
Parts & Components
12 / 40
13 / 40
Containers
Base Asset
14 / 40
Containers
Pods
A pod is a co-located group of
containers ...
15 / 40
Containers
Pods
Pods with Volumes
A pod is a co-located group of
containers and volumes.
A volume is a directory, possibly
with some data in it, which is
accessible to a Container as part of
its lesystem.
Kubernetes volumes build upon
Docker Volumes, adding
provisioning of the volume directory
and/or device.
16 / 40
Containers
Pods
Pods with Volumes
Labels
A label is a key/value pair that is
attached to a resource, such as a
pod, to convey a user-de ned
identifying attribute.
Labels can be used to organize and
to select subsets of resources.
17 / 40
Containers
Pods
Pods with Volumes
Labels
Replication Controllers
A replication controller ensures that
a speci ed number of pod replicas
are running at any one time.
It both allows for easy scaling of
replicated systems and handles re-
creation of a pod when the
machine it is on reboots or
otherwise fails.
18 / 40
Containers
Pods
Pods with Volumes
Labels
Replication Controllers
Creating labeled pods with a
(labeled) RC
19 / 40
Containers
Pods
Pods with Volumes
Labels
Replication Controllers
Services
Services & labeled Services
A service de nes a set of pods and
a means by which to access them,
such as single stable IP address and
corresponding DNS name.
20 / 40
Containers
Pods
Pods with Volumes
Labels
Replication Controllers
Services
Kubernetes
Getting Started
21 / 40
22 / 40
node1 RPI 3
192.168.1.102
node2 RPI 2
192.168.1.101
node3 RPI 2
192.168.1.100
23 / 40
kubernetes-on-arm v0.7.0
by @luxas
$dpkg-ikube-systemd.deb
$kube-configinstall
#rpiorrpi-2,hypriotos
$gzip-dcimages.tar.gz|dockerload
$kube-configinfo
Architecture:armv7l
Kernel:Linux4.1.17
CPU:4coresx1200MHz
UsedRAMMemory:111MiB-RAMMemory:925MiB
Useddiskspace:2.4GB(2424044KB)
Freediskspace:11GB(11382472KB)
SDCard/debpackagewasbuilt:21-03-201621:06
kubernetes-on-arm: Latestcommit:1d0bbe1-Version:0.7.0
systemdversion:v215
dockerversion:v1.10.3
kubernetesclientversion:v1.2.0
24 / 40
$dockerimages
REPOSITORY TAG IMAGEID CREATED
kubernetesonarm/etcd 0.7.0 3550c0c4f205 8weeksago
kubernetesonarm/etcd latest 3550c0c4f205 8weeksago
kubernetesonarm/grafana 0.7.0 8ea26f4ef5a3 8weeksago
kubernetesonarm/grafana latest 8ea26f4ef5a3 8weeksago
kubernetesonarm/influxdb 0.7.0 447951a687c6 8weeksago
kubernetesonarm/influxdb latest 447951a687c6 8weeksago
kubernetesonarm/heapster 0.7.0 1d034674fc0e 8weeksago
kubernetesonarm/heapster latest 1d034674fc0e 8weeksago
kubernetesonarm/loadbalancer 0.7.0 6b262f2fd318 8weeksago
kubernetesonarm/loadbalancer latest 6b262f2fd318 8weeksago
kubernetesonarm/registry 0.7.0 4c9c964f89e9 8weeksago
kubernetesonarm/registry latest 4c9c964f89e9 8weeksago
kubernetesonarm/exechealthz 0.7.0 57f77542ac5c 8weeksago
kubernetesonarm/exechealthz latest 57f77542ac5c 8weeksago
kubernetesonarm/kube2sky 0.7.0 770cccac4236 8weeksago
kubernetesonarm/kube2sky latest 770cccac4236 8weeksago
kubernetesonarm/skydns 0.7.0 30ea4958f939 8weeksago
kubernetesonarm/skydns latest 30ea4958f939 8weeksago
kubernetesonarm/pause 0.7.0 05edc969256e 8weeksago
kubernetesonarm/pause latest 05edc969256e 8weeksago
kubernetesonarm/hyperkube 0.7.0 380def049467 8weeksago
kubernetesonarm/hyperkube latest 380def049467 8weeksago
kubernetesonarm/flannel 0.7.0 8a35c629399f 8weeksago
kubernetesonarm/flannel latest 8a35c629399f 8weeksago
hypriot/rpi-swarm latest c298de062190 10weeksago
$kube-configenable-master
Disablingk8sifitisrunning
Checkssoallimagesarepresent
Transferringimagestosystem-docker,ifnecessary
Copyingkubernetesonarm/etcdtosystem-docker
...
Kubernetesmasterservicesenabled
$dockerps
CONTAINERID IMAGE COMMAND CREATED
7bf736d84451 kubernetesonarm/hyperkube "/hyperkubecontrolle" 2minutesago
5560f06bcf47 kubernetesonarm/hyperkube "/hyperkubeproxy--m" 2minutesago
0fb169567946 kubernetesonarm/hyperkube "/hyperkubescheduler" 2minutesago
11c03a40412c kubernetesonarm/hyperkube "/hyperkubeapiserver" 2minutesago
ede858b35dfa kubernetesonarm/pause "/pause" 2minutesago
5e38dac4fd19 kubernetesonarm/hyperkube "/hyperkubekubelet-" 3minutesago
25 / 40
Master
$kube-configenable-worker192.168.1.102
Disablingk8sifitisrunning
Usingmasterip:192.168.1.102
Checkssoallimagesarepresent
Transferringimagestosystem-docker,ifnecessary
Copyingkubernetesonarm/flanneltosystem-docker
Createdsymlinkfrom/etc/systemd/system/multi-user.target.wants/flannel.serviceto/u
Startingworkercomponentsindockercontainers
Createdsymlinkfrom/etc/systemd/system/multi-user.target.wants/k8s-worker.serviceto
Kubernetesworkerservicesenabled
26 / 40
Worker
$kubectlgetnodes
NAME STATUS AGE
192.168.1.100 Ready 26s
192.168.1.101 Ready 7m
192.168.1.102 Ready 4h
$kubectlcluster-info
Kubernetesmasterisrunningathttp://localhost:8080
27 / 40
Check
$kubectlrunmy-nginx--image=luxas/nginx-test --replicas=3--expose--port=80
service"my-nginx"created
deployment"my-nginx"created
$kubectlgetpods
NAME READY STATUS RESTARTS AGE
k8s-master-192.168.1.102 4/4 Running 1 5h
my-nginx-3795026575-9w8mw 0/1 ContainerCreating 0 14s
my-nginx-3795026575-miz3d 0/1 ContainerCreating 0 14s
my-nginx-3795026575-zy2d4 0/1 ContainerCreating 0 14s
$kubectlgetsvc
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes 10.0.0.1 <none> 443/TCP 5h
my-nginx 10.0.0.129 <none> 80/TCP 36s
$kubectlgetdeployments
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
my-nginx 3 3 3 1 1m
$curl10.0.0.129
<p>WELCOMETONGINX</p>
28 / 40
Test #1
$kubectlrunhello-kube--image=hypriot/rpi-nano-httpd --port=80
deployment"hello-kube"created
$kubectlexposedeploymenthello-kube--type="LoadBalancer"--external-ip="192.168.1.
service"hello-kube"exposed
$kubectlgetpods-owide
NAME READY STATUS RESTARTS AGE NODE
hello-kube-1079346743-2knj3 0/1 ImagePullBackOff 0 55s 192.16
k8s-master-192.168.1.102 4/4 Running 1 8h 192.16
$kubectlgetdeployments
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
hello-kube 1 1 1 1 1m
$kubectlgetpods-owide
NAME READY STATUS RESTARTS AGE NODE
hello-kube-1079346743-2knj3 1/1 Running 0 1m 192.168.1.100
k8s-master-192.168.1.102 4/4 Running 1 8h 192.168.1.102
$kubectlgetsvc
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello-kube 10.0.0.197 ,192.168.1.102 80/TCP 44s
kubernetes 10.0.0.1 <none> 443/TCP 8h
$curl10.0.0.197
<html><head><title>PiarmedwithDockerbyHypriot</title>
<bodystyle="width:100%;background-color:black;">
<divid="main"style="margin:100pxauto0auto;width:800px;">
<imgsrc="pi_armed_with_docker.jpg"alt="piarmedwithdocker"style="width:800
</div>
</body></html>
29 / 40
Test #2
$kubectlrunhello-kube--image=hypriot/rpi-nano-httpd --replicas=2--port=80
deployment"hello-kube"created
$kubectlexposedeploymenthello-kube--type="LoadBalancer"--external-ip="192.168.1.
service"hello-kube"exposed
$kubectlgetsvc
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello-kube 10.0.0.221 ,192.168.1.102 80/TCP 10s
kubernetes 10.0.0.1 <none> 443/TCP 8h
$kubectlgetpods-owide
NAME READY STATUS RESTARTS AGE NODE
hello-kube-1079346743-44yig 1/1 Running 0 1m 192.168.1.100
hello-kube-1079346743-upzxy 1/1 Running 0 1m 192.168.1.101
k8s-master-192.168.1.102 4/4 Running 1 8h 192.168.1.102
$curl10.0.0.221
$curl192.168.1.102
<html><head><title>PiarmedwithDockerbyHypriot</title>
<bodystyle="width:100%;background-color:black;">
<divid="main"style="margin:100pxauto0auto;width:800px;">
<imgsrc="pi_armed_with_docker.jpg"alt="piarmedwithdocker"style="width:800
</div>
</body></html>
30 / 40
Test #3
$kubectlrunhello-kube--image=hypriot/rpi-nano-httpd --replicas=3--port=80
deployment"hello-kube"created
$kubectlexposedeploymenthello-kube--port=8300--target-port=80--type="LoadBalanc
service"hello-kube"exposed
$kubectlgetsvc
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello-kube 10.0.0.124 ,192.168.1.102 8300/TCP 8s
kubernetes 10.0.0.1 <none> 443/TCP 7h
$kubectldeleteservice,deploymenthello-kube
31 / 40
Test #4
kubectl run + kubectl expose
32 / 40
33 / 40
34 / 40
35 / 40
36 / 40
37 / 40
Refs
38 / 40
Refs
1. Tim Hockin, Kubernetes: One Year Later
2. Ray Tsang @saturnism, Kubernetes with Java-based Microservices
3. Stefan Schimanski, Kubernetes Architecture & Introduction
4. @luxas - kubernetes-on-arm
5. Daniel Smith, What's new in Kubernetes
6. Kubernetes - What is Kubernetes?
7. Kubernetes - User Guide
8. Learn the Kubernetes Key Concepts
9. Kubernetes Intro and Update @thockin
10. kubernetes/architecture.md at release-1.2 - kubernetes/kubernetes
11. Kubernetes - User Guide
12. An Introduction to Kubernetes
39 / 40
END
Eueung Mulyana
http://eueung.github.io/docker-stuff/kubernetes
CodeLabs | Attribution-ShareAlike CC BY-SA
40 / 40

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

(Draft) Kubernetes - A Comprehensive Overview
(Draft) Kubernetes - A Comprehensive Overview(Draft) Kubernetes - A Comprehensive Overview
(Draft) Kubernetes - A Comprehensive Overview
 
Kubernetes - introduction
Kubernetes - introductionKubernetes - introduction
Kubernetes - introduction
 
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
 
Kubernetes Concepts And Architecture Powerpoint Presentation Slides
Kubernetes Concepts And Architecture Powerpoint Presentation SlidesKubernetes Concepts And Architecture Powerpoint Presentation Slides
Kubernetes Concepts And Architecture Powerpoint Presentation Slides
 
Kubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory GuideKubernetes for Beginners: An Introductory Guide
Kubernetes for Beginners: An Introductory Guide
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes Introduction
 
DevOps with Kubernetes
DevOps with KubernetesDevOps with Kubernetes
DevOps with Kubernetes
 
A brief study on Kubernetes and its components
A brief study on Kubernetes and its componentsA brief study on Kubernetes and its components
A brief study on Kubernetes and its components
 
Getting Started with Kubernetes
Getting Started with Kubernetes Getting Started with Kubernetes
Getting Started with Kubernetes
 
An Introduction to Kubernetes
An Introduction to KubernetesAn Introduction to Kubernetes
An Introduction to Kubernetes
 
Kubernetes Basics
Kubernetes BasicsKubernetes Basics
Kubernetes Basics
 
01. Kubernetes-PPT.pptx
01. Kubernetes-PPT.pptx01. Kubernetes-PPT.pptx
01. Kubernetes-PPT.pptx
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes Introduction
 
Kubernetes 101
Kubernetes 101Kubernetes 101
Kubernetes 101
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
 
Introduction to kubernetes
Introduction to kubernetesIntroduction to kubernetes
Introduction to kubernetes
 
Docker & kubernetes
Docker & kubernetesDocker & kubernetes
Docker & kubernetes
 
Kubernetes Architecture
 Kubernetes Architecture Kubernetes Architecture
Kubernetes Architecture
 
Kubernetes Networking
Kubernetes NetworkingKubernetes Networking
Kubernetes Networking
 
Kubernetes architecture
Kubernetes architectureKubernetes architecture
Kubernetes architecture
 

Andere mochten auch

Andere mochten auch (6)

Scaling Docker with Kubernetes
Scaling Docker with KubernetesScaling Docker with Kubernetes
Scaling Docker with Kubernetes
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to 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 for beginners
kubernetes for beginnerskubernetes for beginners
kubernetes for beginners
 
Kubernetes Architecture and Introduction
Kubernetes Architecture and IntroductionKubernetes Architecture and Introduction
Kubernetes Architecture and Introduction
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
 

Ähnlich wie Kubernetes Basics

Ähnlich wie Kubernetes Basics (20)

Kubernetes for Java developers
Kubernetes for Java developersKubernetes for Java developers
Kubernetes for Java developers
 
Kubernetes 101 for Beginners
Kubernetes 101 for BeginnersKubernetes 101 for Beginners
Kubernetes 101 for Beginners
 
Dev opsec dockerimage_patch_n_lifecyclemanagement_
Dev opsec dockerimage_patch_n_lifecyclemanagement_Dev opsec dockerimage_patch_n_lifecyclemanagement_
Dev opsec dockerimage_patch_n_lifecyclemanagement_
 
Getting started with google kubernetes engine
Getting started with google kubernetes engineGetting started with google kubernetes engine
Getting started with google kubernetes engine
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
The State of Linux Containers
The State of Linux ContainersThe State of Linux Containers
The State of Linux Containers
 
Kubernetes From Scratch .pdf
Kubernetes From Scratch .pdfKubernetes From Scratch .pdf
Kubernetes From Scratch .pdf
 
Kubernetes Architecture with Components
 Kubernetes Architecture with Components Kubernetes Architecture with Components
Kubernetes Architecture with Components
 
Container Orchestration using kubernetes
Container Orchestration using kubernetesContainer Orchestration using kubernetes
Container Orchestration using kubernetes
 
Containers and Kubernetes -Notes Leo
Containers and Kubernetes -Notes LeoContainers and Kubernetes -Notes Leo
Containers and Kubernetes -Notes Leo
 
Kubernetes Basics
Kubernetes BasicsKubernetes Basics
Kubernetes Basics
 
Kubernetes extensibility
Kubernetes extensibilityKubernetes extensibility
Kubernetes extensibility
 
DevJam 2019 - Introduction to Kubernetes
DevJam 2019 - Introduction to KubernetesDevJam 2019 - Introduction to Kubernetes
DevJam 2019 - Introduction to Kubernetes
 
Kubernetes fundamentals
Kubernetes fundamentalsKubernetes fundamentals
Kubernetes fundamentals
 
Dessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloudDessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloud
 
Come costruire una Platform As A Service con Docker, Kubernetes Go e Java
Come costruire una Platform As A Service con Docker, Kubernetes Go e JavaCome costruire una Platform As A Service con Docker, Kubernetes Go e Java
Come costruire una Platform As A Service con Docker, Kubernetes Go e Java
 
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
 
Container & kubernetes
Container & kubernetesContainer & kubernetes
Container & kubernetes
 
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 !
 
Intro to Kubernetes
Intro to KubernetesIntro to Kubernetes
Intro to Kubernetes
 

Mehr von Eueung Mulyana

Mehr von Eueung Mulyana (20)

FGD Big Data
FGD Big DataFGD Big Data
FGD Big Data
 
Hyper-Connectivity and Data Proliferation - Ecosystem Perspective
Hyper-Connectivity and Data Proliferation - Ecosystem PerspectiveHyper-Connectivity and Data Proliferation - Ecosystem Perspective
Hyper-Connectivity and Data Proliferation - Ecosystem Perspective
 
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated WorldIndustry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
 
Blockchain Introduction
Blockchain IntroductionBlockchain Introduction
Blockchain Introduction
 
Bringing Automation to the Classroom: A ChatOps-Based Approach
Bringing Automation to the Classroom: A ChatOps-Based ApproachBringing Automation to the Classroom: A ChatOps-Based Approach
Bringing Automation to the Classroom: A ChatOps-Based Approach
 
FinTech & Cryptocurrency Introduction
FinTech & Cryptocurrency IntroductionFinTech & Cryptocurrency Introduction
FinTech & Cryptocurrency Introduction
 
Open Source Networking Overview
Open Source Networking OverviewOpen Source Networking Overview
Open Source Networking Overview
 
ONOS SDN Controller - Clustering Tests & Experiments
ONOS SDN Controller - Clustering Tests & Experiments ONOS SDN Controller - Clustering Tests & Experiments
ONOS SDN Controller - Clustering Tests & Experiments
 
Open stack pike-devstack-tutorial
Open stack pike-devstack-tutorialOpen stack pike-devstack-tutorial
Open stack pike-devstack-tutorial
 
Basic onos-tutorial
Basic onos-tutorialBasic onos-tutorial
Basic onos-tutorial
 
ONOS SDN Controller - Introduction
ONOS SDN Controller - IntroductionONOS SDN Controller - Introduction
ONOS SDN Controller - Introduction
 
OpenDaylight SDN Controller - Introduction
OpenDaylight SDN Controller - IntroductionOpenDaylight SDN Controller - Introduction
OpenDaylight SDN Controller - Introduction
 
Mininet Basics
Mininet BasicsMininet Basics
Mininet Basics
 
Android Programming Basics
Android Programming BasicsAndroid Programming Basics
Android Programming Basics
 
Cloud Computing: Overview and Examples
Cloud Computing: Overview and ExamplesCloud Computing: Overview and Examples
Cloud Computing: Overview and Examples
 
selected input/output - sensors and actuators
selected input/output - sensors and actuatorsselected input/output - sensors and actuators
selected input/output - sensors and actuators
 
Connected Things, IoT and 5G
Connected Things, IoT and 5GConnected Things, IoT and 5G
Connected Things, IoT and 5G
 
Connectivity for Local Sensors and Actuators Using nRF24L01+
Connectivity for Local Sensors and Actuators Using nRF24L01+Connectivity for Local Sensors and Actuators Using nRF24L01+
Connectivity for Local Sensors and Actuators Using nRF24L01+
 
NodeMCU with Blynk and Firebase
NodeMCU with Blynk and FirebaseNodeMCU with Blynk and Firebase
NodeMCU with Blynk and Firebase
 
Trends and Enablers - Connected Services and Cloud Computing
Trends and Enablers  - Connected Services and Cloud ComputingTrends and Enablers  - Connected Services and Cloud Computing
Trends and Enablers - Connected Services and Cloud Computing
 

Kürzlich hochgeladen

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Kürzlich hochgeladen (20)

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Kubernetes Basics

  • 1. Orchestrating Containers Kubernetes Basics Eueung Mulyana http://eueung.github.io/docker-stuff/kubernetes CodeLabs | Attribution-ShareAlike CC BY-SA 1 / 40
  • 2. Outline Kubernetes - Short Introduction Parts & Components Getting Started kubectl run + kubectl expose 2 / 40
  • 4. Kubernetes is an open-source platform for automating deployment, scaling, and operations of application containers across clusters of hosts, providing container-centric infrastructure. With Kubernetes, you are able to quickly and e ciently respond to customer demand: Deploy your applications quickly and predictably. Scale your applications on the y. Seamlessly roll out new features. Optimize use of your hardware by using only the resources you need Kubernetes is: portable: public, private, hybrid, multi-cloud extensible: modular, pluggable, hookable, composable self-healing: auto-placement, auto-restart, auto- replication, auto-scaling Ref: kubernetes.io 4 / 40 What is Kubernetes? The name Kubernetes originates from Greek, meaning "helmsman" or "pilot", and is the root of "governor" and "cybernetic". K8s is an abbreviation derived by replacing the 8 letters "ubernete" with 8. With Kubernetes you can deploy a full cluster of multi-tiered containers (frontend, backend, etc.) with a single con guration le and a single command (Ref).
  • 5. Kubernetes Container orchestrator Runs and manages containers Supports multiple cloud and bare-metal environments Inspired and informed by Google's experiences and internal systems 100% Open source, written in Go Manage applications, not machines Ref: Kubernetes Intro and Update @thockin 5 / 40
  • 6. 6 / 40 Architecture A running Kubernetes cluster contains node agents (kubelet) and master components (apiserver, scheduler, etc), on top of a distributed storage solution.
  • 7. 7 / 40 K8s Node Worker / Minion The Kubernetes node has the services necessary to run application containers and be managed from the master systems. Each node runs container engine e.g. Docker. This engine takes care of the details of downloading images and running containers. kubelet kube-proxy
  • 8. 8 / 40 K8s Node kubelet The kubelet manages pods and their containers, their images, their volumes, etc. kube-proxy Each node also runs a simple network proxy and load balancer. This re ects services as de ned in the Kubernetes API (apiserver) on each node and can do simple TCP and UDP stream forwarding (round robin) across a set of backends.
  • 9. 9 / 40 K8s Master Control Plane The Kubernetes control plane is split into a set of components. Currently they all run on a single master node. These components work together to provide a uni ed view of the cluster. etcd All persistent master state is stored in an instance of etcd. This provides a great way to store con guration data reliably. With watch support, coordinating components can be noti ed very quickly of changes.
  • 10. 10 / 40 K8s Master etcd API Server The apiserver serves up the Kubernetes API. It is intended to be a CRUD-y server, with most/all business logic implemented in separate components or in plug-ins. It mainly processes REST operations, validates them, and updates the corresponding objects in etcd (and eventually other stores).
  • 11. 11 / 40 Scheduler The scheduler binds unscheduled pods to nodes via the /binding API. The scheduler is pluggable, support for multiple cluster schedulers and user-provided schedulers in the plan. Controller Manager All other cluster-level functions are currently performed by the Controller Manager. For instance, Endpoints objects are created and updated by the endpoints controller, and nodes are discovered, managed, and monitored by the node controller. These could eventually be split into separate components to make them independently pluggable. The replicationcontroller is a mechanism that is layered on top of the simple pod API.
  • 14. 14 / 40 Containers Pods A pod is a co-located group of containers ...
  • 15. 15 / 40 Containers Pods Pods with Volumes A pod is a co-located group of containers and volumes. A volume is a directory, possibly with some data in it, which is accessible to a Container as part of its lesystem. Kubernetes volumes build upon Docker Volumes, adding provisioning of the volume directory and/or device.
  • 16. 16 / 40 Containers Pods Pods with Volumes Labels A label is a key/value pair that is attached to a resource, such as a pod, to convey a user-de ned identifying attribute. Labels can be used to organize and to select subsets of resources.
  • 17. 17 / 40 Containers Pods Pods with Volumes Labels Replication Controllers A replication controller ensures that a speci ed number of pod replicas are running at any one time. It both allows for easy scaling of replicated systems and handles re- creation of a pod when the machine it is on reboots or otherwise fails.
  • 18. 18 / 40 Containers Pods Pods with Volumes Labels Replication Controllers Creating labeled pods with a (labeled) RC
  • 19. 19 / 40 Containers Pods Pods with Volumes Labels Replication Controllers Services Services & labeled Services A service de nes a set of pods and a means by which to access them, such as single stable IP address and corresponding DNS name.
  • 20. 20 / 40 Containers Pods Pods with Volumes Labels Replication Controllers Services
  • 22. 22 / 40 node1 RPI 3 192.168.1.102 node2 RPI 2 192.168.1.101 node3 RPI 2 192.168.1.100
  • 23. 23 / 40 kubernetes-on-arm v0.7.0 by @luxas $dpkg-ikube-systemd.deb $kube-configinstall #rpiorrpi-2,hypriotos $gzip-dcimages.tar.gz|dockerload $kube-configinfo Architecture:armv7l Kernel:Linux4.1.17 CPU:4coresx1200MHz UsedRAMMemory:111MiB-RAMMemory:925MiB Useddiskspace:2.4GB(2424044KB) Freediskspace:11GB(11382472KB) SDCard/debpackagewasbuilt:21-03-201621:06 kubernetes-on-arm: Latestcommit:1d0bbe1-Version:0.7.0 systemdversion:v215 dockerversion:v1.10.3 kubernetesclientversion:v1.2.0
  • 24. 24 / 40 $dockerimages REPOSITORY TAG IMAGEID CREATED kubernetesonarm/etcd 0.7.0 3550c0c4f205 8weeksago kubernetesonarm/etcd latest 3550c0c4f205 8weeksago kubernetesonarm/grafana 0.7.0 8ea26f4ef5a3 8weeksago kubernetesonarm/grafana latest 8ea26f4ef5a3 8weeksago kubernetesonarm/influxdb 0.7.0 447951a687c6 8weeksago kubernetesonarm/influxdb latest 447951a687c6 8weeksago kubernetesonarm/heapster 0.7.0 1d034674fc0e 8weeksago kubernetesonarm/heapster latest 1d034674fc0e 8weeksago kubernetesonarm/loadbalancer 0.7.0 6b262f2fd318 8weeksago kubernetesonarm/loadbalancer latest 6b262f2fd318 8weeksago kubernetesonarm/registry 0.7.0 4c9c964f89e9 8weeksago kubernetesonarm/registry latest 4c9c964f89e9 8weeksago kubernetesonarm/exechealthz 0.7.0 57f77542ac5c 8weeksago kubernetesonarm/exechealthz latest 57f77542ac5c 8weeksago kubernetesonarm/kube2sky 0.7.0 770cccac4236 8weeksago kubernetesonarm/kube2sky latest 770cccac4236 8weeksago kubernetesonarm/skydns 0.7.0 30ea4958f939 8weeksago kubernetesonarm/skydns latest 30ea4958f939 8weeksago kubernetesonarm/pause 0.7.0 05edc969256e 8weeksago kubernetesonarm/pause latest 05edc969256e 8weeksago kubernetesonarm/hyperkube 0.7.0 380def049467 8weeksago kubernetesonarm/hyperkube latest 380def049467 8weeksago kubernetesonarm/flannel 0.7.0 8a35c629399f 8weeksago kubernetesonarm/flannel latest 8a35c629399f 8weeksago hypriot/rpi-swarm latest c298de062190 10weeksago
  • 25. $kube-configenable-master Disablingk8sifitisrunning Checkssoallimagesarepresent Transferringimagestosystem-docker,ifnecessary Copyingkubernetesonarm/etcdtosystem-docker ... Kubernetesmasterservicesenabled $dockerps CONTAINERID IMAGE COMMAND CREATED 7bf736d84451 kubernetesonarm/hyperkube "/hyperkubecontrolle" 2minutesago 5560f06bcf47 kubernetesonarm/hyperkube "/hyperkubeproxy--m" 2minutesago 0fb169567946 kubernetesonarm/hyperkube "/hyperkubescheduler" 2minutesago 11c03a40412c kubernetesonarm/hyperkube "/hyperkubeapiserver" 2minutesago ede858b35dfa kubernetesonarm/pause "/pause" 2minutesago 5e38dac4fd19 kubernetesonarm/hyperkube "/hyperkubekubelet-" 3minutesago 25 / 40 Master
  • 27. $kubectlgetnodes NAME STATUS AGE 192.168.1.100 Ready 26s 192.168.1.101 Ready 7m 192.168.1.102 Ready 4h $kubectlcluster-info Kubernetesmasterisrunningathttp://localhost:8080 27 / 40 Check
  • 28. $kubectlrunmy-nginx--image=luxas/nginx-test --replicas=3--expose--port=80 service"my-nginx"created deployment"my-nginx"created $kubectlgetpods NAME READY STATUS RESTARTS AGE k8s-master-192.168.1.102 4/4 Running 1 5h my-nginx-3795026575-9w8mw 0/1 ContainerCreating 0 14s my-nginx-3795026575-miz3d 0/1 ContainerCreating 0 14s my-nginx-3795026575-zy2d4 0/1 ContainerCreating 0 14s $kubectlgetsvc NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes 10.0.0.1 <none> 443/TCP 5h my-nginx 10.0.0.129 <none> 80/TCP 36s $kubectlgetdeployments NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE my-nginx 3 3 3 1 1m $curl10.0.0.129 <p>WELCOMETONGINX</p> 28 / 40 Test #1
  • 29. $kubectlrunhello-kube--image=hypriot/rpi-nano-httpd --port=80 deployment"hello-kube"created $kubectlexposedeploymenthello-kube--type="LoadBalancer"--external-ip="192.168.1. service"hello-kube"exposed $kubectlgetpods-owide NAME READY STATUS RESTARTS AGE NODE hello-kube-1079346743-2knj3 0/1 ImagePullBackOff 0 55s 192.16 k8s-master-192.168.1.102 4/4 Running 1 8h 192.16 $kubectlgetdeployments NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE hello-kube 1 1 1 1 1m $kubectlgetpods-owide NAME READY STATUS RESTARTS AGE NODE hello-kube-1079346743-2knj3 1/1 Running 0 1m 192.168.1.100 k8s-master-192.168.1.102 4/4 Running 1 8h 192.168.1.102 $kubectlgetsvc NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE hello-kube 10.0.0.197 ,192.168.1.102 80/TCP 44s kubernetes 10.0.0.1 <none> 443/TCP 8h $curl10.0.0.197 <html><head><title>PiarmedwithDockerbyHypriot</title> <bodystyle="width:100%;background-color:black;"> <divid="main"style="margin:100pxauto0auto;width:800px;"> <imgsrc="pi_armed_with_docker.jpg"alt="piarmedwithdocker"style="width:800 </div> </body></html> 29 / 40 Test #2
  • 30. $kubectlrunhello-kube--image=hypriot/rpi-nano-httpd --replicas=2--port=80 deployment"hello-kube"created $kubectlexposedeploymenthello-kube--type="LoadBalancer"--external-ip="192.168.1. service"hello-kube"exposed $kubectlgetsvc NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE hello-kube 10.0.0.221 ,192.168.1.102 80/TCP 10s kubernetes 10.0.0.1 <none> 443/TCP 8h $kubectlgetpods-owide NAME READY STATUS RESTARTS AGE NODE hello-kube-1079346743-44yig 1/1 Running 0 1m 192.168.1.100 hello-kube-1079346743-upzxy 1/1 Running 0 1m 192.168.1.101 k8s-master-192.168.1.102 4/4 Running 1 8h 192.168.1.102 $curl10.0.0.221 $curl192.168.1.102 <html><head><title>PiarmedwithDockerbyHypriot</title> <bodystyle="width:100%;background-color:black;"> <divid="main"style="margin:100pxauto0auto;width:800px;"> <imgsrc="pi_armed_with_docker.jpg"alt="piarmedwithdocker"style="width:800 </div> </body></html> 30 / 40 Test #3
  • 31. $kubectlrunhello-kube--image=hypriot/rpi-nano-httpd --replicas=3--port=80 deployment"hello-kube"created $kubectlexposedeploymenthello-kube--port=8300--target-port=80--type="LoadBalanc service"hello-kube"exposed $kubectlgetsvc NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE hello-kube 10.0.0.124 ,192.168.1.102 8300/TCP 8s kubernetes 10.0.0.1 <none> 443/TCP 7h $kubectldeleteservice,deploymenthello-kube 31 / 40 Test #4
  • 32. kubectl run + kubectl expose 32 / 40
  • 39. Refs 1. Tim Hockin, Kubernetes: One Year Later 2. Ray Tsang @saturnism, Kubernetes with Java-based Microservices 3. Stefan Schimanski, Kubernetes Architecture & Introduction 4. @luxas - kubernetes-on-arm 5. Daniel Smith, What's new in Kubernetes 6. Kubernetes - What is Kubernetes? 7. Kubernetes - User Guide 8. Learn the Kubernetes Key Concepts 9. Kubernetes Intro and Update @thockin 10. kubernetes/architecture.md at release-1.2 - kubernetes/kubernetes 11. Kubernetes - User Guide 12. An Introduction to Kubernetes 39 / 40