Zum Inhalt springen
Trainingslager IT-Trainingslager

Anhang A: Spickzettel

Die wichtigsten Meldungen, Befehle und Fristen aus Tag 0 bis 20. Die Tage stehen in Klammern. Platzhalter in spitzen Klammern ersetzt du. RKE2-Befehle laufen auf cp1 (Knotenbefehle mit sudo -i auf dem Knoten), Talos-Befehle auf argo.

Die Methode in einer Zeile (Tag 1)

Einbauen → Symptom → eingrenzen (Schicht, Werkzeug, Meldung) → Ursache → Fix → Nachweis. Von außen nach innen: Client → Ingress → Service → Pod → Container → Knoten → Control Plane.

# auf cp1
kubectl get pods -n <ns> -o wide
kubectl describe pod <pod> -n <ns>
kubectl events -n <ns> --for pod/<pod>
kubectl events -n <ns> --types=Warning
kubectl logs <pod> -n <ns> --previous
kubectl explain <ressource>.<feld>
kubectl auth can-i <verb> <ressource> -n <ns> --as=<user>
kubectl get --raw '/readyz?verbose'

Von der Meldung zum ersten Befehl

Meldung (Ausschnitt) Schicht Erster Befehl (Tag)
0/3 nodes are available: 3 Insufficient cpu Scheduler describe node, Requests (3)
untolerated taint / didn't match Pod's node affinity/selector Scheduler Taints, Labels (3)
pod has unbound immediate PersistentVolumeClaims Storage get pvc, StorageClass (3, 10)
exceeded quota / must specify limits.memory Admission describe quota, Events am ReplicaSet (3)
Pending ohne Event Scheduler spec.schedulerName (3)
ErrImagePull … not found Image Tag prüfen, crictl pull (4)
no such host beim Pull Knoten-DNS Resolver des Knotens (4)
pull access denied … insufficient_scope Registry Name, privat? (4)
no basic auth credentials Registry imagePullSecrets (4)
server gave HTTP response to HTTPS client Registry registries.yaml (4)
couldn't find key … in Secret Konfiguration Secret, Mutation (4, 20)
exec format error, Exit 255 Image Shebang, Architektur (4)
CrashLoopBackOff, Exit 1/127 Anwendung logs --previous (1, 5)
OOMKilled, Exit 137 Limits describe pod, Limit (5)
Readiness 0/1, keine Neustarts Probe Events Unhealthy (5)
Read-only file system Security Context emptyDir (5)
Could not connect to server zum Service Service EndpointSlice (7)
Resolving timed out DNS/NetworkPolicy dig, Policies (8)
Policy wirkt nicht NetworkPolicy Selektoren, CNI (8, 19)
404 page not found (Traefik) Ingress ingressClassName (9, 20)
no available server / 503 (Traefik) Ingress/Service Endpoints (9, 20)
TRAEFIK DEFAULT CERT TLS Secret-Schlüssel (9)
didn't match PersistentVolume's node affinity Storage PV nodeAffinity (10, 20)
Permission denied im Volume Storage UID, Rechte (10)
is forbidden: User … cannot RBAC auth can-i --list (11)
violates PodSecurity "baseline:latest" PSA Namespace-Labels (11, 18, 19)
admission webhook … denied the request Kyverno get vpol, Policy (12)
failed calling webhook Webhook Endpoints des Webhook-Service (12, 16)
k8s_pod_name=<NA> (Falco) Falco Socket-Liste (13)
Knoten NotReady, Conditions Unknown Kubelet Lease, Journal (14)
Cannot evict pod … disruption budget Drain get pdb (14, 20)
connection refused auf 6443 API-Server crictl ps -a, crictl logs (15)
unrecognized feature gate API-Server Static-Pod-Log (15, 19)
x509: certificate has expired Zertifikate openssl x509 -enddate (15)
False (MissingEndpoints) am APIService Aggregation get apiservice (16)
Namespace Terminating Discovery/Finalizer Conditions (16)
exceeded its progress deadline Rollout get rs, rollout undo (17)
cpu: <unknown>/50% HPA Events am HPA, Requests (17, 19)
another operation … is in progress Helm helm history, rollback (17)
BackoffLimitExceeded Job podFailurePolicy (17)
doesn't contain any IP SANs (metrics-server) Kubelet-Zertifikat CSRs (19)

Pods und Container (Tag 1, 4, 5, 6)

