k8s常用命令2

  1. kubectl describe pod taskcenter-ol-m57rt - 查看指定 Pod 的详细信息。

  2. kubectl describe pod taskcenter-ol-m57rt -n dahuadltp-2 - 查看指定 Namespace 中的 Pod 详细信息。

  3. kubectl get pod -n dahuadltp-2 | grep 38438-0bb6c1be-2952-11eb-b5fd-0242ac1e8b04 - 获取指定 Namespace 中名称包含关键字 "38438-0bb6c1be-2952-11eb-b5fd-0242ac1e8b04" 的 Pod 信息。

  4. kubectl get pod -A | grep 38438-0bb6c1be-2952 - 获取所有 Namespace 中名称包含关键字 "38438-0bb6c1be-2952" 的 Pod 信息。

  5. kubectl get pod -A | grep 38438 - 获取所有 Namespace 中名称包含关键字 "38438" 的 Pod 信息。

  6. kubectl get pod 38438-53b28456-2acb-11eb-bf4b-0242ac1e5b04 -n kube-system - 获取指定 Namespace 中指定 Pod 的信息。

  7. kubectl get pod -n kube-system | grep 38438-53b28456-2acb-11eb-bf4b - 获取指定 Namespace 中名称包含关键字 "38438-53b28456-2acb-11eb-bf4b" 的 Pod 信息。

  8. kubectl get pods -o wide -A | grep "27711-3b61bb2a-289a-11eb-8f29-0242ac1e7b1b" - 获取名称包含关键字 "27711-3b61bb2a-289a-11eb-8f29-0242ac1e7b1b" 的 Pod 信息。

  9. kubectl describe nodes 10.30.113.12 - 查看指定 IP 的节点的详细信息。

  10. kubectl get pods -o wide -A | grep "[‎2020/‎11/‎17 15:34] 郭华朋: " - 获取包含特定信息的 Pod 信息。

  11. kubectl get pods -o wide -A | grep "27711-773415fa-28a7-11eb-9de7-0242ac1e7b1b" - 获取名称包含关键字 "27711-773415fa-28a7-11eb-9de7-0242ac1e7b1b" 的 Pod 信息。

  12. kubectl describe pod 27711-773415fa-28a7-11eb-9de7-0242ac1e7b1b -n jinn-test-4 - 查看指定 Namespace 中指定 Pod 的详细信息。

  13. kubectl describe nodes 10.30.113.11 - 查看指定 IP 的节点的详细信息。

  14. kubectl describe pods 27711-0be3a42c-28a8-11eb-8ec4-0242ac1e7b1b - 查看指定 Pod 的详细信息。

  15. kubectl describe pods 27711-0be3a42c-28a8-11eb-8ec4-0242ac1e7b1b -n jinn-test-4 - 查看指定 Namespace 中的 Pod 详细信息。

  16. kubectl describe pods 27711-0be3a42c-28a8-11eb-8ec4-0242ac1e7b1b - 查看指定 Pod 的详细信息。

  17. kubectl describe nodes 10.30.113.11 - 查看指定 IP 的节点的详细信息。

  18. kubectl describe pods 27711-0be3a42c-28a8-11eb-8ec4-0242ac1e7b1b -n jinn-test-4 - 查看指定 Namespace 中的 Pod 详细信息。

  19. kubectl describe nodes 10.30.113.11 - 查看指定 IP 的节点的详细信息。

  20. kubectl describe pods 233499-04af570a-287b-11eb-baa5-0242ac1e7b06-85jr5 -n jinn-test-4 - 查看指定 Namespace 中的 Pod 详细信息。

  21. kubectl describe nodes 10.30.113.11 - 查看指定 IP 的节点的详细信息。

  22. kubectl get svc -n jinn-test-4 - 获取指定 Namespace 中的 Service 信息。

  23. kubectl get pod -n jinn-test-4 - 获取指定 Namespace 中的 Pod 信息。

  24. kubectl descrobe pod nnxt-test-9z6dv -n jinn-test-4 - 查看指定 Namespace 中指定 Pod 的详细信息(命令中拼写错误,请修改为 describe)。

  25. kubectl describe pod nnxt-test-9z6dv -n jinn-test-4 - 查看指定 Namespace 中指定 Pod 的详细信息。

  26. kubectl get pods -n kube-system - 获取指定 Namespace 中的 Pod 信息。

  27. kubectl get pods -n kube-system|grep openapi - 获取指定 Namespace 中名称包含关键字 "openapi" 的 Pod 信息。

  28. kubectl get pods -n kube-system|grep webapi - 获取指定 Namespace 中名称包含关键字 "webapi" 的 Pod 信息。

  29. kubectl get po -A- Get Pod information in all Namespaces.

  30. kubectl get po -A |grep 40329-0553885e-3530-11eb-83a2-0242ac1e5b04-rkvtn- Obtain Pod information whose name contains the keyword "40329-0553885e-3530-11eb-83a2-0242ac1e5b04-rkvtn".

  31. kubectl describe po 40329-9f2ffb72-353c-11eb-b7a3-0242ac1e5b04-bvdrc -n dahuadltp-2- View detailed information of the specified Pod in the specified Namespace.

  32. kubectl get node- Get information about all nodes.

  33. kubectl describe po 40329-9f2ffb72-353c-11eb-b7a3-0242ac1e5b04-bvdrc -n dahuadltp-2- View detailed information of the specified Pod in the specified Namespace.

  34. kubectl describe node 10.30.112.9- View detailed information of the node with the specified IP.

  35. kubectl get node | grep 10.30.112.9- Get information about the node with the specified IP.

  36. kubectl describe po 40329-9f2ffb72-353c-11eb-b7a3-0242ac1e5b04-bvdrc -n dahuadltp-2- View detailed information of the specified Pod in the specified Namespace.

  37. kubectl get node- Get information about all nodes.

  38. kubectl describe node 10.30.112.9- View detailed information of the node with the specified IP.

  39. kubectl edit node 10.30.112.9- Edit the node with the specified IP.

  40. kubectl describe node 10.30.112.9- View detailed information of the node with the specified IP.

  41. kubectl edit node 10.30.112.9- Edit the node with the specified IP.

  42. kubectl get po -A -o wide |grep 10.30.112.9- Get Pod information in all Namespaces on the node with the specified IP.

  43. kubectl logs -n kube-system gpumonopoly-device-plugin-daemonset-95q5k- Get the logs of the specified Pod in the specified Namespace.

  44. kubectl delete po -n kube-system gpumonopoly-device-plugin-daemonset-95q5k- Delete the specified Pod in the specified Namespace.

  45. kubectl logs -n kube-system gpumonopoly-device-plugin-daemonset-95q5k- Get the logs of the specified Pod in the specified Namespace.

  46. kubectl get po -A -o wide |grep 10.30.112.9- Get Pod information in all Namespaces on the node with the specified IP.

  47. kubectl get po -A -o wide |grep 10.30.112.9- Get Pod information in all Namespaces on the node with the specified IP.

  48. kubectl get ns- Get information about all Namespaces.

  49. kubectl get sa -n dahuadltp-2- Get the ServiceAccount information in the specified Namespace.

  50. kubectl describe sa -n dahuadltp-2- View ServiceAccount details in the specified Namespace.

  51. kubectl describe secret default-token-p4zkw -n dahuadltp-2- View Secret details in the specified Namespace.

  52. kubectl get pod -n dahuadltp-2- Get Pod information in the specified Namespace.

  53. kubectl describe pod taskcenter-ol-m57rt- View detailed information of a specified Pod.

  54. kubectl describe pod taskcenter-ol-m57rt -n dahuadltp-2- View Pod details in the specified Namespace.

  55. kubectl get pod -n dahuadltp-2 | grep 38438-0bb6c1be-2952-11eb-b5fd-0242ac1e8b04- Obtain Pod information whose name contains the keyword "38438-0bb6c1be-2952-11eb-b5fd-0242ac1e8b04" in the specified Namespace.

  56. kubectl get pod -n dahuadltp-2 | grep 38438-0bb6c1be-2952- Obtain the Pod information whose name contains the keyword "38438-0bb6c1be-2952" in the specified Namespace.

  57. kubectl get pod -A | grep 38438- Get information about all Pods in the Namespace whose names contain the keyword "38438".

  58. kubectl get pod 38438-53b28456-2acb-11eb-bf4b-0242ac1e5b04 -n kube-system- Get information about the specified Pod in the specified Namespace.

  59. kubectl get pod -n kube-system | grep 38438-53b28456-2acb-11eb-bf4b- Obtain Pod information whose name contains the keyword "38438-53b28456-2acb-11eb-bf4b" in the specified Namespace.

  60. kubectl get pod -n dahuadltp | grep 38438-53b28456-2acb-11eb-bf4b- Obtain Pod information whose name contains the keyword "38438-53b28456-2acb-11eb-bf4b" in the specified Namespace.

  61. kubectl get pod -n dahuadltp-2 | grep 38438-53b28456-2acb-11eb-bf4b- Obtain Pod information whose name contains the keyword "38438-53b28456-2acb-11eb-bf4b" in the specified Namespace.

  62. kubectl get pod -n dahuadltp-2 | grep 38438-53b28456-2acb-11eb-bf4b-0242ac1e5b04- Obtain the Pod information whose name contains the keyword "38438-53b28456-2acb-11eb-bf4b-0242ac1e5b04" in the specified Namespace.

  63. kubectl describe nodes 10.30.113.11- View detailed information of the node with the specified IP.

  64. kubectl get pods -o wide -A | grep "27711-3b61bb2a-289a-11eb-8f29-0242ac1e7b1b"- Obtain Pod information whose name contains the keyword "27711-3b61bb2a-289a-11eb-8f29-0242ac1e7b1b".

  65. kubectl describe nodes 10.30.113.12- View detailed information of the node with the specified IP.

  66. kubectl get pods -o wide -A | grep "[‎2020/‎11/‎17 15:34] 郭华朋: "- Get Pod information containing specific information.

  67. kubectl get pods -o wide -A | grep "27711-773415fa-28a7-11eb-9de7-0242ac1e7b1b"- Get Pod information whose name contains the keyword "27711-773415fa-28a7-11eb-9de7-0242ac1e7b1b".

  68. kubectl describe pod 27711-773415fa-28a7-11eb-9de7-0242ac1e7b1b -n jinn-test-4- View detailed information of the specified Pod in the specified Namespace.

  69. kubectl describe nodes 10.30.113.11- View detailed information of the node with the specified IP.

  70. kubectl describe pods 27711-0be3a42c-28a8-11eb-8ec4-0242ac1e7b1b- View detailed information of a specified Pod.

  71. kubectl describe pods 27711-0be3a42c-28a8-11eb-8ec4-0242ac1e7b1b -n jinn-test-4- View Pod details in the specified Namespace.

  72. kubectl describe pods 27711-0be3a42c-28a8-11eb-8ec4-0242ac1e7b1b- View detailed information of a specified Pod.

  73. kubectl describe nodes 10.30.113.11- View detailed information of the node with the specified IP.

  74. kubectl get svc -n jinn-test-4- Get Service information in the specified Namespace.

  75. kubectl get pod -n jinn-test-4- Get Pod information in the specified Namespace.

  76. kubectl descrobe pod nnxt-test-9z6dv -n jinn-test-4- View the detailed information of the specified Pod in the specified Namespace (the spelling in the command is incorrect, please modify it describe).

  77. kubectl describe pod nnxt-test-9z6dv -n jinn-test-4- View detailed information of the specified Pod in the specified Namespace.

  78. kubectl get pods -n kube-system- Get Pod information in the specified Namespace.

  79. kubectl get pods -n kube-system|grep openapi- Obtain Pod information whose name contains the keyword "openapi" in the specified Namespace.

  80. kubectl get pods -n kube-system|grep webapi- Obtain Pod information whose name contains the keyword "webapi" in the specified Namespace.

  81. kubectl get po -A- Get Pod information in all Namespaces.

  82. kubectl get po -A |grep 40329-0553885e-3530-11eb-83a2-0242ac1e5b04-rkvtn- Obtain Pod information whose name contains the keyword "40329-0553885e-3530-11eb-83a2-0242ac1e5b04-rkvtn".

  83. kubectl describe po 40329-9f2ffb72-353c-11eb-b7a3-0242ac1e5b04-bvdrc -n dahuadltp-2- View detailed information of the specified Pod in the specified Namespace.

  84. kubectl get node- Get information about all nodes.

  85. kubectl describe node 10.30.112.9- View detailed information of the node with the specified IP.

  86. kubectl get node | grep 10.30.112.9- Get information about the node with the specified IP.

  87. kubectl describe po 40329-9f2ffb72-353c-11eb-b7a3-0242ac1e5b04-bvdrc -n dahuadltp-2- View detailed information of the specified Pod in the specified Namespace.

  88. kubectl get node- Get information about all nodes.

  89. kubectl describe node 10.30.112.9- View detailed information of the node with the specified IP.

  90. kubectl edit node 10.30.112.9- Edit the node with the specified IP.

  91. kubectl edit node 10.30.112.9- Edit the node with the specified IP.

  92. kubectl get po -A -o wide |grep 10.30.112.9- Get Pod information in all Namespaces on the node with the specified IP.

  93. kubectl logs -n kube-system gpumonopoly-device-plugin-daemonset-95q5k- Get the logs of the specified Pod in the specified Namespace.

  94. kubectl delete po -n kube-system gpumonopoly-device-plugin-daemonset-95q5k- Delete the specified Pod in the specified Namespace.

  95. kubectl logs -n kube-system gpumonopoly-device-plugin-daemonset-95q5k- Get the logs of the specified Pod in the specified Namespace.

  96. kubectl delete po -n kube-system gpumonopoly-device-plugin-daemonset-95q5k- Delete the specified Pod in the specified Namespace.

  97. kubectl get po -A -o wide |grep 10.30.112.9- Get Pod information in all Namespaces on the node with the specified IP.

  98. kubectl delete po -n kube-system gpushare-device-plugin-daemonset-9f5qt- Delete the specified Pod in the specified Namespace.

  99. kubectl get po -A -o wide |grep 10.30.112.9- Get Pod information in all Namespaces on the node with the specified IP.

  100. kubectl get ns- Get information about all Namespaces.

  101. kubectl get sa -n dahuadltp-2- Get the ServiceAccount information in the specified Namespace.

  102. kubectl describe sa -n dahuadltp-2- View ServiceAccount details in the specified Namespace.

  103. kubectl describe secret default-token-p4zkw -n dahuadltp-2- View Secret details in the specified Namespace.

  104. kubectl get pod -n dahuadltp-2- Get Pod information in the specified Namespace.

  105. kubectl describe pod taskcenter-ol-m57rt- View detailed information of a specified Pod.

  106. kubectl describe pod taskcenter-ol-m57rt -n dahuadltp-2- View Pod details in the specified Namespace.

  107. kubectl get pod -n dahuadltp-2 | grep 38438-0bb6c1be-2952-11eb-b5fd-0242ac1e8b04- Obtain Pod information whose name contains the keyword "38438-0bb6c1be-2952-11eb-b5fd-0242ac1e8b04" in the specified Namespace.

  108. kubectl get pod 38438-53b28456-2acb-11eb-bf4b-0242ac1e5b04 -n kube-system- Get information about the specified Pod in the specified Namespace.

  109. kubectl get pod -n kube-system | grep 38438-53b28456-2acb-11eb-bf4b- Obtain Pod information whose name contains the keyword "38438-53b28456-2acb-11eb-bf4b" in the specified Namespace.

  110. kubectl get pod -n dahuadltp | grep 38438-53b28456-2acb-11eb-bf4b- Obtain Pod information whose name contains the keyword "38438-53b28456-2acb-11eb-bf4b" in the specified Namespace.

  111. kubectl describe nodes 10.30.113.11- View detailed information of the node with the specified IP.

  112. kubectl get pods -o wide -A | grep "27711-3b61bb2a-289a-11eb-8f29-0242ac1e7b1b"- Obtain Pod information whose name contains the keyword "27711-3b61bb2a-289a-11eb-8f29-0242ac1e7b1b".

  113. kubectl get pods -o wide -A | grep "[‎2020/‎11/‎17 15:34] 郭华朋: "- Get Pod information containing specific information.

  114. kubectl get pods -o wide -A | grep "27711-773415fa-28a7-11eb-9de7-0242ac1e7b1b"- Get Pod information whose name contains the keyword "27711-773415fa-28a7-11eb-9de7-0242ac1e7b1b".

  115. kubectl describe pod 27711-773415fa-28a7-11eb-9de7-0242ac1e7b1b -n jinn-test-4- View detailed information of the specified Pod in the specified Namespace.

  116. kubectl describe nodes 10.30.113.11- View detailed information of the node with the specified IP.

  117. kubectl get svc -n jinn-test-4- Get Service information in the specified Namespace.

  118. kubectl get pod -n jinn-test-4- Get Pod information in the specified Namespace.

  119. kubectl descrobe pod nnxt-test-9z6dv -n jinn-test-4- View the detailed information of the specified Pod in the specified Namespace (the spelling in the command is incorrect, please modify it describe).

  120. kubectl describe pod nnxt-test-9z6dv -n jinn-test-4- View detailed information of the specified Pod in the specified Namespace.

  121. kubectl get pods -n kube-system- Get Pod information in the specified Namespace.

  122. kubectl get pods -n kube-system|grep openapi- Obtain Pod information whose name contains the keyword "openapi" in the specified Namespace.

  123. kubectl get pods -n kube-system|grep webapi- Obtain Pod information whose name contains the keyword "webapi" in the specified Namespace.

  124. kubectl get po -A- Get Pod information in all Namespaces.

  125. kubectl get node- Get information about all nodes.

  126. kubectl get pod -n jinn-test-4 -o wide- Get Pod information in the specified Namespace.

  127. kubectl get node -o json | grep clustername- Get the node's JSON configuration file and look for information containing the keyword "clustername".

  128. kubectl get node -o json | grep clustername | grep test-test- Get the node's JSON configuration file and look for information containing the keywords "clustername" and "test-test".

  129. kubectl get node -o json | grep clustername | grep -C test-test- Get the node's JSON configuration file and look for information containing the keyword "clustername" and its context.

  130. kubectl get node -o json | grep clustername | grep -C 20 test-test- Get the JSON configuration file of the node and look for information containing the keyword "clustername" and its context, the context line number is 20.

  131. kubectl get node -o json | grep -C 20 test-test- Get the JSON configuration file of the node and look for information containing the keyword "test-test" and its context, the context line number is 20.

  132. kubectl get ns- Get information about all Namespaces.

Guess you like

Origin blog.csdn.net/huapeng_guo/article/details/133377253