[Retry, k8s] 26. 클러스터 & 메타데이터 API - 노드

Date:     Updated:

카테고리:

태그:


🔔 클러스터 & 메타데이터 API


(1) 클러스터 API

클러스터 API 카테고리로 분류된 리소스는 보안 관련 설정이나 쿼터 설정 등 클러스터 동작을 제어하기 위한 리소스

  • 내부적으로 사용하는 리소스를 제외하고 사용자가 직접 이용할 수 있는 리소스는 총 열 가지다.

    • 노드

    • 네임스페이스

    • 영구 볼륨

    • 리소스 쿼터

    • 서비스 어카운트

    • 클러스터롤

    • 롤바인딩

    • 클러스터롤바인딩

    • 네트워크 정책


(2) 메타데이터 API

메타데이터 API 카테고리로 분류된 리소스는 클러스터에 컨테이너를 기동하는데 사용하는 리소스

  • 내부적으로 사용하는 리소스를 제외하고 사용자가 직접 이용할 수 있는 리소스는 총 네 가지다.

    • LimitRange

    • HorizontalPodAutoscaler

    • PodDisruptionBudget

    • CustomResourceDefinition


🔔 노드

# 노드 상세 정보 표시
$ kubectl get node -o wide
NAME         STATUS   ROLES           AGE     VERSION   INTERNAL-IP       EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION      CONTAINER-RUNTIME
k8s-master   Ready    control-plane   4h33m   v1.26.3   192.168.219.100   <none>        Ubuntu 22.04.2 LTS   5.15.0-67-generic   docker://23.0.3
k8s-node01   Ready    <none>          4h33m   v1.26.3   192.168.219.101   <none>        Ubuntu 22.04.2 LTS   5.15.0-67-generic   docker://23.0.3
k8s-node02   Ready    <none>          4h33m   v1.26.3   192.168.219.102   <none>        Ubuntu 22.04.2 LTS   5.15.0-67-generic   docker://23.0.3
# 특정 노드 정보를 YAML 형식으로 출력 - 특정 노드에 할당된 리소스와 사용 가능한 리소스 확인
$ kubectl get node k8s-node01 -o yaml

~(생략~)

status:
  addresses:
  - address: 192.168.219.101
    type: InternalIP
  - address: k8s-node01
    type: Hostname
  # 실제 파드에 할당 가능한 리소스 용량
  allocatable:
    cpu: "2"
    ephemeral-storage: "9417620260"
    hugepages-1Gi: "0"
    hugepages-2Mi: "0"
    memory: 1885848Ki
    pods: "110"
  # 노드가 소유하고 있는 CPU, 메모리의 실제 용량
  capacity:
    cpu: "2"
    ephemeral-storage: 10218772Ki
    hugepages-1Gi: "0"
    hugepages-2Mi: "0"
    memory: 1988248Ki
    pods: "110"

~(생략)~
# 할당할 수 있는 남은 리소스 양을 확인하려면 Allocateble에서 현재 리소스 사용량을 뺴야한다.
# 현재 리소스 사용량을 알려면 "kubectl describe node"에서 확인
$ kubectl describe node k8s-node01

~(생략)~

Non-terminated Pods:          (6 in total)
  Namespace                   Name                                            CPU Requests  CPU Limits  Memory Requests  Memory Limits  Age
  ---------                   ----                                            ------------  ----------  ---------------  -------------  ---
  ceph-csi-cephfs             ceph-csi-cephfs-nodeplugin-xt7mr                0 (0%)        0 (0%)      0 (0%)           0 (0%)         3h49m
  ceph-csi-cephfs             ceph-csi-cephfs-provisioner-687456b556-66tlw    0 (0%)        0 (0%)      0 (0%)           0 (0%)         3h49m
  default                     sample-statefulset-with-pvc-0                   0 (0%)        0 (0%)      0 (0%)           0 (0%)         3h41m
  default                     sample-subpath                                  0 (0%)        0 (0%)      0 (0%)           0 (0%)         45m
  kube-system                 kube-proxy-q7pl6                                0 (0%)        0 (0%)      0 (0%)           0 (0%)         4h41m
  kube-system                 weave-net-wk7wl                                 100m (5%)     0 (0%)      0 (0%)           0 (0%)         4h41m
Allocated resources:
  (Total limits may be over 100 percent, i.e., overcommitted.)
  Resource           Requests   Limits
  --------           --------   ------
  cpu                100m (5%)  0 (0%)
  memory             0 (0%)     0 (0%)
  ephemeral-storage  0 (0%)     0 (0%)
  hugepages-1Gi      0 (0%)     0 (0%)
  hugepages-2Mi      0 (0%)     0 (0%)
Events:              <none>
# 노드 Status가 Ready가 아닌 경우, status.conditions를 보면 그 원인을 확인할 수 있다.
$ kubectl get node k8s-node01 -o yaml

