-
Notifications
You must be signed in to change notification settings - Fork 2
/
kubernetes-commands.txt
84 lines (59 loc) · 1.94 KB
/
kubernetes-commands.txt
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/* list of all commands */
kubectl OR kubectl help
/* display cluster information */
kubectl cluster-info
/* display version */
kubectl version
/* display all resources */
kubectl get all
/* display all deployments */
kubectl get deployments
/* display all replicasets */
kubectl get replicaset
/* display all pods */
kubectl get pod
/* display all services */
kubectl get services
/* display all nodes */
kubectl get nodes
/* create deployment */
kubectl create deployment << Deployment Name >> --image=<< Image Name >>
/* edit deployment */
kubectl edit deployment << Deployment Name >>
/* delete deployment */
kubectl delete deployment << Deployment Name >>
/* delete pod */
kubectl delete pod << Pod Name >>
/* delete service */
kubectl delete service << Service Name >>
/* create pod from image */
kubectl run << Pod Name >> --image=<< Image Name >>
/* description of pod */
kubectl describe pod << Pod Name >>
/* description of service */
kubectl describe service << Service Name >>
/* port setup */
kubectl port-forward << Pod Name >> << New Port >>:80
/* check pod logs */
kubectl logs << Pod Name >>
/* open interactive terminal of a pod */
kubectl exec << Pod Name >> -it sh
/* commands for interactive terminal */
ls -- to see the folder structure
mongo -- to execute mongo commands
/* declarative commands */
kubectl create -f << File Name >>
kubectl apply -f << File Name >>
kubectl delete -f << File Name >>
kubectl get deployment << Deployment Name >> -o yaml
/* dashboard configuration */
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.3.1/aio/deploy/recommended.yaml
kubectl describe secret -n kube-system
kubectl proxy
http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
/* display all clusters */
kubectl config get-contexts
/* display current cluster */
kubectl config current-context
/* set current cluster */
kubectl config use-context << Context Name >>