summaryrefslogtreecommitdiffstats
path: root/cheats/kubernetes.cheat
blob: ef14432b0e19e00502f4cd60935f65d1ef2a5b94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
% kubernetes, k8s

# Print resource documentation
kubectl explain <resource>

# Get nodes (add option '-o wide' for details)
kubectl get nodes

# Get namespaces
kubectl get namespaces

# Get pods from namespace (add option '-o wide' for details)
kubectl get pods -n <namespace>

# Get pods from all namespace (add option '-o wide' for details)
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>