-
Notifications
You must be signed in to change notification settings - Fork 3
/
commands.txt
294 lines (294 loc) · 9.26 KB
/
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
1 sudo su -
2 exit
3 sudo su -
4 mkdir -p $HOME/.kube
5 sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
6 sudo chown $(id -u):$(id -g) $HOME/.kube/config
7 kubectl get pods --namespace kube-system
8 sudo sysctl net.bridge.bridge-nf-call-iptables=1
9 kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
10 kubectl get pods --namespace kube-system
11 kubectl nodes
12 kubectl get nodes
13 kubectl get namespaces
14 ls
15 vi namespace.yaml
16 kubectl apply -f namespace.yaml
17 kubectl get namespaces
18 kubectl get nodes
19 kubectl get pods --namespace kube-system
20 kubectl get namespace
21 ls
22 kubectl delete -f namespace.yaml
23 clear
24 kubectl get namespace
25 vi namespace.yaml
26 kubectl apply -f namespace.yaml
27 kubectl get namespace
28 kubectl config get-contexts
29 kubectl config set-context dev --namespace=development --cluster=kubernetes --user=kubernetes-admin
30 kubectl config get-contexts
31 kubectl config use-context dev
32 kubectl config get-contexts
33 yum install -y git >/dev/null
34 git clone https://github.com/gkdevops/kubernetes-code.git
35 ls
36 cd kubernetes-code/
37 ls
38 vi resourceLimits.yml
39 vi resoureQuota.yml
40 kubectl get namespace
41 kubectl get namespace -o wide
42 kubectl describe namespace development
43 kubectl apply -f resoureQuota.yml
44 vi resoureQuota.yml
45 kubectl apply -f resoureQuota.yml
46 kubectl describe namespace development
47 vi resourceLimits.yml
48 ls
49 vi LimitRange.yaml
50 kubectl apply -f LimitRange.yaml --namespace development
51 kubectl describe namespace development
52 vi pod.yaml
53 kubectl apply -f pod.yaml
54 vi LimitRange.yaml
55 kubectl apply -f LimitRange.yaml --namespace development
56 vi LimitRange.yaml
57 kubectl apply -f LimitRange.yaml --namespace development
58 kubectl -f delete LimitRange.yaml
59 kubectl delete -f LimitRange.yaml
60 kubectl describe namespace development
61 kubectl apply -f pod.yaml
62 vi resourceLimits.yml
63 vi pod.yaml
64 kubectl apply -f pod.yaml
65 vi pod.yaml \
66 vi pod.yaml
67 kubectl apply -f pod.yaml
68 kubectl describe namespace development
69 kubectl get ppods
70 kubectl get pods
71 kubectl get pods -o wide
72 kubectl describe pod sample-pod
73 kubectl get pods
74 kubectl delete pod sample-pod
75 kubectl get pods
76 vi replicaSet.yaml
77 kubectl apply -f replicaSet.yaml
78 vi replicaSet.yaml
79 kubectl describe namespace development
80 kubectl get pods
81 kubectl get replicaset
82 kubectl delete -f resoureQuota.yml
83 kubectl get replicaset
84 kubectl get pods
85 kubectl apply -f replicaSet.yaml
86 kubectl get pods
87 vi replicaSet.yaml
88 kubectl delete -f replicaSet.yaml
89 kubectl apply -f replicaSet.yaml
90 kubectl get pods
91 kubectl get replicaset
92 kubectl get replicaset -o wide
93 kubectl get pods
94 kubectl delete pod my-replica-4vx4j
95 kubectl get pods
96 vi replicaSet.yaml
97 kubectl apply -f replicaSet.yaml
98 kubectl get replicaset
99 kubectl get pods
100 vi replicaSet.yaml
101 kubectl apply -f replicaSet.yaml
102 kubectl get pods
103 kubectl get rollout status deployment.v1.apps/nginx-deployment
104 kubectl get rollout status deployment.apps.v1/nginx-deployment
105 kubectl rollout status deployment.v1.apps/nginx-deployment
106 kubectl get nodes
107 kubectl get all
108 ls
109 cd kubernetes-code/
110 ls
111 kubectl delete -f replicaSet.yaml
112 clear
113 ls
114 vi pod.yaml
115 kubectl delete -f resoureQuota.yml
116 clear
117 vi pod.yaml
118 kubectl get pods
119 kubectl apply -f pod.yaml
120 kubectl get pods
121 kubectl get pods -o wide
122 kubectl delete pod sample-pod
123 vi replicaSet.yaml
124 kubectl get pods
125 kubectl apply -f replicaSet.yaml
126 kubectl get replicaset
127 kubectl get pods
128 vi replicaSet.yaml
129 kubectl apply -f replicaSet.yaml
130 kubectl get replicaset
131 kubectl get pods
132 vi replicaSet.yaml
133 kubectl apply -f replicaSet.yaml
134 kubectl get replicaset
135 kubectl get pods
136 kubectl delete pod my-replica-4547b my-replica-zmk6j
137 kubectl get pods
138 kubectl delete -f replicaSet.yaml
139 kubectl get pods
140 vi deployment.yaml
141 clear
142 kubectl get all
143 vi deployment.yaml
144 kubectl apply -f deployment.yaml
145 kubectl get deployment
146 kubectl get replicaset
147 kubectl get pods
148 vi deployment.yaml
149 kubectl apply -f deployment.yaml
150 kubectl get deployment
151 kubectl get replicaset
152 vi deployment.yaml
153 kubectl apply -f deployment.yaml
154 kubectl get pods
155 vi deployment.yaml
156 kubectl apply -f deployment.yaml
157 kubectl get deployment
158 kubectl get replicaset
159 vi deployment.yaml
160 kubectl apply -f deployment.yaml
161 kubectl get replicaset
162 ls
163 cd kubernetes-code/
164 ls
165 kubectl get all
166 kubectl delete -f deployment.yaml
167 clear
168 ls
169 vi deployment.yaml
170 kubectl apply -f deployment.yaml
171 kubectl get deployment
172 kubectl get replicaset
173 vi deployment.yaml
174 vi deployment.yaml
175 kubectl apply -f deployment.yaml
176 kubectl get deployment
177 vi deployment.yaml
178 kubectl apply -f deployment.yaml
179 kubectl get replicaset
180 vi deployment.yaml
181 kubectl apply -f deployment.yaml
182 kubectl get replicaset
183 vi deployment-strategy-rolling.yaml
184 kubectl describe deployment nginx-deployment
185 vi deployment-strategy-recreate.yaml
186 kubectl get pod
187 vi deployment.yaml
188 ls
189 vi live-ready-check.yaml
190 cp deployment.yaml deployment-live-ready.yaml
191 vi deployment-live-ready.yaml
192 kubectl delete -f deployment.yaml
193 kubectl get all
194 clear
195 kubectl apply -f deployment-live-ready.yaml
196 kubectl get deployment
197 ls
198 cat * | grep -i "stop"
199 cat * | grep -i "Pre"
200 cat * | grep -i "start"
201 clear
202 cp deployment.yaml deployment-start-stop.yaml
203 vi deployment-start-stop.yaml
204 kubectl delete -f deployment-live-ready.yaml
205 kubectl apply -f deployment-start-stop.yaml
206 kubectl get pods
207 kubectl describe pod nginx-deployment-686c86b76-98g62
208 ls
209 vi deployment-env.yaml
210 clear
211 ls
212 vi configMap-env.yaml
213 vi deployment.yaml
214 kubectl get nodes
215 clear
216 ls
217 cd kubernetes-code/
218 ls
219 vi configMap-env.yaml
220 kubectl get all
221 kubectl delete -f deployment-start-stop.yaml
222 clear
223 kubectl get all
224 kubectl delete -f nodePort.yaml
225 kubectl delete pod sample-pod
226 kubectl get all
227 clear
228 kubectl get configmap
229 kubectl apply -f configMap-env.yaml
230 kubectl get configmap
231 kubectl describe configmap cm-demo
232 vi deployment-env.yaml
233 kubectl apply -f deployment-env.yaml
234 kubectl get pod
235 kubectl exec -i --tty nginx-deployment-69f8995445-5t5jb -- bash
236 vi configMap-file.yaml
237 kubectl apply -f configMap-file.yaml
238 kubectl describe configmap my-configxml
239 kubectl create configmap my-config --from-file=/etc/passwd
240 kubectl describe configmap my-config
241 kubectl create deployment abc --image=aipine:latest
242 kubectl get deployment
243 kubectl get deployment abc
244 kubectl get deployment abc -o yaml
245 kubectl get deployment abc -o yaml > abc.yaml
246 vi abc.yaml
247 ls
248 vi deployment-file.yaml
249 kubectl delete -f abc.yaml deployment-env.yaml
250 kubectl delete -f abc.yaml
251 kubectl delete -f deployment-env.yaml
252 kubectl get deployment
253 kubectl apply -f deployment-file.yaml
254 kubectl get pod
255 kubectl exec -i --tty nginx-deployment-74565b6dd7-bmztl -- bash
256 ls
257 vi secret.yaml
258 kubectl apply -f secret.yaml
259 kubectl describe secret my-secret
260 vi deployment-secret.yaml
261 kubectl get rs
262 kubectl get deployment
263 kubectl delete -f deployment-file.yaml
264 kubectl get deployment
265 kubectl apply -f deployment-secret.yaml
266 kubectl get po
267 kubectl exec -i --tty nginx-deployment-756cf7c8f4-7ntbd -- bash
268 kubectl delete -f deployment-secret.yaml
269 kubectl get all
270 clear
271 history
272 kubectl get pods
273 kubectl apply -f deployment.yaml
274 vi deployment.yaml
275 kubectl get pods
276 vi deployment.yaml
277 vi clusterIP.yaml
278 kubectl get services
279 kubectl apply -f clusterIP.yaml
280 kubectl get services
281 ls
282 kubectl apply -f pod.yaml
283 vi clusterIP.yaml
284 kubectl secribe service my-service
285 kubectl describe service my-service
286 kubectl get pods -o wide
287 kubectl exec -i --tty sample-pod -- bash
288 kubectl delete -f clusterIP.yaml
289 vi nodePort.yaml
290 kubectl apply -f nodePort.yaml
291 kubectl describe service my-service
292 ls
293 vi nodePort.yaml
294 history