Containers and Cloud Native reference

122 commands, numbers and terms from the 13 lessons, one line each. The right-hand column opens the page that teaches it.

1Why containers, and running your first one

Image / containerA program packed with everything it needs / one running copy of an image; `docker run IMAGE` starts oneImages and containers
Container vs VMShares the host kernel / brings its ownContainers and VMs
ContainerAn ordinary process shown a smaller worldWhat a container is
pid, net, mnt, uts, ipc, user, cgroupNamespaces: one wall per kind of thingWhat a container is
cgroupsLimits on CPU, memory and process countWhat a container is
docker run --memory 256m --cpus 0.5Set the cgroup limits at run timeWhat a container is
Exit code 137 / 143128 + 9 (SIGKILL, or out of memory) / 128 + 15 (SIGTERM)Stopping and exit codes
OCIImage, runtime and distribution standards: any tool builds, any runtime runsThe standard
containerd, CRI-ORuntimes Kubernetes uses since dockershim was removed (1.24)The standard
crictl ps , crictl pods , crictl logs IDContainers as the kubelet sees them, on the node itselfcrictl

2Running containers

docker run -d -p 8080:80 nginxPublish container port 80 on host port 8080Ports
docker ps logs exec -it … sh stop rmList, read output, open a shell, stop, removePorts
-p 127.0.0.1:8080:80Publish on the loopback address only; `-p 8080:80` listens on every interfacePublishing ports
-v data:/var/lib/postgresql/dataA named volume: data outlives the containerVolumes
Bind mount`-v $(pwd):/app`: a host folder inside the containerVolumes
Named volume / bind mount / tmpfsManaged by Docker / a host path you name / memory onlyKinds of mount
-e KEY=value / --env-fileSettings from outside the imageEnvironment
User-defined networkContainers find each other by nameNetworks
compose.yamlservices, ports, volumes, environment in one fileCompose
docker compose up -d / down -vStart everything / stop and delete volumes tooCompose
depends_on: condition: service_healthyWait for the health check of the other service, not just its startStart order

3Building and sharing images

LayerOne per filesystem-changing instruction (RUN, COPY, ADD)Layers
docker build -t app:1.2 .Build and tag an imageLayers
ENTRYPOINT / CMDThe program / its default arguments; in a pod, `command` / `args`ENTRYPOINT and CMD
Cache orderCopy the dependency list and install before copying the codeThe build cache
Tag vs digest`app:1.2` can move / `app@sha256:…` never doesTags and digests
imagePullPolicyDefault Always for `:latest` or no tag, IfNotPresent otherwiseNames and pull policy
Small basealpine, slim or distroless instead of a full OSSmall images
docker image history appSize of each layerSmall images
Multi-stage build`FROM … AS build` then `COPY --from=build` into a small imageSmall images
RegistryDocker Hub, ECR, ACR, Artifact Registry; pulls only missing layersRegistries
Image indexOne tag, a manifest per platform (linux/amd64, linux/arm64)Inside a registry

4Why Kubernetes, and what is in a cluster

Desired stateYou state what should run; controllers keep it trueWhy Kubernetes
kind create clusterA practice cluster in containersWhy Kubernetes
Control loopWatch, compare, actDesired state
API server, etcd, scheduler, controller managerThe control planeInside a cluster
kubelet, kube-proxy, container runtimeOn every worker nodeInside a cluster
/etc/kubernetes/manifestsStatic pod files: API server (6443), etcd (2379), scheduler, controller managerWhere the parts run
kubectl apply -f app.yamlSend desired state to the API serverOne request
--dry-run=client -o yamlPrint the manifest a create command would make, and create nothingWorking with kubectl
apiVersion, kind, metadata, specEvery manifest's shape; the cluster writes statusManifests
kubectl get pods -o wide / describe / explainList, details and events, field docsManifests
kubectl api-resourcesEvery kind with its apiVersion, short name and whether it is namespacedAPI groups

5Pods and Deployments

PodOne or more containers sharing an IP and volumesThe pod
Init container / sidecarRuns to completion before the main containers / an init container with `restartPolicy: Always`Init containers and sidecars
Deployment → ReplicaSet → PodsWho owns whomOwnership
Rolling updatemaxSurge 25%, maxUnavailable 25% by defaultRolling update
kubectl rollout status / undo deploy/webWatch a rollout / go backRolling update
kubectl set image deploy/web web=web:1.3Start a new rolloutRolling update
maxSurge / maxUnavailable25% each by default; surge rounds up, unavailable rounds downmaxSurge and maxUnavailable
Deployment, StatefulSet, DaemonSet, Job, CronJobInterchangeable pods, stable identity, one per node, run to completion, on a scheduleOther workloads
CronJob defaultsconcurrencyPolicy Allow, backoffLimit 6, keeps 3 successful and 1 failed JobJobs and CronJobs
Labels and selectors`app=web`; `kubectl get pods -l app=web`Labels

6Services and networking

ServiceA stable virtual IP and name in front of changing podsServices
kubectl expose deploy web --port 80Make a Service for a DeploymentServices
kubectl port-forward svc/web 8080:80Reach a Service from your laptopServices
ClusterIP, NodePort, LoadBalancerInside only; a port on every node (30000 to 32767); a cloud load balancerService types
port / targetPort / nodePortOn the Service / on the container / on every node, 30000 to 32767Service ports
web.shop.svc.cluster.localA Service's DNS name: service, namespaceDNS
ndots:5Names with fewer than 5 dots are tried with each search ending firstThe search list
IngressHTTP routing by host and path; needs an ingress controllerIngress
Gateway APIThe newer, role-oriented successor to IngressIngress
Gateway / HTTPRoute`gateway.networking.k8s.io/v1`: the entrance / the routing rules attached to itGateway API
NetworkPolicyAll traffic allowed until a policy selects a pod; needs a CNI that enforces itNetworkPolicy

