KubernetesでPodの詳細をgetコマンドで確認する方法を紹介します。
以下のようにkubectlの「get」コマンドの「-o yaml」オプションを使用します。
1 |
kubectl get pod ポッド名 -o yaml |
試してみます。
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 |
root@controlplane:~# kubectl get pod nginx -o yaml apiVersion: v1 kind: Pod metadata: creationTimestamp: "2022-02-06T09:23:21Z" labels: run: nginx managedFields: - apiVersion: v1 fieldsType: FieldsV1 fieldsV1: f:metadata: f:labels: .: {} f:run: {} f:spec: f:containers: k:{"name":"nginx"}: .: {} f:image: {} f:imagePullPolicy: {} f:name: {} f:resources: {} f:terminationMessagePath: {} f:terminationMessagePolicy: {} f:dnsPolicy: {} f:enableServiceLinks: {} f:restartPolicy: {} f:schedulerName: {} f:securityContext: {} f:terminationGracePeriodSeconds: {} manager: kubectl-run operation: Update time: "2022-02-06T09:23:21Z" - apiVersion: v1 fieldsType: FieldsV1 fieldsV1: f:status: f:conditions: k:{"type":"ContainersReady"}: .: {} f:lastProbeTime: {} f:lastTransitionTime: {} f:status: {} f:type: {} k:{"type":"Initialized"}: .: {} f:lastProbeTime: {} f:lastTransitionTime: {} f:status: {} f:type: {} k:{"type":"Ready"}: .: {} f:lastProbeTime: {} f:lastTransitionTime: {} f:status: {} f:type: {} f:containerStatuses: {} f:hostIP: {} f:phase: {} f:podIP: {} f:podIPs: .: {} k:{"ip":"10.244.0.4"}: .: {} f:ip: {} f:startTime: {} manager: kubelet operation: Update time: "2022-02-06T09:23:32Z" name: nginx namespace: default resourceVersion: "3081" uid: a3fcf8ec-7099-4183-a6d9-5f3b64e4ff77 spec: containers: - image: nginx imagePullPolicy: Always name: nginx resources: {} terminationMessagePath: /dev/termination-log terminationMessagePolicy: File volumeMounts: - mountPath: /var/run/secrets/kubernetes.io/serviceaccount name: default-token-pp8wl readOnly: true dnsPolicy: ClusterFirst enableServiceLinks: true nodeName: controlplane preemptionPolicy: PreemptLowerPriority priority: 0 restartPolicy: Always schedulerName: default-scheduler securityContext: {} serviceAccount: default serviceAccountName: default terminationGracePeriodSeconds: 30 tolerations: - effect: NoExecute key: node.kubernetes.io/not-ready operator: Exists tolerationSeconds: 300 - effect: NoExecute key: node.kubernetes.io/unreachable operator: Exists tolerationSeconds: 300 volumes: - name: default-token-pp8wl secret: defaultMode: 420 secretName: default-token-pp8wl status: conditions: - lastProbeTime: null lastTransitionTime: "2022-02-06T09:23:21Z" status: "True" type: Initialized - lastProbeTime: null lastTransitionTime: "2022-02-06T09:23:32Z" status: "True" type: Ready - lastProbeTime: null lastTransitionTime: "2022-02-06T09:23:32Z" status: "True" type: ContainersReady - lastProbeTime: null lastTransitionTime: "2022-02-06T09:23:21Z" status: "True" type: PodScheduled containerStatuses: - containerID: docker://8175a05af577dd7342242988da4f336aa7dd189484f5b2ca3f32f3b202d4a780 image: nginx:latest imageID: docker-pullable://nginx@sha256:2834dc507516af02784808c5f48b7cbe38b8ed5d0f4837f16e78d00deb7e7767 lastState: {} name: nginx ready: true restartCount: 0 started: true state: running: startedAt: "2022-02-06T09:23:31Z" hostIP: 10.14.241.6 phase: Running podIP: 10.244.0.4 podIPs: - ip: 10.244.0.4 qosClass: BestEffort startTime: "2022-02-06T09:23:21Z" root@controlplane:~# |