Kubernetes Commands
Kubernetes container orchestration and kubectl commands
25 commands found
/ to searchEscto clear
kubectl get
Display resources
kubectl get podskubectl describe
Show detailed resource information
kubectl describe pod mypodkubectl create
Create resources from file or stdin
kubectl create -f deployment.yamlkubectl apply
Apply configuration to resources
kubectl apply -f deployment.yamlkubectl delete
Delete resources
kubectl delete pod mypodkubectl logs
Print container logs
kubectl logs mypodkubectl exec
Execute command in container
kubectl exec mypod -- ls /appkubectl cp
Copy files to/from containers
kubectl cp mypod:/app/logs.txt ./logs.txtkubectl port-forward
Forward local port to pod
kubectl port-forward mypod 8080:80kubectl expose
Expose resource as service
kubectl expose deployment myapp --port=80kubectl scale
Scale deployment replicas
kubectl scale deployment myapp --replicas=3kubectl autoscale
Auto-scale deployment based on metrics
kubectl autoscale deployment myapp --min=2 --max=10 --cpu-percent=80kubectl rollout
Manage deployment rollouts
kubectl rollout status deployment/myappkubectl set
Set resource attributes
kubectl set image deployment/myapp mycontainer=myimage:v2kubectl edit
Edit resource in editor
kubectl edit deployment myappkubectl config
Manage kubeconfig settings
kubectl config viewkubectl top
Display resource usage
kubectl top nodeskubectl run
Run a pod
kubectl run nginx --image=nginxkubectl label
Add or update labels
kubectl label pods mypod env=productionkubectl annotate
Add or update annotations
kubectl annotate pods mypod description="My app"kubectl taint
Add or remove node taints
kubectl taint nodes mynode key=value:NoSchedulekubectl cordon
Mark node as unschedulable
kubectl cordon mynodekubectl drain
Drain node for maintenance
kubectl drain mynode --ignore-daemonsetskubectl api-resources
List available API resources
kubectl api-resourceskubectl explain
Documentation for resources
kubectl explain pods