2019-09-20 13:38:58 +00:00
|
|
|
% kubernetes, k8s
|
|
|
|
|
2019-09-22 09:09:47 +00:00
|
|
|
# Print resource documentation
|
|
|
|
kubectl explain <resource>
|
2019-09-20 13:38:58 +00:00
|
|
|
|
2019-09-23 18:08:36 +00:00
|
|
|
# Get nodes (add option `-o wide` for details)
|
2019-09-22 09:09:47 +00:00
|
|
|
kubectl get nodes
|
|
|
|
|
|
|
|
# Get namespaces
|
|
|
|
kubectl get namespaces
|
|
|
|
|
2019-09-23 18:08:36 +00:00
|
|
|
# Get pods from namespace (add option `-o wide` for details)
|
2019-09-22 09:09:47 +00:00
|
|
|
kubectl get pods -n <namespace>
|
|
|
|
|
2019-09-23 18:08:36 +00:00
|
|
|
# Get pods from all namespace (add option `-o wide` for details)
|
2019-09-22 09:09:47 +00:00
|
|
|
kubectl get pods --all-namespaces
|
|
|
|
|
|
|
|
# Get services from namespace
|
|
|
|
kubectl get services -n <namespace>
|
|
|
|
|
|
|
|
# Get details from resource on namespace
|
|
|
|
kubectl describe <resource>/<name> -n <namespace>
|
|
|
|
|
|
|
|
# Print logs from namespace
|
|
|
|
kubectl logs -f pods/<name> -n <namespace>
|
|
|
|
|
|
|
|
# Get deployments
|
|
|
|
kubectl get deployments -n <namespace>
|
|
|
|
|
|
|
|
# Edit deployments
|
|
|
|
kubectl edit deployment/<name> -n <namespace>
|
|
|
|
|
|
|
|
# Drain node in preparation for maintenance
|
|
|
|
kubectl drain <name>
|
|
|
|
|
|
|
|
# Mark node as schedulable
|
|
|
|
kubectl uncordon <name>
|
|
|
|
|
|
|
|
# Mark node as unschedulable
|
|
|
|
kubectl cordon <name>
|
|
|
|
|
|
|
|
# Display resource (cpu/memory/storage) usage
|
|
|
|
kubectl top <type>
|