March 6, 2025
containerd
, CRI-O
etc).kubectl
cli, language bindings); imperative commands + declarative configBased on official kubernetes documentation
kube-apiserver
exposes k8s APIetcd
– consistent and highly-available key value store used as Kubernetes’ backing store for all cluster datakube-scheduler
– control plane component that watches for newly created Pods with no assigned node, and selects a node for them to run onkube-controller-manager
runs controller processes. Controllers – control loop that reconciles the state of a cluster with the desired onecloud-controller-manager
kubelet
– takes a set of PodSpecs that are provided through various mechanisms and ensures that the containers described in those PodSpecs are running and healthykube-proxy
maintains network rules on nodes. These network rules allow network communication to your Pods from network sessions inside or outside of your cluster (optional if a network plugin implements functionality)Pods are basic workload of k8s. Represents several containers that work together.
simple-pod.yaml
Apply declarative definition imperatively
Note
Pods are rarely created directly. They are normally managed by workload resources.
The most common way to run applications. Best fit for stateless, scalable applications.
Deployment
rollsout ReplicaSet
. It manages copies of pods in the background.Deployment
is saved in etcd
as a revision
ReplicaSet
)StatefulSet
is used to manage stateful applications (e.g DB)
DaemonSet
runs a copy of a Pod on every (or defined set of) node of a cluster. Used for daemons, add-ons, helper tools necessary for operation.Jobs
represent one-off task that runs to completion and then stopCronJobs
are scheduled JobsPod
has unique cluster-wide IP (volatile if pod is restarted)
localhost
Service
API provides a stable long-lived IP address / hostname for aplication
Ingress
API (superseeded by Gateway
) manages external HTTP/HTTPS access to the services
apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
selector:
app.kubernetes.io/name: MyApp
ports:
- protocol: TCP
port: 80
targetPort: 9376
Note
ClusterIP
by defaultConfigMap
for setting configuration data separately from application code
apiVersion: v1
kind: ConfigMap
metadata:
name: game-demo
data:
config-option0: value0
config-option1: value1
binaryData:
image-file.jpg: <base64 encoded>
Exposed to pod as:
Secrets
are used to store sensitive configuration / data. Similar to ConfigMap
otherwise.
Different types of Secrets, e.g.
Opaque
default general-use for arbitrary datakubernetes.io/ssh-auth
ssh credentialskubernetes.io/tls
data for a TLS client or serverWarning
Kubernetes Secrets are, by default, stored unencrypted in the API server’s underlying data store (etcd). Anyone with API access can retrieve or modify a Secret, and so can anyone with access to etcd.
Additional configuration is needed to effectively protect Secrets in multi-user production deployments.
Volumes
can be statically created by cluster admin. More often are dynamically provisioned
StorageClass
es are pre-created by cluster admin. Determine mechanisms for PersistentVolume
creation. Provisioner
add-on creates volumes.
local-path
/ cloud-backed add-ons (e.g. cinder-csi
with OpenStack) / nfs storage provider / Longhorn
…PersistentVolumeClaim
asking to create a volume with specific StorageClass