Basic Commands
| Command | Description |
|---|---|
kubectl get pods | List all pods |
kubectl get deployments | List all deployments |
kubectl get services | List all services |
kubectl describe pod <pod_name> | Describe a pod |
kubectl describe deployment <deployment_name> | Describe a deployment |
kubectl describe service <service_name> | Describe a service |
kubectl apply -f <file>.yaml | Apply a YAML or JSON file |
kubectl delete pod <pod_name> | Delete a pod |
kubectl delete deployment <deployment_name> | Delete a deployment |
kubectl delete service <service_name> | Delete a service |
kubectl logs <pod_name> | View the logs for a pod |
kubectl exec -it <pod_name> -- /bin/bash | Open a shell inside a running container |
Resources
| Resource | Description |
|---|---|
| Pod | The smallest deployable unit in Kubernetes |
| Deployment | A controller for managing and scaling pods |
| Service | A way to expose pods to the network |
| Ingress | A way to route external traffic to services |
| ConfigMap | A configuration store for non-sensitive data |
| Secret | A configuration store for sensitive data |
| Volume | A way to store data and share it between containers |
YAML Configuration
| Section | Description |
|---|---|
apiVersion: | The API version of the resource |
kind: | The type of resource (pod, deployment, service, etc.) |
metadata: | Metadata about the resource (name, labels, etc.) |
spec: | The specification for the resource (containers, volumes, etc.) |
status: | The current status of the resource |
