Kubectl EssentialsAdvanced
1Question 1 of 1
bashWhat are essential kubectl commands for managing and debugging clusters?
Explanation & Concept
• `kubectl get pods -A`: List all pods across all namespaces. • `kubectl describe pod <name>`: View event logs, probe failures, and image pull issues. • `kubectl logs -f <pod> -c <container>`: Stream container stdout. • `kubectl exec -it <pod> -- sh`: Open terminal inside pod. • `kubectl port-forward pod/<name> 8080:80`: Forward local port directly to pod.
Code Example
bash
# Quick port forward to debug internal database
kubectl port-forward service/postgres-service 5432:5432How It Works & Key Takeaways
`port-forward` allows developers to connect local GUI database tools directly to internal Kubernetes services without exposing public ports.
Mock Test · 1 Questions · Optional
Ready for Network Policies?
Take a quick test to evaluate yourself, or move straight to the next module.
Advanced1 questions