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

KubeTraining-Basics.pdf

Avatar for ramnar ramnar
November 04, 2019
23

 KubeTraining-Basics.pdf

Avatar for ramnar

ramnar

November 04, 2019

Transcript

  1. Topics • Introduction • Terminology • Kubernetes Architecture • Software

    Installation • Basics of Yaml • Pods • ReplicaSet • Deployment
  2. Introduction • Kubernetes is an Open Source Software released by

    Google in 2015. • Kubernetes development and design is heavily influenced by Google’s Borg Software. • Borg is the software used inside Google which powers all the popular Google softwares which we use today like search, maps, gmail, etc. • Joe Beda, Brendan Burns, Tim Hockin, Brian Grunt, Craig McLuckie are the core developers of Kubernetes.
  3. Who uses Kubernetes? • Github • Paytm • Ant Financial

    • GST System of Indian Government • Reddit
  4. Terminology • Container • Container Orchestrator • Microservices • Pod

    • ReplicaSet • Deployment • Service • Namespace • Label
  5. Terminology • apiserver • etcd • Scheduler • Controller •

    Kubelet • Kubectl • Kubeproxy • Master Node • Worker Node
  6. Terminology Explained Container - A container is a standard unit

    of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. Example - docker, rocket, cri-o, etc Container Orchestrator - A software that manages the lifecycle of all containers is called container orchestrator. Example - docker swarm, kubernetes, mesos, Amazon ECS, etc Microservices - It is an approach to developing a large software as a suite of small services.
  7. Kubernetes Terminology Pod - Pod is the smallest building block

    in kubernetes. It consists of one or more containers. Each pod is assigned a unique IP address. ReplicaSet - It tells kubernetes how many instances(replicas) of the pod should be running at any point of time. Deployment - It is a resource which contains pod definition and the number of replicas of the pod required. Service - It is a resource that provides access to the pod in kubernetes.In real applications we define a deployment and service for each application/service.
  8. Kubernetes Terminology Namespace - It is similar to folder. It

    is used to group resources into different categories in kubernetes. Labels - They are the names given to the resources in kubernetes useful for filtering them based on labels.
  9. FAQ • Which programming language is used in kubernetes? •

    Is kubernetes completely free? • Why kubernetes is so popular? • Who manages kubernetes software development?
  10. Kubernetes Architecture • It consists of master and worker nodes.

    • The job of the master node is to just manage worker nodes. It does not run any application. • Worker Nodes actually run the actual applications and do the real work. • Master Node consists of apiserver, etcd, scheduler, controller • Worker Node consists of kubelet, container runtime(docker), pods
  11. Kubernetes Master Building Blocks • apiserver - It is the

    main component that exposes kubernetes api. • etcd - It is a key value database for storing data in kubernetes. • Scheduler - It watches newly created pods that have no node assigned, and selects a node for them to run on based on some rules. • Controller - It is responsible for ensuring the pods are always running in kubernetes.
  12. Worker Node Building Blocks • Kubelet - An agent that

    runs on each node in the cluster. It makes sure that containers are running in a pod. • kubeProxy - Provides networking for pods and services • Container Runtime - Component used to run containers. Generally docker is used for this.
  13. FAQ • What happens if a master node goes down?

    • What happens if a worker node goes down? • Can I add or remove worker nodes to scale up/down the cluster? • In an enterprise we have multiple environments like dev, test prod. How is that managed in kubernetes?
  14. Yaml Basics • Yaml is another data format like xml,

    json. • Yaml is best suited for storing configuration where as json is best suited for data serialization. • Yaml building blocks ◦ Key, value pairs ◦ List or Array ◦ Dictionary or Map
  15. Pod • Pod is the smallest computing unit in kubernetes.

    It has its own CPU, IP address and RAM. • Pod can have one or more containers which share resources in the pod.
  16. kubectl CRUD Commands • kubectl create -f sample-pod.yaml • kubectl

    get pods • kubectl describe pod <pod-name> • kubectl apply -f sample-pod.yaml • kubectl delete pod <pod-name> Other resource types that can be used in commands are rs or replicaset, deployment, svc or service.
  17. ReplicaSet • A ReplicaSet’s purpose is to maintain a stable

    set of replica Pods running at any given time. • As such, it is often used to guarantee the availability of a specified number of identical Pods.
  18. Deployment • A deployment is a resource which contains the

    definition of the pod and the number of replicas that need to be maintained at any point of time
  19. Service • Service is a resource which groups a logical

    set of pods together. • It is the interface using which a pod is accessible to the consumers of the pod. • It makes the pods of an application accessible to other pods in the same node or other nodes or clients of the application • Default service type is ClusterIP.
  20. ClusterIP • ClusterIP service is used if you want the

    pod to be accessible within the cluster. • Service has a port defined for it. It links the port of the pod. • The port of the pod is called targetPort.
  21. NodePort • NodePort service is used if you want the

    pod to be accessible outside the cluster. • Service has a port defined for it. It maps a port of the worker node with a port of the pod • The port of the node is called nodePort • The port of the pod is called targetPort
  22. FAQ • I have a use case which contains a

    large number of microservices. As a developer what should i do deploy them in kubernetes? • Can I achieve CI/CD of my applications with kubernetes? • Are there any tools which validate syntax, provide content assist of yaml files? • What are helm charts?
  23. Namespaces • Kubernetes has three existing namespaces.They are default, kube-system,

    kube-public. • Resources in a namespace can talk to each other using resource name. • Namespace can be created using yaml file or imperative command. • Resources have namespace attribute in metadata section as well.
  24. Kubernetes as a Service ( KaaS) • Google Kubernetes Engine

    (GKE) • Azure Kubernetes Service ( AKS) • Amazon Elastic Kubernetes Service ( EKS ) • Almost every cloud provider has their own flavour of kubernetes as a service
  25. Popular Quotes • Kubernetes is the new linux. • Kubernetes

    is a software which reconciles the desired state of the system with the actual state. • Kubernetes is the distributed operating system. • Kubernetes is platforms platform.
  26. When to use kubernetes? • Internet Scale Applications • Large

    Enterprise Softwares • IOT usecases • Machine Learning Usecases • Edge Usecases • Blockchain Usecase
  27. Advanced Topics • Persistent Volumes • ConfigMaps • Secrets •

    Service Accounts • Taints and Tolerations • Labels and Selectors • Node Affinity • Readiness Probes, Liveness Probes • Jobs and CronJobs • Networking • DaemonSet