Kubernetes: basic resources and concepts

Using K8s feels like being air traffic controller, sometimes.

Master Server Components

Those master components make so called control plane.

  • etcd — config store accessible to all cluster nodes
  • kube-apiserver — config workloads and org unit; REST + kubectl client
  • kube-controller-manager manages controllers, state saved to etcd
  • kube-scheduler — assigns workloads to specific nodes
  • cloud-controller-manager — bridge to specific cloud provider

Node Server Components

  • Node is a server that preforms work.
  • Container Runtime is typically Docker, but can be rkt or runc too.
  • kubelet is a main contact point for each node with the cluster group. Work is received as manifest.
  • kube-proxy lets manage sub-netting and makes services available to other components. Can do primitive load-balancing.

Kubernetes Objects and Workloads

Instead of managing containers directly, users define and interact with instances composed of various primitives provided by the Kubernetes object model.

Pods

A pod is the most basic unit. One or more tightly coupled containers are encapsulated into pod. Those share a lifecycle, should be on the same node. They share environment, volumes, IP space.

Replication Controllers and Replication Sets

You’ll manage groups of identical, replicated pods. There are created from pod templates.

Deployments

Deployments are a high level object and the most common workloads to create and manage. Use replication sets and add lifecycle management. Modification is a config change. K8s deals with the rest.

apiVersion: apps/v1
kind: Deployment
metadata:
name: apache-deployment
labels:
app: web
spec:
replicas: 5
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: apache-container
image: httpd:2.4.35

Stateful Sets

Stateful sets are used in case of special requirements related to deployment ordering, persistent data, or stable networking. Meant for databases.

Daemon Sets

Run a copy of a pod on each node in the cluster (or subnet). Used for pods doing maintenance or services for the nodes. Examples: collection and forwarding logs, aggregating metrics.

Jobs and Cron Jobs

Jobs are for task-based workflow, where it exists when done.

Other Kubernetes Components

Services

Service acts as a basic internal load balancer and ambassador of pods. Groups logical collection of pods that perform the same function to present them as a single entity.

Volumes and Persistent Volumes

Kubernetes Volumes differ from Docker volumes because they exists inside the Pod rather than inside the container.

Namespaces

Namespaces are virtual clusters. Every cluster has at least 3 namespaces: default, kube-system, kube-public.

Labels and Annotations

Label is a semantic tag assigned ot object. These can be selected for when targeting different instances for management or routing.

Secrets

Secrets hold sensitive information such as passwords, TLS certificates, OAuth tokens, and ssh keys.

ConfigMap

ConfigMaps are mechanisms used to inject containers with configuration data while keeping containers agnostic of Kubernetes.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Adam Brodziak

Adam Brodziak

Father. Husband. Solutions developer profesionally (software quite often). Arsenal supporter. Cyclist.