kubectl cloud
Kubernetes command-line tool for cluster management
kubectl is the official Kubernetes CLI for managing clusters, deploying applications, inspecting resources, and viewing logs. It is the primary interface for interacting with any Kubernetes cluster.
Features
- Manage pods, deployments, services, and all K8s resources
- Apply declarative configurations from YAML/JSON
- Stream logs and exec into running containers
- Supports multiple cluster contexts
- Extensible via plugins (krew)
Install
brew: brew install kubectlapt: sudo apt-get install -y kubectlcurl: curl -LO https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl Commands
| Command | Syntax | Description |
|---|---|---|
get | kubectl get <resource> | List resources (pods, services, deployments, etc.) |
apply | kubectl apply -f <file> | Apply a configuration from a YAML/JSON file |
logs | kubectl logs <pod> | Stream logs from a running pod |
exec | kubectl exec -it <pod> -- <command> | Execute a command inside a running container |
Links
Agent Usage Example
Use cases:
- Check pod status and health in a cluster
- Deploy or update applications via manifests
- Debug failing containers by reading logs or exec-ing in
Example workflow:
kubectl get pods -n production --no-headers | grep -v Running && kubectl logs <failing-pod> --tail=50