# auf cp1
kubectl get pod <pod> -n <ns> -o jsonpath='{.status.containerStatuses[0].lastState}'
kubectl debug -it <pod> -n <ns> --image=nicolaka/netshoot:v0.15 --target=<container>
kubectl debug <pod> -n <ns> --copy-to=<kopie> --container=<c> --set-image=<c>=<image>
kubectl debug <pod> -n <ns> --profile=netadmin --image=nicolaka/netshoot:v0.15
kubectl debug node/<knoten> -it --image=busybox:1.37 --profile=sysadmin
  • Profile in kubectl 1.37: general (+SYS_PTRACE), baseline, restricted, netadmin, sysadmin. Unter PSA baseline (Talos) nur --profile=baseline.
  • Ephemeral Container lassen sich nicht entfernen; PSA prüft den ganzen Pod.
Exit-Code Bedeutung (Tag 1, 5)
1 Anwendung gibt auf
126 Datei nicht ausführbar
127 Befehl nicht gefunden
128 StartError, Binary fehlt im Image
137 SIGKILL (OOMKilled oder Kill nach Grace Period)
143 SIGTERM, sauber beendet
255 exec format error

Netz (Tag 7, 8, 9)

# auf cp1
kubectl get endpointslices -n <ns> -l kubernetes.io/service-name=<svc>
kubectl -n <ns> exec client -- curl -sS -m 5 http://<svc>
kubectl -n <ns> exec client -- dig +search <svc>
kubectl -n kube-system get svc rke2-coredns-rke2-coredns
kubectl get ingressclass
curl -s --resolve <host>:80:172.16.0.126 http://<host>/
openssl s_client -connect 172.16.0.126:443 -servername <host> </dev/null 2>/dev/null \
  | openssl x509 -noout -subject -enddate
  • Selektor falsch, targetPort falsch, benannter Port fehlt: dieselbe curl-Meldung, der Unterschied steht in der EndpointSlice.
  • ndots:5: Kurznamen nur im eigenen Namespace; Default-Deny-Egress braucht eine DNS-Ausnahme (UDP und TCP 53 zu k8s-app: kube-dns).

Storage, RBAC, Admission (Tag 10, 11, 12, 16)

# auf cp1
kubectl get pvc,pv -n <ns>
kubectl -n local-path-storage logs deploy/local-path-provisioner --tail 20
kubectl auth can-i --list -n <ns> --as=system:serviceaccount:<ns>:<sa>
kubectl label --dry-run=server --overwrite ns <ns> \
  pod-security.kubernetes.io/enforce=restricted
kubectl get vpol,mpol
kubectl apply --dry-run=server -f <datei>
kubectl get validatingwebhookconfigurations,mutatingwebhookconfigurations
kubectl get apiservice | grep -v True
kubectl get ns <ns> -o jsonpath='{.status.conditions}'

Knoten und Control Plane – RKE2 vs. Talos (Tag 14, 15, 18, 19)

Frage RKE2 Talos
Läuft das Kubelet? systemctl status rke2-agent talosctl -n <ip> service kubelet
Log des Kubelets .../agent/logs/kubelet.log talosctl -n <ip> logs kubelet
Log des Dienstes journalctl -u rke2-server -b talosctl -n <ip> logs <dienst>
Container crictl ps -a, crictl logs <id> talosctl containers --namespace cri
Container-Log crictl logs <id> talosctl logs --namespace cri <id>
Kernel dmesg -T talosctl -n <ip> dmesg
Image ziehen crictl pull <image> talosctl -n <ip> image pull <image>
Konfiguration /etc/rancher/rke2/config.yaml(.d) talosctl patch mc, edit mc
Mirror /etc/rancher/rke2/registries.yaml RegistryMirrorConfig
Kubelet-Argumente kubelet-arg KubeletConfig.extraArgs
API-Server-Argumente kube-apiserver-arg KubeAPIServerConfig.extraArgs
etcd-Snapshot rke2 etcd-snapshot save talosctl etcd snapshot <datei>
etcd-Status etcdctl per crictl exec talosctl etcd status
Zertifikate rke2 certificate check get kubernetesdynamiccerts
Gerenderter Static Pod /var/lib/rancher/rke2/agent/pod-manifests get staticpods <name> -o yaml
Pod Security Standard privileged (ohne CIS) baseline außer kube-system
# auf cp1
kubectl get --raw /api/v1/nodes/<knoten>/proxy/configz | jq .kubeletconfig
kubectl -n kube-node-lease get lease <knoten> -o jsonpath='{.spec.renewTime}'
kubectl drain <knoten> --ignore-daemonsets --delete-emptydir-data --timeout=60s
kubectl uncordon <knoten>
kubectl get pdb -A
# auf argo
talosctl -n <ip> health
talosctl -n <ip> services
talosctl -n <ip> get rd
talosctl -n <ip> get mc v1alpha1 -o jsonpath='{.spec}' | grep '^kind:'
talosctl -n <ip> patch mc --patch @<datei> --dry-run
talosctl -n <ip> patch mc --patch @<datei> --mode try
talosctl -n <ip> etcd members
talosctl -n <ip> ls /var/mnt
talosctl -n <ip> read /etc/cri/conf.d/hosts/docker.io/hosts.toml
talosctl config info

