1 / 19

Introduction to Kubernetes

Introduction to Kubernetes. Topics. Overview Docker containers Container orchestration Kubernetes project Architecture PODs Cluster architecture Concepts and Features Concepts (Services, Labels/Selectors) Container Network Interface (CNI) Links. Overview: Docker Containers.

thane
Download Presentation

Introduction to Kubernetes

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Kubernetes

  2. Topics • Overview • Docker containers • Container orchestration • Kubernetes project • Architecture • PODs • Cluster architecture • Concepts and Features • Concepts (Services, Labels/Selectors) • Container Network Interface (CNI) • Links Northforge Innovations

  3. Overview: Docker Containers Benefits of using containers • Rapid deployment • Sharing • Portability • Version control and component reuse • Lightweight footprint • Simpler maintenance Container Application KERNEL RAM Network CPU • Hard drive segment • bin • dev • etc • home • proc • root • ... Northforge Innovations

  4. Overview: Container Orchestration • The orchestrator intelligently installs, starts, and stops containers on multiple nodes. • This is where Kubernetes comes into the picture Orchestrator Node Node Container Container Node Container Northforge Innovations

  5. Overview: Kubernetes • http://kubernetes.io • Latest stable release 1.14 • Originally designed by Google • Maintained by the Cloud Native Computing Foundation (https://www.cncf.io/) • OpenSource Written in Go (https://github.com/kubernetes/kubernetes) Northforge Innovations

  6. Overview: Why is Kubernetes needed?  • Isolation: Keep jobs from interfering with each other • Scheduling: Where should my job be run? • Lifecycle: Keep my job running • Health: How is my job feeling? • Monitoring: What’s happening with my job? • Discovery: Where is my job now? • Constituency: Who is part of my job? • Scale-up: Making my jobs bigger or smaller • Auth{n,z}: Who can do things to my job? Northforge Innovations

  7. Architecture: PODs POD • Grouping of containers with common purpose • All containers in a POD need to be tightly dependent on each other • Smallest unit that Kubernetes can deploy • Set of metadata (name, labels) for the POD • Shared Volume (persistent for container only, not for POD) • Inter-Process communication (POSIX queues, shared memories) • Inter-container network communication POD Container 1 POSIX IPC Container 2 Container 3 Volume Network (localhost) Northforge Innovations

  8. Architecture: Kubernetes Cluster Master Components • Cluster’s control plane • These components make global decisions about the cluster, detecting and responding to cluster events. Kubernetes Master Controller Manager Scheduler API Server etcd HTTPS HTTPS Worker1 Kube Proxy Kubelet Worker2 Worker Components • Run on every node • Maintaining running pods and providing the runtime environment POD POD POD Worker3 Container Engine Northforge Innovations

  9. Architecture: Kubernetes Cluster etcd • etcd is a distributed and consistent key-value store • The only storage backend currently supported by Kubernetes • Primary store for all Kubernetes API objects and their configuration • The etcd database also stores the actual state of the system and the desired state of the system. • Etcd has a watch functionality to monitor any changes. It monitors if actual and desired states diverge, Kubernetes will make the appropriate changes to the system. • For a demo of etcd: http://play.etcd.io/ Kubernetes Master Controller Manager Scheduler API Server etcd HTTPS HTTPS Worker1 Kube Proxy Kubelet Worker2 POD POD POD Worker3 Container Engine Northforge Innovations

  10. Architecture: Kubernetes Cluster API Server • It is the entry point to the system. It processes REST operations, validates them, and updates the corresponding objects in etcd • kubectl CLI communicate with the API Server. • Responsible for authentication and authorization mechanism. All API clients should be authenticated in order to interact with the API Server. Kubernetes Master Controller Manager Scheduler API Server etcd HTTPS HTTPS Worker1 Kube Proxy Kubelet Worker2 POD POD POD Worker3 Container Engine Northforge Innovations

  11. Architecture: Kubernetes Cluster Controller Manager • Watches the state of the cluster through the API Server watch feature • when it gets notified, it makes the necessary changes attempting to move the current state towards the desired state. • Example: Replication Controller, Endpoints Controller, and Namespace Controller. Kubernetes Master Controller Manager Scheduler API Server etcd HTTPS HTTPS Worker1 Kube Proxy Kubelet Worker2 POD POD POD Worker3 Container Engine Northforge Innovations

  12. Architecture: Kubernetes Cluster Scheduler • The Kubernetes scheduler is in charge of scheduling pods onto nodes • Every pod that needs scheduling gets added to a queue • When new pods are created, they also get added to the queue • The scheduler continuously takes pods off that queue and binds them to nodes. • It schedules according to the availability of the requested resources, quality of service requirements, affinity and other constraints. • Once the pod has a node assigned, the regular behavior of the Kubelet is triggered and the pod and its containers are created Kubernetes Master Controller Manager Scheduler API Server etcd HTTPS HTTPS Worker1 Kube Proxy Kubelet Worker2 POD POD POD Worker3 Container Engine Northforge Innovations

  13. Architecture: Create POD flow Northforge Innovations

  14. Architecture: Kubernetes Cluster Kube Proxy • Window to the outside world • Inspect the requests and route to the appropriate service Kubernetes Master Controller Manager Scheduler API Server etcd HTTPS HTTPS Worker1 Kube Proxy Kubelet Worker2 POD POD POD Worker3 Container Engine Northforge Innovations

  15. Architecture: Kubernetes Cluster Kubelet • The kubelet uses liveness probes to know when to restart a Container. • The kubelet uses readiness probes to know when a Container is ready to start accepting traffic. • Check types include: • Http (code 2xx or 3xx) • tcpSocket (tries tcp connection to port) • Exec • Probe is configurable: • timeoutSeconds (timeout of check in seconds) • failureThreshold (min consec failure till give up) • initialDelaySeconds (start check x seconds) • periodSeconds (check every x seconds) • successThreshold Kubernetes Master Controller Manager Scheduler API Server etcd HTTPS HTTPS Worker1 Kube Proxy Kubelet Worker2 POD POD POD Worker3 Container Engine Northforge Innovations

  16. Architecture: Multi-Master Cluster Master 1 Master 2 Master 3 • All etcd instances will be clustered • Each API server will talk to the local etcd • Only one instance of the controllers, schedulers and auto-scaler will be active in the cluster. Etcd Cluster etcd etcd etcd Load Balancer API Server API Server API Server Scheduler Scheduler Scheduler Controller Manager Controller Manager Controller Manager Cluster Auto-scaler Cluster Auto-scaler Cluster Auto-scaler Worker1 Kube Proxy • A load balancer containing the replicas is created and the IP address of the first replica will be promoted to IP address of load balancer. • Kubelets connect to the load balancer Kubelet Worker2 POD POD POD Worker3 Container Engine Northforge Innovations

  17. Concepts/Features: Services Service • The types of Services that can be created are: ClusterIP, NodePort, LoadBalancer, Ingress (The example on the left is for NodePort) • NodePort: Expose a container to the outside world • Nodeport: high value 30000-32767 Labels/Selectors • A service is identified by a selector • The service routes to PODs with labels matching the selector User Node NodePort Kube Proxy Service NodePort (Selector: example1) POD (Label: example2) POD (Label: example1) TargetPort X TargetPort Y Container Container Northforge Innovations

  18. Concepts/Features: Networking Networking Plugins • Calico (https://www.projectcalico.org/) • Flanel (https://coreos.com/flannel/) • Weave (https://www.weave.works/) • Cilium (https://cilium.io/) Northforge Innovations

  19. Links • https://kubernetes.io/docs/home/ • https://www.udemy.com/docker-and-kubernetes-the-complete-guide/ • https://github.com/kelseyhightower/kubernetes-the-hard-way • https://github.com/fabiosvaz/playground/tree/master/k8s • https://github.com/fabiosvaz/playground/tree/master/vagrant Northforge Innovations

More Related