7Configuration and secrets

ConfigMap / SecretSettings / sensitive settings, passed as env vars or filesConfigMaps and Secrets
kubectl create secret generic db --from-literal=password=…Make a SecretConfigMaps and Secrets
kubectl rollout restart deployment/apiReplace the pods so that they read changed variablesWhen settings update
Base64Encoding, not encryption; enable encryption at rest for etcdSecrets
imagePullSecretsNames a `kubernetes.io/dockerconfigjson` Secret for a private registrySecret types
RequestsWhat the scheduler reserves for the podRequests and limits
LimitsCPU is throttled at the limit; memory over the limit is OOMKilledRequests and limits
LimitRange / ResourceQuotaDefaults and bounds per container / a total for the namespaceNamespace limits
Guaranteed, Burstable, BestEffortQoS classes: evicted last to first under pressureQuality of service

8Storage

emptyDir / PersistentVolumeLives with the pod / outlives itLifetimes
PVC → PV ← StorageClassA claim asks; a class makes the disk on demandClaims and volumes
volumeBindingMode: WaitForFirstConsumerMake the disk only when a pod is placed, in that zone; the default is ImmediateStorageClass
volumeBindingMode: WaitForFirstConsumerMake the disk in the zone where the pod landsMoving
RWO, ROX, RWX, RWOPOne node writes, many read, many write, one podAccess modes
Static bindingClass equal, access mode offered, capacity at least the request; one claim per volumeStatic volumes
Reclaim policyDelete (default for dynamic volumes) or RetainReclaim
volumeClaimTemplatesA StatefulSet gives each replica its own claimReclaim
PV phasesAvailable, Bound, Released, FailedVolume phases

9Scheduling and scaling

Filter, then scoreRule nodes out, then pick the bestThe scheduler
Topology spreadSpread replicas across zones and nodesPlacement
requiredDuringSchedulingIgnoredDuringExecutionA hard rule at placement; not enforced on pods already runningAffinity, written down
nodeSelector, affinityPull pods towards nodes or other podsSteering
Taint / toleration`kubectl taint node n1 gpu=true:NoSchedule`; pods must tolerate itSteering
PendingNo node passes the filters: check requests, taints, affinitySteering
NoSchedule / PreferNoSchedule / NoExecuteNo new pods / avoid if possible / also evict running podsTaint effects
HPAdesired = ceil(current × metric ÷ target); 10% tolerance; 5 min scale-down windowScaling pods
kubectl autoscale deploy web --cpu-percent=70 --min=2 --max=10Create an HPAScaling pods
kubectl autoscale deployment web --cpu-percent=50 --min=2 --max=10Makes a HorizontalPodAutoscaler (autoscaling/v2)The HPA, written down
Cluster Autoscaler, KarpenterAdd nodes when pods do not fitScaling nodes

10Security in the cluster

Authentication, authorisation, admissionThree gates for every API requestThe API request
Role + RoleBinding / ClusterRole + ClusterRoleBindingWhat, and who, in a namespace / cluster-wideRBAC
kubectl auth can-i delete pods --as ana -n shopTest a permissionRBAC
ClusterRole + RoleBindingThe cluster-wide role's rules, granted in one namespace onlyRBAC, written down
Service accountA pod's identity; short-lived bound tokensService accounts
system:serviceaccount:shop:deployerA service account's user name, for `kubectl auth can-i --as`The token
securityContext`runAsNonRoot`, `readOnlyRootFilesystem`, drop capabilitiesSecurity context
Privileged, baseline, restrictedPod Security Standards, enforced per namespaceSecurity context
pod-security.kubernetes.io/enforce: restrictedNamespace label that makes the cluster refuse pods below that levelPod Security Admission
trivy image app:1.2 / cosign verifyScan for known flaws / check the signatureImages

11Packaging and delivery

Helm chartTemplates plus values.yamlHelm
helm install upgrade history rollbackManage a releaseHelm
helm upgrade --install NAME CHART -f values.yamlInstall or upgrade in one command; later values override earlier onesValue precedence
KustomizeBase plus overlays; `kubectl apply -k`Kustomize
kubectl kustomize overlays/prodPrint what an overlay produces without applying itkustomization.yaml
GitOpsDeclarative, versioned, pulled, continuously reconciledGitOps
Argo CD, FluxSync the cluster from Git; self-heal undoes manual changesGitOps
prune / selfHealDelete what left Git / undo manual changes; both off by defaultThe Application
Sandbox, incubating, graduatedCNCF project maturity levelsThe landscape

12Operating and fixing a cluster

Pending / ImagePullBackOff / CrashLoopBackOffCannot place / cannot pull / keeps exitingFinding the fault
kubectl describe pod logs --previous get eventsEvents, the last crash's output, what changedEvidence
Container, pod, node, clusterWork outwardsEvidence
Liveness / readiness / startup probeRestart it / send it traffic / wait for slow startsProbes
Probe defaultsinitialDelay 0, period 10 s, timeout 1 s, success 1, failure 3Probe timings
Upgrade orderControl plane first, one minor version at a time, then nodesUpgrades
kubectl drain node --ignore-daemonsets / uncordonEmpty a node / put it backUpgrades
kubeadm upgrade plan / apply v1.34.1 / nodeCheck / upgrade the first control plane node / upgrade every other nodekubeadm upgrade
etcdctl snapshot save / restoreBack up and restore the cluster's stateBackup
etcdutl snapshot restore FILE --data-dir=DIRBuilds a new data directory; then point the etcd static pod at itSnapshot and restore

NeuroqAI · Containers and Cloud Native · neuroqai.com/courses/containers-and-cloud-native/reference/