Einen Eintrag aus der Machine-Config nimmt ein Patch mit $patch: delete heraus, ein ganzes Dokument ebenso (mit apiVersion, kind und name).

Rollouts, Jobs, Helm (Tag 17)

# auf cp1
kubectl rollout status deploy/<name> -n <ns> --timeout=90s
kubectl rollout undo deploy/<name> -n <ns>
kubectl get rs -n <ns> -l app=<app>
kubectl get hpa -n <ns>; kubectl top pods -n <ns>
kubectl get job <job> -n <ns> -o jsonpath='{.status.conditions}'
helm -n <ns> history <rel> -o json | jq -r '.[] | "\(.revision) \(.status)"'
helm -n <ns> rollback <rel> <rev>
helm list -A --pending --failed

Fristen und Zahlen

Mechanik Wert Tag
CrashLoop-Backoff 10 s, verdoppelt bis 5 min 1, 5
Knoten NotReady ohne Lease ca. 50 s (node-monitor-grace-period) 14, 19
Toleration unreachable/not-ready 300 s (Standard) 14
Ersatz bei tolerationSeconds: 30 ca. 80 s nach Ausfall 14, 19
Kubelet-Statusbericht Lease 10 s, Conditions bis 5 min 14
Eviction RKE2 nodefs/imagefs 5 % (Kubernetes: 10 %/15 %) 14
progressDeadlineSeconds 600 s 17
HPA herunterskalieren 5 min Stabilisierung 17
Job-Backoff 10 s, 20 s, 40 s … 17
Webhook-Timeout 10 s (Standard) 16
ConfigMap im Volume bis ca. 1 min; Env und subPath nie 17
talosconfig gültig 1 Jahr 18

k9s (Tag 2)

:pods <ns>⏎        Pods eines Namespaces       :xray deploy <ns>⏎   Abhängigkeiten
/muster⏎  /!muster⏎ filtern, ausschließen      Ctrl-z               nur kaputte Pods
d  describe        l  Logs     p  vorige Logs  s  Shell             y  YAML
0 tail  1 head     2–6 Zeitfenster  t Zeitstempel  w Umbruch        Esc  zurück
:ctx⏎              Kontext                     k9s --readonly       nichts ändern

Versionen im Buch

Komponente Version
Ubuntu (VMs) 24.04.5 LTS, amd64
RKE2 (Kubernetes) v1.37.2+rke2r1
containerd (RKE2) 2.3.7-k3s1
Canal / Traefik / CoreDNS 3.32.2 / 3.7.16 / 1.14.7
metrics-server (RKE2 und Talos) 0.9.0 (Chart 3.14.0 auf Talos)
local-path-provisioner v0.0.37
Helm / k9s v4.3.2 / v0.51.0
Kyverno (Chart) v1.20.0 (3.10.0)
Falco (Chart) 0.45.2 (9.2.2)
Talos / Kubernetes auf Talos v1.14.6 / v1.37.2
Flannel (Talos) v0.28.10
kubelet-serving-cert-approver v0.12.1
QEMU (argo) 8.2.2
netshoot / whoami / busybox v0.15 / v1.11 / 1.37
notes-api / postgres / nginx-unprivileged 0.7.1 / 18.7-alpine / 1.31.7-alpine

Offizielle Doku

  • Kubernetes, Fehlersuche: kubernetes.io/docs/tasks/debug
  • RKE2: docs.rke2.io
  • Talos 1.14: docs.siderolabs.com/talos/v1.14
  • k9s: k9scli.io
  • Kyverno: kyverno.io/docs
  • Falco: falco.org/docs
  • Helm: helm.sh/docs