Kubernetes Commands
Search Results
Kubernetes Commands
Pods
kubectl get pods
List all pods in the current namespace.
Example:
kubectl get pods -o wide
list
pods
namespace
kubectl describe pod <pod-name>
Show detailed information about a specific pod.
Example:
kubectl describe pod my-app-pod
describe
pod
details
kubectl logs <pod-name>
View logs from a specific pod.
Example:
kubectl logs -f my-app-pod
logs
pod
debug
kubectl exec -it <pod-name> -- /bin/bash
Execute commands inside a running pod.
Example:
kubectl exec -it my-app-pod -- /bin/bash
exec
shell
pod
Services
kubectl get services
List all services in the current namespace.
Example:
kubectl get svc -o wide
list
services
networking
kubectl expose deployment <deployment-name> --port=80
Create a service to expose a deployment.
Example:
kubectl expose deployment nginx --port=80 --type=LoadBalancer
expose
service
deployment
Deployments
kubectl get deployments
List all deployments in the current namespace.
Example:
kubectl get deployments -o wide
list
deployments
kubectl scale deployment <deployment-name> --replicas=3
Scale a deployment to a specified number of replicas.
Example:
kubectl scale deployment nginx --replicas=5
scale
deployment
replicas
kubectl rollout restart deployment/<deployment-name>
Restart a deployment by triggering a rollout.
Example:
kubectl rollout restart deployment/nginx
restart
rollout
deployment