~(생략)~

 conditions:
  - lastHeartbeatTime: "2023-04-11T04:07:44Z"
    lastTransitionTime: "2023-04-11T04:07:44Z"
    message: Weave pod has set this
    reason: WeaveIsUp
    status: "False"
    type: NetworkUnavailable
  - lastHeartbeatTime: "2023-04-11T09:00:17Z"
    lastTransitionTime: "2023-04-11T04:07:15Z"
    message: kubelet has sufficient memory available
    reason: KubeletHasSufficientMemory
    status: "False"
    type: MemoryPressure
  - lastHeartbeatTime: "2023-04-11T09:00:17Z"
    lastTransitionTime: "2023-04-11T04:07:15Z"
    message: kubelet has no disk pressure
    reason: KubeletHasNoDiskPressure
    status: "False"
    type: DiskPressure
  - lastHeartbeatTime: "2023-04-11T09:00:17Z"
    lastTransitionTime: "2023-04-11T04:07:15Z"
    message: kubelet has sufficient PID available
    reason: KubeletHasSufficientPID
    status: "False"
    type: PIDPressure
  - lastHeartbeatTime: "2023-04-11T09:00:17Z"
    lastTransitionTime: "2023-04-11T04:07:41Z"
    message: kubelet is posting ready status. AppArmor enabled
    reason: KubeletReady
    status: "True"
    type: Ready

~(생략)~


# 이외에 각 k8s 노드가 소유하고 있는 도커 이미지도 확인할 수 있다.
$ kubectl get node k8s-node01 -o yaml

~(생략)~

  images:
  - names:
    - quay.io/cephcsi/cephcsi@sha256:336b4d3c9b10edfbe8eab90d732513d872e684b1ea954e021a9c1ded1f08599b
    - quay.io/cephcsi/cephcsi:v3.8.0
    sizeBytes: 1706602617
  - names:
    - nginx@sha256:d20aa6d1cae56fd17cd458f4807e0de462caf2336f0b70b5eeb69fcaaf30dd9c
    - nginx:1.16
    sizeBytes: 126681697
  - names:
    - weaveworks/weave-kube@sha256:35827a9c549c095f0e9d1cf8b35d8f27ae2c76e31bc6f7f3c0bc95911d5accea
    - weaveworks/weave-kube:latest
    sizeBytes: 89041759
  - names:
    - registry.k8s.io/kube-proxy@sha256:d89b6c6a8ecc920753df713b268b0d226f795135c4a0ecc5ce61660e623dd6da
    - registry.k8s.io/kube-proxy:v1.26.3
    sizeBytes: 65635949
  - names:
    - registry.k8s.io/sig-storage/csi-provisioner@sha256:ee3b525d5b89db99da3b8eb521d9cd90cb6e9ef0fbb651e98bb37be78d36b5b8
    - registry.k8s.io/sig-storage/csi-provisioner:v3.3.0
    sizeBytes: 59338544
  - names:
    - registry.k8s.io/sig-storage/csi-resizer@sha256:425d8f1b769398127767b06ed97ce62578a3179bcb99809ce93a1649e025ffe7
    - registry.k8s.io/sig-storage/csi-resizer:v1.6.0
    sizeBytes: 56562183
  - names:
    - registry.k8s.io/sig-storage/csi-snapshotter@sha256:291334908ddf71a4661fd7f6d9d97274de8a5378a2b6fdfeb2ce73414a34f82f
    - registry.k8s.io/sig-storage/csi-snapshotter:v6.1.0
    sizeBytes: 56073074
  - names:
    - weaveworks/weave-npc@sha256:062832fd25b5e9e16650e618f26bba1409a7b3bf2c3903e1b369d788abc63aef
    - weaveworks/weave-npc:latest
    sizeBytes: 39273789
  - names:
    - registry.k8s.io/sig-storage/csi-node-driver-registrar@sha256:a13bff2ed69af0cf4270f0cf47bdedf75a56c095cd95b91195ae6c713a9b1845
    - registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.6.2
    sizeBytes: 20590184
  - names:
    - alpine@sha256:8421d9a84432575381bfabd248f1eb56f3aa21d9d7cd2511583c68c9b7511d10
    - alpine:3.7
    sizeBytes: 4206494
  - names:
    - registry.k8s.io/pause@sha256:3d380ca8864549e74af4b29c10f9cb0956236dfb01c40ca076fb6c37253234db
    - registry.k8s.io/pause:3.6
    sizeBytes: 682696

~(생략)~


# 마지막으로 노드 버전 등의 정보는 status.nodeInfo에서 확인할 수 있다.
$ kubectl get node k8s-node01 -o yaml

~(생략)~

  nodeInfo:
    architecture: amd64
    bootID: 2f0ffb62-94f2-4d66-b20c-fd104af3430e
    containerRuntimeVersion: docker://23.0.3
    kernelVersion: 5.15.0-67-generic
    kubeProxyVersion: v1.26.3
    kubeletVersion: v1.26.3
    machineID: 58dd9864c8364965a0f61bea4bed052a
    operatingSystem: linux
    osImage: Ubuntu 22.04.2 LTS
    systemUUID: fc564d56-b58b-f30d-ed67-fcbea91c48df

~(생략)~

KUBERNETES 카테고리 내 다른 글 보러가기

댓글 남기기