Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

Hoofdstuk 1Naam in de cursus: Cluster architecture

Understand the Kubernetes architecture

Kubernetes runs containers on many machines as if they were one computer. You describe the wanted state (3 copies of my app, reachable on port 80), and Kubernetes keeps reality equal to it — restarting, moving and scaling containers. This chapter shows the parts of a cluster and how they work together.

  • 5 Lessen
  • 3 Commando's

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

$ als gewone gebruiker# als root (of met sudo)

1.1

Know the control plane and the nodes

The control plane decides; the worker nodes run the containers.

ComponentRuns onJob
kube-apiserverControl planeThe front door: every request goes through its REST API
etcdControl planeThe database of the whole cluster state
kube-schedulerControl planeChooses a node for every new pod
kube-controller-managerControl planeLoops that fix differences (replicas, nodes, endpoints)
cloud-controller-managerControl planeTalks to the cloud (load balancers, disks)
kubeletEvery nodeStarts the pods the API server assigned to this node
kube-proxyEvery nodeService networking rules (or replaced by the CNI)
Container runtimeEvery nodecontainerd or CRI-O, starts containers
CNI pluginEvery nodePod networking (Calico, Cilium, Flannel …)
kubectl get nodes -o wide
kubectl get pods -n kube-system
kubectl cluster-info
ls /etc/kubernetes/manifests/
etcd.yaml  kube-apiserver.yaml  kube-controller-manager.yaml  kube-scheduler.yaml

Onthoud

In a kubeadm cluster the control-plane parts run as static pods from /etc/kubernetes/manifests/. The kubelet starts them; change the file and the kubelet restarts the pod.

1.2

Know the main objects

Everything in Kubernetes is an object with a kind, metadata (name, namespace, labels) and a spec.

ObjectMeaning
PodOne or more containers that share network and storage — the smallest unit
DeploymentKeeps N pods of a stateless app, with rolling updates
StatefulSetPods with fixed names and own storage (databases)
DaemonSetOne pod on every node (log agents, CNI)
Job / CronJobRun to completion / on a schedule
ServiceA stable name and IP in front of pods
ConfigMap / SecretConfiguration and sensitive data
PersistentVolumeClaimA request for storage
NamespaceA folder for objects, for teams and limits

1.3

Talk to the API with kubectl

kubectl sends requests to the API server, using a kubeconfig file (~/.kube/config) with clusters, users and contexts.

kubectl config get-contexts
kubectl config use-context lab
kubectl config set-context --current --namespace=shop
kubectl api-resources | head
kubectl explain deployment.spec.strategy
kubectl get pods -A -o wide
kubectl get deploy web -o yaml

1.4

Write objects in YAML

Every object has the same four top fields.

pod.yaml
apiVersion: v1
kind: Pod
metadata:
  name: web
  namespace: shop
  labels:
    app: web
spec:
  containers:
    - name: nginx
      image: nginx:1.27
      ports:
        - containerPort: 80
kubectl apply -f pod.yaml
kubectl run web --image=nginx:1.27 --dry-run=client -o yaml > pod.yaml
kubectl delete -f pod.yaml

Examentip

Never write YAML from zero in the exam. Generate it with --dry-run=client -o yaml, then edit.

1.5

Understand labels and selectors

Labels are key/value tags on objects. Selectors find objects by labels — that is how a Service finds its pods and a Deployment its ReplicaSets.

kubectl get pods -l app=web
kubectl get pods -l 'env in (prod,staging)'
kubectl label pod web tier=frontend
kubectl get pods --show-labels

Alle commando's in dit hoofdstuk