Kubernetes

What is Kubernetes?

Here are the key ideas someone should know about Kubernetes:

What are additional details about a pod?

A pod in Kubernetes can contain one or more containers that are guaranteed to be co-located on the same node and share some resources.

Some key things to know about pods:

What are details about namespaces?

Namespaces are a way to partition resources in Kubernetes. They allow you to split a physical cluster into multiple virtual clusters. Some reasons to use namespaces are:

Some properties of namespaces:

How is state maintained in Kubernetes?

State maintenance in Kubernetes can be challenging since pods are ephemeral (can be destroyed and recreated).

There are a few main ways to manage state in Kubernetes:

What are resources in Kubernetes?

Kubernetes resources are objects you create to define the infrastructure and workloads for your applications.

There are many types of Kubernetes resources, including:

Kubernetes resources allow you to describe your application's infrastructure and deployment in declarative configuration files which can be reviewed, edited, and version controlled. Kubernetes then manages the resource to match the desired state you have specified.

What does the scheduler do?

The Kubernetes scheduler is responsible for assigning pods to nodes in the cluster. It monitors the cluster state and scheduling requirements to determine the best node for each pod.

Some of the specific responsibilities of the Kubernetes scheduler include:

How does Kubernetes handle node degradation?

Kubernetes has several mechanisms to handle performance degradation or failures of nodes:

  1. Node Conditions - Each node has conditions that track different aspects of node health like ready status, out of disk, network unavailable, etc. The scheduler uses node conditions to filter out unhealthy nodes when scheduling pods.

  2. Node Taints - Kubernetes administrators can taint nodes to prevent new pods from scheduling onto them. This is useful when a node is having issues so you can stop feeding it more workload. Existing pods will continue running unless evicted.

  3. Pod Eviction - As a last resort, Kubernetes may evict pods from a node to preserve cluster stability. This usually only happens if a node has severe performance issues or failures and cannot support its current pods. Static pods are evicted last since they are required for cluster control plane operations.

  4. Pod Disruption Budgets - To limit how many pods can be evicted from a node at once, administrators set up pod disruption budgets. This helps avoid overwhelming other nodes by rapidly rescheduling too many pods from a degraded node.

  5. Node Draining - Administrators can manually "drain" a node to reschedule all pods from it. Node draining uses pod disruption budgets to do this gradually. Draining nodes is useful when decommissioning a node or performing maintenance on it.

  6. Replica Scaling - For workloads like Deployments that maintain a set replica count, Kubernetes will scale up additional pods on other available nodes if pods on a degraded node cannot run properly or go down. This maintains the desired state of the workload.

  7. Pod Re-scheduling - The Kubernetes scheduler is constantly monitoring for pods that may need to be re-scheduled onto new nodes for performance or availability reasons. If it recognizes a pod is having issues due to node performance, it will find a more stable node to place the pod on.

  8. Node Auto-Repair - Some Kubernetes environments use node auto-repair tools to automatically roll nodes that have gone down or are exhibiting performance issues. The tool drains the node, walks it through any necessary repairs or reprovisioning, and then puts it back into rotation - helping maximize cluster resilience.