27
Introduction to Kubernetes (k8) Tomislav Mikulin DevOps

Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

  • Upload
    others

  • View
    28

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

Introduction to Kubernetes (k8)

Tomislav Mikulin DevOps

Page 2: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

Word of caution

Page 3: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

What is kubernetes?

Formal definition:

“Kubernetes is an open source system for automating deployment, scaling and management of containerized applications”

Kubernetes documentation

Page 4: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

What is kubernetes?

Unformal definition:

“Kubernetes is like having a little devops in a cluster that takes care of you’re applications and makes sure that everything is up and running.”

Kelsey Hightower (Google)

Page 5: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

Packaging applications

Containers (Docker)

Two main benefits:

• They make shipping and deploying apps a lot easier!

• They bundle all the apps dependencies in a single image

Page 6: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

Packaging applications

Docker - like mobile apps on a smartphone, but for servers

Page 7: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

Docker deployment

Page 8: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

Now what?

Page 9: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

Why do we need k8?

• Real issues are:

• Application configuration

• Service discovery

• Managing updates

• Monitoring

• Deployment…

Page 10: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

Why is k8 special?

• Github (37,578 )

• 1693 contributors

Backed up by :

• Google, RedHat, CoreOS, Cloud Native Computing Foundation

• Cloud providers AWS, GCLOUD, AZURE

• 10/15 years of R&D in Google (Borg, Omega)

Page 11: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

k8 features

• Horizontal scaling

• Automated rollouts and rollbacks

• Self healing

• Service discovery and load balancing

• Secret and configuration management

• Better server utilization (less money goes to aws)

Page 12: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

Abstracts the hardware layer

LoadBalancers | Routes | DNS

Kubernetes Application

Storage Machine Network

EBS NFS GFS VM PHYSICAL L2 L3

Infrastructure

Page 13: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

k8 architecture

Kubernetes Master

KUBE - API SERVER

ETCDScheduler

Controller Manager

Kube-proxy

Kubelet

POD

Container

Kube-proxy

Kubelet

POD

Container

Node Node

Cloud

Cloud Controller

Page 14: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

p. pods/apps running on k8

Docker

Kubelet

POD

Container

Docker

Kubelet

POD

Container

Node Node

YAML APP

SPECAPI

Master

Registry

Page 15: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

k8 basic objects

• Everything in k8 is a declarative configuration object (RESTfull API object)

k8 uses them to represent the state of a cluster:

• Pod - a group of one or more containers

• Service - gives your pods a stable IP

• Volume - storage and configuration for the pods

• Nodes - VM or physical machine

Page 16: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

k8 high-level objects controllers

• ReplicaSet

• Deployment (important)

• StatefulState (PetSets)

• DaemonSet

• Job

Page 17: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

Whats a pod anyway?

Pod is group of containers

Containers run under the same Network and UTS namespace (same hostname and net. interface)

Run under the same IPC namespace

Containers in a pod share the same IP address (localhost) and port space

Pods can be seen as very very light VM-s

Page 18: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

Basic objects for an app

• Deployment object

generate the pods with a label, and keeps them alive

• Service object

Grouping object that gives you a stable IP (virtual IP) for the pods that have a certain LABEL

• (Config map - app configuration file)

Page 19: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

Services in k8

POD1 IP: 2.1.1.1

POD2 IP: 2.1.1.2

POD3 IP: 2.1.1.3

Frontend Service IP: 1.1.1.1

Backend Service IP: 1.1.1.2

FRONTED

BACKEND

POD IP: 2.1.1.4

Page 20: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

Deployment controller

Drives current state towards the desired state

app: televendcloud replicas: 1

NODE 1

NODE 1

NODE 2 NODE 3

Page 21: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

Deployment controller

Drives current state towards the desired state

app: televendcloud replicas: 1

POD

Container

NODE 1

NODE 1

NODE 2 NODE 3

Page 22: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

Deployment controller

Drives current state towards the desired state

app: televendcloud replicas: 3

POD

Container

NODE 1

NODE 1

NODE 2 NODE 3

Page 23: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

Deployment controller

Drives current state towards the desired state

app: televendcloud replicas: 3

POD

Container

NODE 1

NODE 1

NODE 2 NODE 3

POD

Container

POD

Container

Page 24: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

Deployment controller

Drives current state towards the desired state

app: televendcloud replicas: 3

POD

Container

NODE 1

NODE 1

NODE 2 NODE 3

POD

Container

Page 25: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

Deployment controller

Drives current state towards the desired state

app: televendcloud replicas: 3

POD

Container

NODE 1

NODE 1

NODE 2 NODE 3

POD

Container

POD

Container

Page 26: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

k8 documentation

Page 27: Introduction to Kubernetes (k8) - Televend...Introduction to Kubernetes (k8) Tomislav Mikulin DevOps Word of caution What is kubernetes? Formal definition: “Kubernetes is an open

k8 learning material:

Minikube - program (for practicing and development)

“Up and running with Kubernetes” - book

Scalable microservices with Kubernetes - Udacity course

https://www.katacoda.com/ - website

kubernetes.io - documentation