-
Notifications
You must be signed in to change notification settings - Fork 2
/
kubectl-alias.sh
565 lines (413 loc) · 34.6 KB
/
kubectl-alias.sh
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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
#!/bin/bash
# ======================================================================================================================
# ================================================================================================================ General
# ======================================================================================================================
alias k=" kubectl"
alias wkga="watch kubectl get pods,replicasets,deployments,services,ingress,serviceaccounts,configmaps,secrets,jobs,cronjobs,persistentvolumes,persistentvolumeclaims,resourcequotas,limitranges,daemonsets,statefulsets,quota,roles,rolebinding,networkpolicy,nodes,namespaces -o wide"
alias wkgan="watch kubectl get pods,replicasets,deployments,services,ingress,serviceaccounts,configmaps,secrets,jobs,cronjobs,persistentvolumes,persistentvolumeclaims,resourcequotas,limitranges,daemonsets,statefulsets,quota,roles,rolebinding,networkpolicy,nodes,namespaces -o wide --namespace"
alias wkgaan="watch kubectl get pods,replicasets,deployments,services,ingress,serviceaccounts,configmaps,secrets,jobs,cronjobs,persistentvolumes,persistentvolumeclaims,resourcequotas,limitranges,daemonsets,statefulsets,quota,roles,rolebinding,networkpolicy,nodes,namespaces -o wide --all-namespaces"
alias wkgas="watch kubectl get pods,replicasets,deployments,services,ingress,serviceaccounts,configmaps,secrets,jobs,cronjobs,persistentvolumes,persistentvolumeclaims,resourcequotas,limitranges,daemonsets,statefulsets,quota,roles,rolebinding,networkpolicy,nodes,namespaces -o wide --selector"
alias c="clear"
#alias g=' bash /home/trl/IdeaProjects/Programming-Training-And-Practice/kubernetes-main-information/get-the-most-used-information-about-kubernetes-objects.sh'
#alias gn=' bash /home/trl/IdeaProjects/Programming-Training-And-Practice/kubernetes-main-information/get-the-most-used-information-about-kubernetes-objects-from-namespace.sh'
#alias ga=' bash /home/trl/IdeaProjects/Programming-Training-And-Practice/kubernetes-main-information/get-all-information-about-kubernetes-objects.sh'
#alias gan='bash /home/trl/IdeaProjects/Programming-Training-And-Practice/kubernetes-main-information/get-all-information-about-kubernetes-objects-for-namespace.sh'
# ======================================================================================================================
# ================================================================================================================ Apply
# ======================================================================================================================
alias ka=" kubectl apply"
alias kaf=" kubectl apply -f"
# ======================================================================================================================
# ================================================================================================================ Attach
# ======================================================================================================================
# ======================================================================== apiservices
# ======================================================================== bindings
# ======================================================================== configmaps
# ======================================================================== cronjobs
# ======================================================================== csinodes
# ======================================================================== componentstatuses
# ======================================================================== clusterroles
# ======================================================================== clusterrolebindings
# ======================================================================== customresourcedefinitions
# ======================================================================== controllerrevisions
# ======================================================================== certificatesigningrequests
# ======================================================================== csidrivers
# ======================================================================== deployments
# ======================================================================== daemonsets
# ======================================================================== endpoints
# ======================================================================== events
# ======================================================================== endpointslices
# ======================================================================== events
# ======================================================================== horizontalpodautoscalers
# ======================================================================== ingresses
# ======================================================================== jobs
# ======================================================================== limitranges
# ======================================================================== localsubjectaccessreviews
# ======================================================================== leases
# ======================================================================== mutatingwebhookconfigurations
# ======================================================================== nodes
# ======================================================================== namespaces
# ======================================================================== networkpolicies
# ======================================================================== pods
# ======================================================================== persistentvolumes
# ======================================================================== persistentvolumeclaims
# ======================================================================== podtemplates
# ======================================================================== poddisruptionbudgets
# ======================================================================== priorityclasses
# ======================================================================== podsecuritypolicies
# ======================================================================== replicasets
# ======================================================================== replicationcontrollers
# ======================================================================== resourcequotas
# ======================================================================== roles
# ======================================================================== rolebindings
# ======================================================================== runtimeclasses
# ======================================================================== services
# ======================================================================== serviceaccounts
# ======================================================================== secrets
# ======================================================================== statefulsets
# ======================================================================== selfsubjectaccessreviews
# ======================================================================== selfsubjectrulesreviews
# ======================================================================== subjectaccessreviews
# ======================================================================== storageclasses
# ======================================================================== tokenreviews
# ======================================================================== validatingwebhookconfigurations
# ======================================================================== volumeattachments
# ======================================================================================================================
# ================================================================================================================ Create
# ======================================================================================================================
alias kc=" kubectl create"
alias kcf=" kubectl create -f"
# ======================================================================== apiservices
# ======================================================================== bindings
# ======================================================================== configmaps
alias kccm=" kubectl create configmap"
# ======================================================================== cronjobs
# ======================================================================== csinodes
# ======================================================================== componentstatuses
# ======================================================================== clusterroles
# ======================================================================== clusterrolebindings
# ======================================================================== customresourcedefinitions
# ======================================================================== controllerrevisions
# ======================================================================== certificatesigningrequests
# ======================================================================== csidrivers
# ======================================================================== deployments
# ======================================================================== daemonsets
# ======================================================================== endpoints
# ======================================================================== events
# ======================================================================== endpointslices
# ======================================================================== events
# ======================================================================== horizontalpodautoscalers
# ======================================================================== ingresses
# ======================================================================== jobs
# ======================================================================== limitranges
# ======================================================================== localsubjectaccessreviews
# ======================================================================== leases
# ======================================================================== mutatingwebhookconfigurations
# ======================================================================== nodes
# ======================================================================== namespaces
alias kcns=" kubectl create namespace"
# ======================================================================== networkpolicies
# ======================================================================== pods
# ======================================================================== persistentvolumes
# ======================================================================== persistentvolumeclaims
# ======================================================================== podtemplates
# ======================================================================== poddisruptionbudgets
# ======================================================================== priorityclasses
# ======================================================================== podsecuritypolicies
# ======================================================================== replicasets
# ======================================================================== replicationcontrollers
# ======================================================================== resourcequotas
# ======================================================================== roles
# ======================================================================== rolebindings
# ======================================================================== runtimeclasses
# ======================================================================== services
# ======================================================================== serviceaccounts
alias kcsa=" kubectl create serviceaccount"
# ======================================================================== secrets
# ======================================================================== statefulsets
# ======================================================================== selfsubjectaccessreviews
# ======================================================================== selfsubjectrulesreviews
# ======================================================================== subjectaccessreviews
# ======================================================================== storageclasses
# ======================================================================== tokenreviews
# ======================================================================== validatingwebhookconfigurations
# ======================================================================== volumeattachments
# ======================================================================================================================
# ================================================================================================================ Config
# ======================================================================================================================
alias kconf=" kubectl config"
alias kconfcc=" kubectl config current-context"
alias kconfdc=" kubectl config delete-context"
alias kconfgc=" kubectl config get-contexts"
alias kconfn=" kubectl config set-context $(kubectl config current-context) --namespace"
alias kconfsc=" kubectl config set-context"
alias kconfuc=" kubectl config use-context"
# ======================================================================================================================
# ================================================================================================================ Cordon
# ======================================================================================================================
# ======================================================================================================================
# ================================================================================================================ Cluster-info
# ======================================================================================================================
alias kci=" kubectl cluster-info"
# ======================================================================================================================
# ================================================================================================================ Describe
# ======================================================================================================================
alias kd=" kubectl describe"
# ======================================================================== apiservices
# ======================================================================== bindings
# ======================================================================== configmaps
alias kdcm=" kubectl describe configmap"
# ======================================================================== cronjobs
# ======================================================================== csinodes
# ======================================================================== componentstatuses
# ======================================================================== clusterroles
# ======================================================================== clusterrolebindings
# ======================================================================== customresourcedefinitions
# ======================================================================== controllerrevisions
# ======================================================================== certificatesigningrequests
# ======================================================================== csidrivers
# ======================================================================== deployments
alias kdd=" kubectl describe deployment"
# ======================================================================== daemonsets
# ======================================================================== endpoints
# ======================================================================== events
# ======================================================================== endpointslices
# ======================================================================== events
# ======================================================================== horizontalpodautoscalers
# ======================================================================== ingresses
alias kdi=" kubectl describe ingress"
alias kdin=" kubectl describe ingress --namespace"
# ======================================================================== jobs
# ======================================================================== limitranges
# ======================================================================== localsubjectaccessreviews
# ======================================================================== leases
# ======================================================================== mutatingwebhookconfigurations
# ======================================================================== nodes
alias kdn=" kubectl describe node"
# ======================================================================== namespaces
alias kdns=" kubectl describe namespace"
# ======================================================================== networkpolicies
alias kdnetpol=" kubectl describe networkpolicy"
alias kdnetpoln=" kubectl describe networkpolicy --namespace"
# ======================================================================== pods
alias kdp=" kubectl describe pods"
alias kdpn=" kubectl describe pods --namespace"
# ======================================================================== persistentvolumes
alias kdpv=" kubectl describe persistentvolume"
# ======================================================================== persistentvolumeclaims
alias kdpvc=" kubectl describe persistentvolumeclaim"
# ======================================================================== podtemplates
# ======================================================================== poddisruptionbudgets
# ======================================================================== priorityclasses
# ======================================================================== podsecuritypolicies
# ======================================================================== replicasets
alias kdrs=" kubectl describe replicaset"
# ======================================================================== replicationcontrollers
# ======================================================================== resourcequotas
# ======================================================================== roles
alias kdr=" kubectl describe roles"
# ======================================================================== rolebindings
alias kdrb=" kubectl describe rolebinding"
# ======================================================================== runtimeclasses
# ======================================================================== services
alias kdsvc=" kubectl describe service"
# ======================================================================== secrets
alias kdsec=" kubectl describe secret"
# ======================================================================== serviceaccounts
# ======================================================================== statefulsets
alias kdsts=" kubectl describe statefulset"
# ======================================================================== selfsubjectaccessreviews
# ======================================================================== selfsubjectrulesreviews
# ======================================================================== subjectaccessreviews
# ======================================================================== storageclasses
# ======================================================================== tokenreviews
# ======================================================================== validatingwebhookconfigurations
# ======================================================================== volumeattachments
# ======================================================================================================================
# ================================================================================================================ Delete
# ======================================================================================================================
alias kdel=" kubectl delete"
alias kdelf=" kubectl delete -f"
alias kdeln=" kubectl delete node"
alias kdelp=" kubectl delete pods"
alias kdelrs=" kubectl delete replicaset"
alias kdeld=" kubectl delete deployment"
alias kdelns=" kubectl delete namespace"
alias kdelsvc=" kubectl delete service"
alias kdelcm=" kubectl delete configmap"
alias kdelsec=" kubectl delete secret"
alias kdelpvc=" kubectl delete persistentvolumeclaim"
alias kdelpv=" kubectl delete persistentvolume"
alias kdeli=" kubectl delete ingress"
alias kdelss=" kubectl delete statefulset"
alias kdelnetpol=" kubectl delete networkpolicy"
# ======================================================================================================================
# ================================================================================================================ Edit
# ======================================================================================================================
alias ke=" kubectl edit"
alias ken=" kubectl edit node"
alias kep=" kubectl edit pods"
alias kers=" kubectl edit replicaset"
alias ked=" kubectl edit deployment"
alias kens=" kubectl edit namespace"
alias kepvc=" kubectl edit persistentvolumeclaim"
alias kei=" kubectl edit ingress"
alias kesvc=" kubectl edit service"
alias kecm=" kubectl edit configmap"
alias kess=" kubectl edit statefulset"
alias kenetpol=" kubectl edit networkpolicy"
# ======================================================================================================================
# ================================================================================================================ Explain
# ======================================================================================================================
alias kex=" kubectl explain"
alias kexn=" kubectl explain node.spec"
alias kexp=" kubectl explain pod.spec"
alias kexrs=" kubectl explain replicaset.spec"
alias kexd=" kubectl explain deployment.spec"
# ======================================================================================================================
# ================================================================================================================ Get
# ======================================================================================================================
alias kg=' kubectl get -o wide'
#kubectl get deployments,services,ingresses,pods,nodes,namespaces,replicasets,configmaps,secrets,persistentvolumeclaims,persistentvolumes,serviceaccounts,networkpolicies,roles,rolebindings,clusterroles,clusterrolebindings,jobs,cronjobs,daemonsets,limitranges,statefulsets,resourcequotas,apiservices,csinodes,componentstatuses,customresourcedefinitions,controllerrevisions,certificatesigningrequests,csidrivers,endpoints,events,endpointslices,horizontalpodautoscalers,leases,mutatingwebhookconfigurations,podtemplates,poddisruptionbudgets,priorityclasses,podsecuritypolicies,replicationcontrollers,runtimeclasses,storageclasses,validatingwebhookconfigurations,volumeattachments
alias kga=" kubectl get pods,replicasets,deployments,services,ingress,serviceaccounts,configmaps,secrets,jobs,cronjobs,persistentvolumes,persistentvolumeclaims,resourcequotas,limitranges,daemonsets,statefulsets,quota,roles,rolebinding,networkpolicy,nodes,namespaces -o wide"
alias kgan=" kubectl get pods,replicasets,deployments,services,ingress,serviceaccounts,configmaps,secrets,jobs,cronjobs,persistentvolumes,persistentvolumeclaims,resourcequotas,limitranges,daemonsets,statefulsets,quota,roles,rolebinding,networkpolicy,nodes,namespaces -o wide --namespace"
alias kgaan=" kubectl get pods,replicasets,deployments,services,ingress,serviceaccounts,configmaps,secrets,jobs,cronjobs,persistentvolumes,persistentvolumeclaims,resourcequotas,limitranges,daemonsets,statefulsets,quota,roles,rolebinding,networkpolicy,nodes,namespaces -o wide --all-namespaces"
alias kgas=" kubectl get pods,replicasets,deployments,services,ingress,serviceaccounts,configmaps,secrets,jobs,cronjobs,persistentvolumes,persistentvolumeclaims,resourcequotas,limitranges,daemonsets,statefulsets,quota,roles,rolebinding,networkpolicy,nodes,namespaces -o wide --selector"
# ======================================================================== apiservices
# ======================================================================== bindings
# ======================================================================== configmaps
alias kgcm=" kubectl get configmaps -o wide"
alias kgcmn=" kubectl get configmaps -o wide --namespace"
alias kgcman=" kubectl get configmaps -o wide --all-namespaces"
alias kgcmw=" kubectl get configmaps -o wide --watch"
# ======================================================================== cronjobs
# ======================================================================== csinodes
# ======================================================================== componentstatuses
# ======================================================================== clusterroles
# ======================================================================== clusterrolebindings
# ======================================================================== customresourcedefinitions
# ======================================================================== controllerrevisions
# ======================================================================== certificatesigningrequests
# ======================================================================== csidrivers
# ======================================================================== deployments
alias kgd=" kubectl get deployments -o wide"
alias kgdn=" kubectl get deployments -o wide --namespace"
alias kgdan=" kubectl get deployments -o wide --all-namespaces"
alias kgdw=" kubectl get deployments -o wide --watch"
# ======================================================================== daemonsets
# ======================================================================== endpoints
# ======================================================================== events
# ======================================================================== endpointslices
# ======================================================================== events
# ======================================================================== horizontalpodautoscalers
# ======================================================================== ingresses
alias kgi=" kubectl get ingress -o wide"
alias kgin=" kubectl get ingress -o wide --namespace"
alias kgian=" kubectl get ingress -o wide --all-namespaces"
alias kgiw=" kubectl get ingress -o wide --watch"
# ======================================================================== jobs
# ======================================================================== limitranges
# ======================================================================== localsubjectaccessreviews
# ======================================================================== leases
# ======================================================================== mutatingwebhookconfigurations
# ======================================================================== nodes
alias kgn=" kubectl get nodes -o wide "
# ======================================================================== namespaces
alias kgns=" kubectl get namespace -o wide"
# ======================================================================== networkpolicies
alias kgnetpol=" kubectl get networkpolicy -o wide"
alias kgnetpoln=" kubectl get networkpolicy -o wide --namespace"
alias kgnetpolan=" kubectl get networkpolicy -o wide --all-namespaces"
alias kgnetpolw=" kubectl get networkpolicy -o wide --watch"
# ======================================================================== pods
alias kgp=' kubectl get pods -o wide'
alias kgpn=' kubectl get pods -o wide --namespace'
alias kgpan=" kubectl get pods -o wide --all-namespaces"
alias kgpw=" kubectl get pods -o wide --watch"
# ======================================================================== persistentvolumes
alias kgpv=" kubectl get persistentvolume -o wide"
alias kgpvn=" kubectl get persistentvolume -o wide --namespace"
alias kgpvan=" kubectl get persistentvolume -o wide --all-namespaces"
alias kgpvw=" kubectl get persistentvolume -o wide --watch"
# ======================================================================== persistentvolumeclaims
alias kgpvc=" kubectl get persistentvolumeclaims -o wide"
alias kgpvcn=" kubectl get persistentvolumeclaims -o wide --namespace"
alias kgpvcan=" kubectl get persistentvolumeclaims -o wide --all-namespaces"
alias kgpvcw=" kubectl get persistentvolumeclaims -o wide --watch"
# ======================================================================== podtemplates
# ======================================================================== poddisruptionbudgets
# ======================================================================== priorityclasses
# ======================================================================== podsecuritypolicies
# ======================================================================== replicasets
alias kgrs=" kubectl get replicasets -o wide"
alias kgrsn=" kubectl get replicasets -o wide --namespace"
alias kgrsan=" kubectl get replicasets -o wide --all-namespaces"
alias kgrsw=" kubectl get replicasets -o wide --watch"
# ======================================================================== replicationcontrollers
# ======================================================================== resourcequotas
# ======================================================================== roles
# ======================================================================== rolebindings
# ======================================================================== runtimeclasses
# ======================================================================== services
alias kgsvc=" kubectl get service -o wide"
alias kgsvcn=" kubectl get service -o wide --namespace"
alias kgsvcan=" kubectl get service -o wide --all-namespaces"
alias kgsvcw=" kubectl get service -o wide --watch"
# ======================================================================== serviceaccounts
alias kgsa=" kubectl get serviceaccount -o wide"
alias kgsan=" kubectl get serviceaccount -o wide --namespace"
alias kgsaan=" kubectl get serviceaccount -o wide --all-namespaces"
alias kgsaw=" kubectl get serviceaccount -o wide --watch"
# ======================================================================== secrets
alias kgsec=" kubectl get secret -o wide"
alias kgsecn=" kubectl get secret -o wide --namespace"
alias kgsecan=" kubectl get secret -o wide --all-namespaces"
alias kgsecw=" kubectl get secret -o wide --watch"
# ======================================================================== statefulsets
alias kgss=" kubectl get statefulset -o wide"
alias kgssn=" kubectl get statefulset -o wide --namespace"
alias kgssan=" kubectl get statefulset -o wide --all-namespaces"
alias kgssw=" kubectl get statefulset -o wide --watch"
# ======================================================================== selfsubjectaccessreviews
# ======================================================================== selfsubjectrulesreviews
# ======================================================================== subjectaccessreviews
# ======================================================================== storageclasses
# ======================================================================== tokenreviews
# ======================================================================== validatingwebhookconfigurations
# ======================================================================== volumeattachments
# ======================================================================================================================
# ================================================================================================================ Log
# ======================================================================================================================
alias kl=" kubectl logs"
alias klf=" kubectl logs -f"
alias kl1h=" kubectl logs --since 1h"
alias kl1m=" kubectl logs --since 1m"
alias kl1s=" kubectl logs --since 1s"
alias klf1h=" kubectl logs --since 1h -f"
alias klf1m=" kubectl logs --since 1m -f"
alias klf1s=" kubectl logs --since 1s -f"
# ======================================================================================================================
# ================================================================================================================ Port-Forward
# ======================================================================================================================
alias kpf=" kubectl port-forward"
# ======================================================================================================================
# ================================================================================================================ Rollout
# ======================================================================================================================
alias krl=" kubectl rollout"
alias krls=" kubectl rollout status"
alias krlsd=" kubectl rollout status deployment"
alias krlsss=" kubectl rollout status statefulset"
alias krlh=" kubectl rollout history"
alias krlhd=" kubectl rollout history deployment"
alias krlu=" kubectl rollout undo"
alias krlud=" kubectl rollout undo deployment"
# ======================================================================================================================
# ================================================================================================================ Run
# ======================================================================================================================
alias kr=" kubectl run"
# ======================================================================================================================
# ================================================================================================================ Scale
# ======================================================================================================================
alias ks=" kubectl scale"
alias ksd=" kubectl scale deployment"
alias ksss=" kubectl scale statefulset"