--- id: mat-05-kubectl-for-pods title: "kubectl for Pods" --- # kubectl for Pods ## Apply a manifest Deploy a Pod: - `kubectl apply -f pod.yml` Check Pods: - `kubectl get pods` - watch continuously: - `kubectl get pods --watch` ## Inspect pods with kubectl get Useful output formats: - `-o wide` (more columns) - `-o yaml` (full YAML output) Tip: - compare desired state (`spec`) vs observed state (`status`). ## kubectl describe - `kubectl describe pods ` Useful for events and deep status information. ## kubectl logs - `kubectl logs ` - for a specific container: - `kubectl logs --container ` ## kubectl exec Run a command in a running Pod: - `kubectl exec -- ` Get a tty: - `kubectl exec -it -- sh` For multi-container pods, add `--container ` as needed.