Slide 1

Slide 1 text

Kubernetes Architecture and Fundamentals April 21, 2014 Null Bangalore Public Puliya

Slide 2

Slide 2 text

Who am I? ● DevOps Engineer at Razorpay ○ AWS VPCs ○ Self-hosted Kubernetes ○ CI ○ Datastores @hashfyre

Slide 3

Slide 3 text

Objective ● Understand the problem K8S tries to solve ● Delve into K8S architecture, to decipher how does it do this. ● Dissect K8S API Server to understand it’s components ● Understand user-space interactions with K8S ● Touch upon K8S resources that builds your application stack ● Deploy a local K8S Cluster with Minikube ● Deploy basic apps on it

Slide 4

Slide 4 text

Materials ● Kubernetes Learning Materials: https://goo.gl/Rywkpd

Slide 5

Slide 5 text

10 mins Introduction to K8S 10 mins K8S Architecture 10 mins Control Plane components overview 20 mins Get minikube up and running on localhost 40 mins Deploying K8S manifests on minikube

Slide 6

Slide 6 text

K8S: Introduction

Slide 7

Slide 7 text

Orchestration Platform & Toolkit ● Abstractions on top of containers ○ Pods ● Pod Scheduling and Lifecycle ● Cluster Networking ○ Pod-to-Pod ○ Host-to-Pod ● Service Load Balancing ● Service DNS ● Storage Volume Management ○ Persistent Layer ● Microservice centric ● Organize your workload as desired ● Composable building blocks for your app ● Platform and toolkit ○ Build on top of Open APIs

Slide 8

Slide 8 text

Architecture

Slide 9

Slide 9 text

Source: http://k8s.info/cs.html#cs-menu Kubernetes Architecture: Physical Layout

Slide 10

Slide 10 text

Source: http://k8s.info/cs.html#cs-menu Kubernetes Architecture: Abstractions Overview

Slide 11

Slide 11 text

Source: http://k8s.info/cs.html#cs-menu Kubernetes Architecture: Detailed Abstractions

Slide 12

Slide 12 text

How Kubelet Schedules Containers

Slide 13

Slide 13 text

Source: Kubernetes - a comprehensive Overview Kubernetes Stack on Cloud Providers

Slide 14

Slide 14 text

Getting Things Running...

Slide 15

Slide 15 text

Minikube Setup ● macOS ○ brew cask install minikube ● Linux ○ curl -Lo minikube https://storage.googleapis.com/minikube /releases/latest/minikube-linux-amd64 && ○ chmod +x minikube && sudo mv minikube /usr/local/bin/ ● Windows ○ minikube-windows-amd64.exe

Slide 16

Slide 16 text

macOS with xhyve OSX ● Download [Docker for Mac] ( https://docs.docker.com/docker-for-mac/ ) ● Install [minikube] ( https://github.com/kubernetes/minikube/releases ) ● Install xhyve driver brew install docker-machine-driver-xhyve ● docker-machine-driver-xhyve need root owner and uid ● sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve ● sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve ● Set minikube to use xhyve minikube config set vm-driver xhyve ● Install kubectl - brew install kubectl ● Start minikube minikube start ● Set kubectl to use minikube kubectl config use-context minikube ● Confirm its working kubectl get services --all-namespaces ● Share Docker Daemon with minikube eval $(minikube docker-env)

Slide 17

Slide 17 text

Familiarizing K8S Objects / Kinds

Slide 18

Slide 18 text

Hands On: Pods, Deployments, Services Expose a Pod as a Service ● Redis-service encapsulating a redis pod ● A web-service depending on the redis-service as backend Expose a Deployment as a Service ● Redis-service encapsulating a redis pod ● A web-service depending on the redis-service as backend ○ Encapsulating multiple running replicas https://github.com/hashfyre/k8s-tutes

Slide 19

Slide 19 text

Hands On: Statefulsets Web Deployment with Redis HA Statefulset ● Primary and Secondary Redis-services with Sentinel and Statefulsets ● A web-service depending on the redis-service as backend ○ Encapsulating multiple running replicas https://github.com/corybuecker/redis-stateful-set

Slide 20

Slide 20 text

Hands On: Daemonset Deploy Prometheus + Grafana + nodeexporter ● Node-exporter daemonset ● Prometheus deployment + service ● Grafana deployment + service https://github.com/bakins/minikube-prometheus-demo

Slide 21

Slide 21 text

Thanks. @hashfyre /Hashfyre