Zum Inhalt springen
_CORE
KI & Agentensysteme Unternehmensinformationssysteme Cloud & Platform Engineering Datenplattform & Integration Sicherheit & Compliance QA, Testing & Observability IoT, Automatisierung & Robotik Mobile & Digitale Produkte Banken & Finanzen Versicherungen Öffentliche Verwaltung Verteidigung & Sicherheit Gesundheitswesen Energie & Versorgung Telko & Medien Industrie & Fertigung Logistik & E-Commerce Retail & Treueprogramme
Referenzen Technologien Blog Know-how Tools
Über uns Zusammenarbeit Karriere
CS EN DE
Lassen Sie uns sprechen

Kubernetes: 20 kubectl-Befehle für die tägliche Arbeit

11. 06. 2025 1 Min. Lesezeit intermediate

Kubectl ist Ihr bester Freund bei der Arbeit mit Kubernetes. Hier sind 20 Befehle für die tägliche Arbeit.

Kontext und Namespace

kubectl config get-contexts kubectl config use-context production kubectl config set-context –current –namespace=app

Ressourcen-Übersicht

kubectl get pods -A kubectl get pods -o wide kubectl get pods –sort-by=.status.startTime

Logs

kubectl logs -f my-pod kubectl logs –previous my-pod kubectl logs -l app=frontend –all-containers

Exec und Port Forward

kubectl exec -it my-pod – /bin/sh kubectl port-forward svc/my-app 8080:80

Ressourcenverbrauch

kubectl top pods –sort-by=memory kubectl top nodes

Skalierung und Rollout

kubectl scale deployment my-app –replicas=5 kubectl rollout undo deployment/my-app kubectl rollout status deployment/my-app

Apply und Delete

kubectl apply -f manifest.yaml kubectl delete pod my-pod –grace-period=0 –force

JSONPath und Dry Run

kubectl get pods -o jsonpath=’{.items[*].metadata.name}’ kubectl create deployment nginx –image=nginx –dry-run=client -o yaml

Labels und Selektoren

kubectl label pods my-pod env=production kubectl get pods -l env=production

Debug und Events

kubectl debug my-pod -it –image=busybox kubectl get events –sort-by=.lastTimestamp kubectl describe pod my-pod

ConfigMap und Secret

kubectl create configmap my-config –from-file=config.yaml kubectl create secret generic db-pass –from-literal=password=s3cret kubectl get secret db-pass -o jsonpath=’{.data.password}’ | base64 -d

Aliase

alias k=kubectl alias kgp=”kubectl get pods” alias kl=”kubectl logs -f”

Tipp

Installieren Sie kubectx, kubens und richten Sie die zsh-Vervollständigung ein — ein Game Changer.

kubernetesdevopscloud
Teilen:

CORE SYSTEMS Team

Wir bauen Kernsysteme und KI-Agenten, die den Betrieb am Laufen halten. 15 Jahre Erfahrung mit Enterprise-IT.