查看详细信息 -o wide

比如 kubectl get po -A -o wide
会输出IP等信息

  1. kube-system metrics-server-86cbb8457f-rg9x8 1/1 Running 1 38d 10.42.0.6 vm-24-10-centos <none> <none>
  2. kube-system local-path-provisioner-5ff76fc89d-ttr92 1/1 Running 1 38d 10.42.0.8 vm-24-10-centos <none> <none>
  3. kube-system coredns-854c77959c-9jq97 1/1 Running 1 38d 10.42.0.7 vm-24-10-centos <none> <none>
  4. kube-system svclb-traefik-llvxv 2/2 Running 0 38d 10.42.0.10 vm-24-10-centos <none> <none>
  5. kube-system traefik-677b9fc84d-89zwz 1/1 Running 0 37d 10.42.0.13 vm-24-10-centos <none> <none>
  6. kube-system helm-install-traefik-bnxgm 0/1 Completed 0 37d 10.42.0.14 vm-24-10-centos <none> <none>
  7. mysql mysql-67778f67f-qzpxd 1/1 Running 0 28d 10.42.0.25 vm-24-10-centos <none> <none>
  8. home myhome-596454bb5d-wnj6j 1/1 Running 0 35m 10.42.0.31 vm-24-10-centos <none> <none>

输出yaml -o yaml

