Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state...
Transcript of Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state...
![Page 1: Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current](https://reader034.fdocuments.net/reader034/viewer/2022042310/5ed7a7e248b98015c2021332/html5/thumbnails/1.jpg)
Kubernetes introductionContainer orchestration
![Page 2: Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current](https://reader034.fdocuments.net/reader034/viewer/2022042310/5ed7a7e248b98015c2021332/html5/thumbnails/2.jpg)
Container Orchestration
![Page 3: Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current](https://reader034.fdocuments.net/reader034/viewer/2022042310/5ed7a7e248b98015c2021332/html5/thumbnails/3.jpg)
Why we need container orchestration?
Restart containers if they are not healthy.
Provide private container network.
Service discovery.
Manage cluster
![Page 4: Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current](https://reader034.fdocuments.net/reader034/viewer/2022042310/5ed7a7e248b98015c2021332/html5/thumbnails/4.jpg)
Container orchestrations
Swarm
Hashicorp nomad
Kubernetes
Mesosphere
![Page 5: Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current](https://reader034.fdocuments.net/reader034/viewer/2022042310/5ed7a7e248b98015c2021332/html5/thumbnails/5.jpg)
“A single container host by itself is like a tree without a forest.”
![Page 6: Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current](https://reader034.fdocuments.net/reader034/viewer/2022042310/5ed7a7e248b98015c2021332/html5/thumbnails/6.jpg)
Kubernetes
![Page 7: Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current](https://reader034.fdocuments.net/reader034/viewer/2022042310/5ed7a7e248b98015c2021332/html5/thumbnails/7.jpg)
What is Kubernetes?
Kubernetes is a platform for hosting docker containers in a clustered environment with multiple docker hosts
Project was started by google
Contributers: Google, CoreOS, Redhat, Mesosphere, Microsoft, HP, IBM, Vmware, ...
![Page 8: Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current](https://reader034.fdocuments.net/reader034/viewer/2022042310/5ed7a7e248b98015c2021332/html5/thumbnails/8.jpg)
Kubernetes features
Schedule containers to physical machines
Service discovery
Load balancing
Auto healing
Scaling features
![Page 9: Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current](https://reader034.fdocuments.net/reader034/viewer/2022042310/5ed7a7e248b98015c2021332/html5/thumbnails/9.jpg)
Kubernetes features
Automated rollouts and rollbacks
Storage orchestration
Secret management
Zero downtime deploy/update
![Page 10: Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current](https://reader034.fdocuments.net/reader034/viewer/2022042310/5ed7a7e248b98015c2021332/html5/thumbnails/10.jpg)
Kubernetes components
ETCD
API Server
Scheduler
Controller Manager
Proxy
Kubelet
cAdvisor
![Page 11: Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current](https://reader034.fdocuments.net/reader034/viewer/2022042310/5ed7a7e248b98015c2021332/html5/thumbnails/11.jpg)
“Kube may be a physical node or a vm”
![Page 12: Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current](https://reader034.fdocuments.net/reader034/viewer/2022042310/5ed7a7e248b98015c2021332/html5/thumbnails/12.jpg)
![Page 13: Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current](https://reader034.fdocuments.net/reader034/viewer/2022042310/5ed7a7e248b98015c2021332/html5/thumbnails/13.jpg)
ETCD
Distributed key value store
Like a directory tree
JSON/REST API
Use a discovery url
![Page 14: Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current](https://reader034.fdocuments.net/reader034/viewer/2022042310/5ed7a7e248b98015c2021332/html5/thumbnails/14.jpg)
Kubernetes API Server
The Kubernetes API server validates and configures data for the api objects which include pods, services, replicationcontrollers, and others. The API Server services REST operations and provides the frontend to the cluster’s shared state through which all other components interact.
![Page 15: Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current](https://reader034.fdocuments.net/reader034/viewer/2022042310/5ed7a7e248b98015c2021332/html5/thumbnails/15.jpg)
Kubernetes Scheduler
The Kubernetes scheduler is a policy-rich, topology-aware, workload-specific function that significantly impacts availability, performance, and capacity. The scheduler needs to take into account individual and collective resource requirements, quality of service requirements, hardware/software/policy constraints, affinity and anti-affinity specifications, data locality, inter-workload interference, deadlines, and so on. Workload-specific requirements will be exposed through the API as necessary.
![Page 16: Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current](https://reader034.fdocuments.net/reader034/viewer/2022042310/5ed7a7e248b98015c2021332/html5/thumbnails/16.jpg)
Kubernetes Controller Manager
The Kubernetes controller manager is a daemon that embeds the core control loops shipped with Kubernetes. In applications of robotics and automation, a control loop is a non-terminating loop that regulates the state of the system. In Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current state towards the desired state. Examples of controllers that ship with Kubernetes today are the replication controller, endpoints controller, namespace controller, and serviceaccounts controller.
![Page 17: Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current](https://reader034.fdocuments.net/reader034/viewer/2022042310/5ed7a7e248b98015c2021332/html5/thumbnails/17.jpg)
Kubernetes Proxy
The Kubernetes network proxy runs on each node. This reflects services as defined in the Kubernetes API on each node and can do simple TCP,UDP stream forwarding or round robin TCP,UDP forwarding across a set of backends. Service cluster ips and ports are currently found through Docker-links-compatible environment variables specifying ports opened by the service proxy. There is an optional addon that provides cluster DNS for these cluster IPs. The user must create a service with the apiserver API to configure the proxy.
![Page 18: Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current](https://reader034.fdocuments.net/reader034/viewer/2022042310/5ed7a7e248b98015c2021332/html5/thumbnails/18.jpg)
Kubernetes Kubelet
The kubelet is the primary “node agent” that runs on each node. The kubelet works in terms of a PodSpec. A PodSpec is a YAML or JSON object that describes a pod. The kubelet takes a set of PodSpecs that are provided through various mechanisms (primarily through the apiserver) and ensures that the containers described in those PodSpecs are running and healthy. The kubelet doesn’t manage containers which were not created by Kubernetes.
![Page 19: Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current](https://reader034.fdocuments.net/reader034/viewer/2022042310/5ed7a7e248b98015c2021332/html5/thumbnails/19.jpg)
Pods
Smallest deployable unit of computing
Group of one or more containers
Pod has one ip address (localhost)
Containers access to shared volume
![Page 20: Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current](https://reader034.fdocuments.net/reader034/viewer/2022042310/5ed7a7e248b98015c2021332/html5/thumbnails/20.jpg)
Replication sets
Ensure that a specified number of pod replicas are running
If there are too many, it will kill them
If there are too few, it will start more
![Page 21: Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current](https://reader034.fdocuments.net/reader034/viewer/2022042310/5ed7a7e248b98015c2021332/html5/thumbnails/21.jpg)
Deployment
Provides declarives updates for pods/replica sets
Manages one or more replica sets
Primary mechanism for interacting with pods
Automatic rollouts and rollbacks
![Page 22: Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current](https://reader034.fdocuments.net/reader034/viewer/2022042310/5ed7a7e248b98015c2021332/html5/thumbnails/22.jpg)
Daemon sets
Deploy a pod in all nodes
Ensure number of replications
If one pod on node exited, It will restart it
![Page 23: Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current](https://reader034.fdocuments.net/reader034/viewer/2022042310/5ed7a7e248b98015c2021332/html5/thumbnails/23.jpg)
Service
An abstraction which defines a logical set of pods
Provides a mechanism to accessing them
Types: loadbalancer, clusterip, nodeport
![Page 24: Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current](https://reader034.fdocuments.net/reader034/viewer/2022042310/5ed7a7e248b98015c2021332/html5/thumbnails/24.jpg)
Let’s play with kubernetes!
![Page 25: Kubernetes introduction · Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current](https://reader034.fdocuments.net/reader034/viewer/2022042310/5ed7a7e248b98015c2021332/html5/thumbnails/25.jpg)
?