Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Kubernetes Architecture and Fundamentals

Kubernetes Architecture and Fundamentals

A collated knowledge-base to get you going with kubernetes. (Original authors credits in speaker-notes, else linked)

Joy Bhattacherjee

April 21, 2018
Tweet

More Decks by Joy Bhattacherjee

Other Decks in Technology

Transcript

  1. Who am I? • DevOps Engineer at Razorpay ◦ AWS

    VPCs ◦ Self-hosted Kubernetes ◦ CI ◦ Datastores @hashfyre
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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)
  7. 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
  8. 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
  9. Hands On: Daemonset Deploy Prometheus + Grafana + nodeexporter •

    Node-exporter daemonset • Prometheus deployment + service • Grafana deployment + service https://github.com/bakins/minikube-prometheus-demo