比如kubectl get po myhome-596454bb5d-wnj6j -n home -o yaml

  1. apiVersion: v1
  2. kind: Pod
  3. metadata:
  4. creationTimestamp: "2022-04-09T12:02:15Z"
  5. generateName: myhome-596454bb5d-
  6. labels:
  7. app: myhome
  8. pod-template-hash: 596454bb5d
  9. managedFields:
  10. - apiVersion: v1
  11. fieldsType: FieldsV1
  12. fieldsV1:
  13. f:metadata:
  14. f:generateName: {}
  15. f:labels:
  16. .: {}
  17. f:app: {}
  18. f:pod-template-hash: {}
  19. f:ownerReferences:
  20. .: {}
  21. k:{"uid":"b698562c-6f47-4163-9601-bd3a18fe9282"}:
  22. .: {}
  23. f:apiVersion: {}
  24. f:blockOwnerDeletion: {}
  25. f:controller: {}
  26. f:kind: {}
  27. f:name: {}
  28. f:uid: {}
  29. f:spec:
  30. f:containers:
  31. k:{"name":"myhome"}:
  32. .: {}
  33. f:image: {}
  34. f:imagePullPolicy: {}
  35. f:name: {}
  36. f:ports:
  37. .: {}
  38. k:{"containerPort":80,"protocol":"TCP"}:
  39. .: {}
  40. f:containerPort: {}
  41. f:protocol: {}
  42. f:resources:
  43. .: {}
  44. f:limits:
  45. .: {}
  46. f:cpu: {}
  47. f:memory: {}
  48. f:requests:
  49. .: {}
  50. f:cpu: {}
  51. f:memory: {}
  52. f:terminationMessagePath: {}
  53. f:terminationMessagePolicy: {}
  54. f:dnsPolicy: {}
  55. f:enableServiceLinks: {}
  56. f:restartPolicy: {}
  57. f:schedulerName: {}
  58. f:securityContext: {}
  59. f:terminationGracePeriodSeconds: {}
  60. f:status:
  61. f:conditions:
  62. k:{"type":"ContainersReady"}:
  63. .: {}
  64. f:lastProbeTime: {}
  65. f:lastTransitionTime: {}
  66. f:status: {}
  67. f:type: {}
  68. k:{"type":"Initialized"}:
  69. .: {}
  70. f:lastProbeTime: {}
  71. f:lastTransitionTime: {}
  72. f:status: {}
  73. f:type: {}
  74. k:{"type":"Ready"}:
  75. .: {}
  76. f:lastProbeTime: {}
  77. f:lastTransitionTime: {}
  78. f:status: {}
  79. f:type: {}
  80. f:containerStatuses: {}
  81. f:hostIP: {}
  82. f:phase: {}
  83. f:podIP: {}
  84. f:podIPs:
  85. .: {}
  86. k:{"ip":"10.42.0.31"}:
  87. .: {}
  88. f:ip: {}
  89. f:startTime: {}
  90. manager: k3s
  91. operation: Update
  92. time: "2022-04-09T12:02:18Z"
  93. name: myhome-596454bb5d-wnj6j
  94. namespace: home
  95. ownerReferences:
  96. - apiVersion: apps/v1
  97. blockOwnerDeletion: true
  98. controller: true
  99. kind: ReplicaSet
  100. name: myhome-596454bb5d
  101. uid: b698562c-6f47-4163-9601-bd3a18fe9282
  102. resourceVersion: "2298590"
  103. uid: 12184db2-ea59-4b34-b2de-830a5d78468d
  104. spec:
  105. containers:
  106. - image: ccr.ccs.tencentyun.com/gcclib/mine-ui:0.1.1
  107. imagePullPolicy: Always
  108. name: myhome
  109. ports:
  110. - containerPort: 80
  111. protocol: TCP
  112. resources:
  113. limits:
  114. cpu: 500m
  115. memory: 512Mi
  116. requests:
  117. cpu: 500m
  118. memory: 512Mi
  119. terminationMessagePath: /dev/termination-log
  120. terminationMessagePolicy: File
  121. volumeMounts:
  122. - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
  123. name: default-token-2tw8f
  124. readOnly: true
  125. dnsPolicy: ClusterFirst
  126. enableServiceLinks: true
  127. nodeName: vm-24-10-centos
  128. preemptionPolicy: PreemptLowerPriority
  129. priority: 0
  130. restartPolicy: Always
  131. schedulerName: default-scheduler
  132. securityContext: {}
  133. serviceAccount: default
  134. serviceAccountName: default
  135. terminationGracePeriodSeconds: 30
  136. tolerations:
  137. - effect: NoExecute
  138. key: node.kubernetes.io/not-ready
  139. operator: Exists
  140. tolerationSeconds: 300
  141. - effect: NoExecute
  142. key: node.kubernetes.io/unreachable
  143. operator: Exists
  144. tolerationSeconds: 300
  145. volumes:
  146. - name: default-token-2tw8f
  147. secret:
  148. defaultMode: 420
  149. secretName: default-token-2tw8f
  150. status:
  151. conditions:
  152. - lastProbeTime: null
  153. lastTransitionTime: "2022-04-09T12:02:15Z"
  154. status: "True"
  155. type: Initialized
  156. - lastProbeTime: null
  157. lastTransitionTime: "2022-04-09T12:02:18Z"
  158. status: "True"
  159. type: Ready
  160. - lastProbeTime: null
  161. lastTransitionTime: "2022-04-09T12:02:18Z"
  162. status: "True"
  163. type: ContainersReady
  164. - lastProbeTime: null
  165. lastTransitionTime: "2022-04-09T12:02:15Z"
  166. status: "True"
  167. type: PodScheduled
  168. containerStatuses:
  169. - containerID: containerd://2e2e8cef0f4244c94bc7d7f5fb1b04ced97b763d6da5c447cab00b1ee9d3e1a3
  170. image: ccr.ccs.tencentyun.com/gcclib/mine-ui:0.1.1
  171. imageID: ccr.ccs.tencentyun.com/gcclib/mine-ui@sha256:80985aa8169b6b63e5982ddc846a4211f50484bb065c9e8de1e8fb79c828edd0
  172. lastState: {}
  173. name: myhome
  174. ready: true
  175. restartCount: 0
  176. started: true
  177. state:
  178. running:
  179. startedAt: "2022-04-09T12:02:18Z"
  180. hostIP: 10.0.24.10
  181. phase: Running
  182. podIP: 10.42.0.31
  183. podIPs:
  184. - ip: 10.42.0.31
  185. qosClass: Guaranteed
  186. startTime: "2022-04-09T12:02:15Z"