Kubernetes: A Comprehensive Overview
Kubernetes: A Comprehensive Overview
Kubernetes: A Comprehensive Overview
A Comprehensive Overview
Kubernetes v1.8
Agenda
● Introduction ● Concepts
○ Who am I? ○ Core
○ What is Kubernetes? ○ Workloads
○ What does Kubernetes do? ○ Network
● Architecture ○ Storage
○ Master Components ○ Configuration
○ Node Components ○ Auth and Identity
○ Additional Services ● Behind the Scenes
○ Networking ○ Deployment from Beginning to End
Introduction
Intro - Who am I?
http://arc-ts.umich.edu
Intro - What is Kubernetes?
Masters - Acts as the primary control plane for Kubernetes. Masters are
responsible at a minimum for running the API Server, scheduler, and cluster
controller. They commonly also manage storing cluster state, cloud-provider
specific components and other cluster essential services.
Nodes - Are the ‘workers’ of a Kubernetes cluster. They run a minimal agent
that manages the node itself, and are tasked with executing workloads as
designated by the master.
Architecture
Overview
Master
Components
Master Components
● Kube-apiserver
● Etcd
● Kube-controller-manager
● Cloud-controller-manager
● Kube-scheduler
kube-apiserver
The apiserver provides a forward facing REST interface into the kubernetes
control plane and datastore. All clients, including nodes, users and other
applications interact with kubernetes strictly through the API Server.
Etcd acts as the cluster datastore; providing a strong, consistent and highly
available key-value store used for persisting cluster state.
kube-controller-manager
● Kubelet
● Kube-proxy
● Container runtime engine
kubelet
Acts as the node agent responsible for managing pod lifecycle on its host.
Kubelet understands YAML container manifests that it can read from several
sources:
● File path
● HTTP Endpoint
● Etcd watch acting on any changes
● HTTP Server mode accepting container manifests over a simple API.
kube-proxy
● Userspace
● iptables
● ipvs (alpha in 1.8)
Container Runtime
● Containerd (docker)
● Cri-o
● Rkt
● Kata (formerly clear and hyper)
● Virtlet (VM CRI compatible runtime)
Additional Services
1) All Pods can communicate with all other Pods without NAT
2) All nodes can communicate with all Pods (and vice-versa) without NAT.
3) The IP that a Pod sees itself as is the same IP that others see it as.
Networking - Fundamentals Applied
Containers in a pod exist within the same network namespace and share an
IP; allowing for intrapod communication over localhost.
Pods are given a cluster unique IP for the duration of its lifecycle, but the pods
themselves are fundamentally ephemeral.
Services are given a persistent cluster unique IP that spans the Pods lifecycle.
Cluster - A collection of hosts that aggregate their available resources including cpu, ram, disk,
and their devices into a usable pool.
Master - The master(s) represent a collection of components that make up the control plane of
Kubernetes. These components are responsible for all cluster decisions including both
scheduling and responding to cluster events.
Node - A single host, physical or virtual capable of running pods. A node is managed by the
master(s), and at a minimum runs both kubelet and kube-proxy to be considered part of the
cluster.
Label - Key-value pairs that are used to identify, describe and group together related sets of
objects. Labels have a strict syntax and available character set. *
Selector - Selectors use labels to filter or select objects. Both equality-based (=, ==, !=) or
simple key-value matching selectors are supported.
* https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set
Labels, and Annotations,
and Selectors
Labels:
app: nginx
tier: frontned
Annotations
description: “nginx frontend”
Selector:
app: nginx
tier: frontend
Set-based selectors
Valid Operators:
● In
● NotIn
● Exists
● DoesNotExist
Pod - A pod is the smallest unit of work or management resource within Kubernetes. It is
comprised of one or more containers that share their storage, network, and context
(namespace, cgroups etc).
StatefulSet - A controller tailored to managing Pods that must persist or maintain state. Pod
identity including hostname, network, and storage will be persisted.
DaemonSet - Ensures that all nodes matching certain criteria will run an instance of a
supplied Pod. Ideal for cluster wide services such as log forwarding, or health monitoring.
StatefulSet
Job - The job controller ensures one or more pods are executed and successfully terminates. It
will do this until it satisfies the completion and/or parallelism condition.
Service - Services provide a method of exposing and consuming L4 Pod network accessible
resources. They use label selectors to map groups of pods and ports to a cluster-unique virtual
IP.
Ingress - An ingress controller is the primary method of exposing a cluster service (usually
http) to the outside world. These are load balancers or routers that usually offer SSL
termination, name-based virtual hosting etc.
Service
Volume - Storage that is tied to the Pod Lifecycle, consumable by one or more
containers within the pod.
Secret - Functionally identical to ConfigMaps, but stored encoded as base64, and encrypted at
rest (if configured).
ConfigMaps and Secrets
[Cluster]Role - Roles contain rules that act as a set of permissions that apply verbs like “get”,
“list”, “watch” etc over resources that are scoped to apiGroups. Roles are scoped to namespaces,
and ClusterRoles are applied cluster-wide.
7) Initializers are given opportunity to mutate request before the object is published.
22) The kubelet daemon on every node polls the apiserver filtering
for pods matching its own ‘NodeName’; checking its current state
with the desired state published through the apiserver.
27) If there are any liveless/readiness probes, these are executed before the
PodStatus is updated.
28) If all complete successfully, PodStatus is set to ready and the container
has started successfully.