Skip to content

Commit 35731b6

Browse files
authored
Merge pull request #34385 from jinnypark9393/jinnypark9393/monitor-node-health/v0.1
Translate tasks/debug/debug-cluster/monitor-node-health into Korean
2 parents 4602561 + 41a2486 commit 35731b6

File tree

3 files changed

+255
-0
lines changed

3 files changed

+255
-0
lines changed
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
---
2+
title: 노드 헬스 모니터링하기
3+
content_type: task
4+
5+
6+
7+
weight: 20
8+
---
9+
10+
<!-- overview -->
11+
12+
*노드 문제 감지기(Node Problem Detector)* 는 노드의 헬스에 대해 모니터링 및 보고하는 데몬이다.
13+
노드 문제 감지기를 `데몬셋(DaemonSet)` 혹은 스탠드얼론 데몬(standalone daemon)으로 실행할 수 있다.
14+
노드 문제 감지기는 다양한 데몬으로부터 노드의 문제에 관한 정보를 다양한 데몬으로부터 수집하고,
15+
이러한 컨디션들을 [노드컨디션(NodeCondition)](/docs/concepts/architecture/nodes/#condition)
16+
[이벤트(Event)](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#event-v1-core)형태로 API 서버에 보고한다.
17+
18+
노드 문제 감지기 설치 및 사용 방법을 보려면,
19+
[노드 문제 감지기 프로젝트 문서](https://github.com/kubernetes/node-problem-detector)를 참조하자.
20+
21+
## {{% heading "prerequisites" %}}
22+
23+
{{< include "task-tutorial-prereqs.md" >}}
24+
25+
<!-- steps -->
26+
27+
## 제약 사항
28+
29+
* 노드 문제 감지기는 파일 기반의 커널 로그만 지원한다.
30+
`journald` 와 같은 로그 도구는 지원하지 않는다.
31+
32+
* 노드 문제 감지기는 커널 로그 형식을 사용하여 커널 이슈를 보고한다.
33+
커널 로그 형식을 확장하는 방법을 배우려면 [기타 로그 형식 지원 추가](#support-other-log-format)를 살펴보자.
34+
35+
## 노드 문제 감지기 활성화하기
36+
37+
일부 클라우드 사업자는 노드 문제 감지기를 {{< glossary_tooltip text="애드온" term_id="addons" >}} 으로서 제공한다.
38+
또한, `kubectl`을 이용하거나 애드온 파드를 생성하여 노드 문제 감지기를 활성화할 수도 있다.
39+
40+
### kubectl를 이용하여 노드 문제 감지기 활성화하기 {#using-kubectl}
41+
42+
`kubectl`은 노드 문제 감지기를 관리하는 가장 유연한 방법이다.
43+
현재 환경에 맞게 조정하거나 사용자 정의 노드 문제를 탐지하기 위해
44+
기본 설정값을 덮어쓸 수 있다. 예를 들면 아래와 같다.
45+
46+
1. `node-problem-detector.yaml`와 유사하게 노드 문제 감지기 구성을 생성한다:
47+
48+
{{< codenew file="debug/node-problem-detector.yaml" >}}
49+
50+
{{< note >}}
51+
현재 운영 체제 배포판의 시스템 로그 디렉토리와 일치하도록 기재했는지 확인해야 한다.
52+
{{< /note >}}
53+
54+
1. `kubectl`을 이용하여 노드 문제 감지기를 시작한다.
55+
56+
```shell
57+
kubectl apply -f https://k8s.io/examples/debug/node-problem-detector.yaml
58+
```
59+
60+
### 애드온 파드를 이용하여 노드 문제 감지기 활성화하기 {#using-addon-pod}
61+
62+
만약 커스텀 클러스터 부트스트랩 솔루션을 사용중이고
63+
기본 설정값을 덮어쓸 필요가 없다면,
64+
디플로이먼트를 추가로 자동화하기 위해 애드온 파드를 활용할 수 있다.
65+
66+
`node-problem-detector.yaml`를 생성하고,
67+
컨트롤 플레인 노드의 애드온 파드의 디렉토리 `/etc/kubernetes/addons/node-problem-detector`에 설정을 저장한다.
68+
69+
## 설정 덮어쓰기
70+
71+
노드 문제 감지기를 빌드할 때,
72+
[기본 설정](https://github.com/kubernetes/node-problem-detector/tree/v0.1/config)이 포함되어 있다.
73+
74+
하지만 [`컨피그맵(ConfigMap)`](/docs/tasks/configure-pod-container/configure-pod-configmap/)을 이용해
75+
설정을 덮어쓸 수 있다.
76+
77+
1. `config/` 내의 설정 파일을 변경한다.
78+
1. `node-problem-detector-config` `컨피그맵(ConfigMap)`을 생성한다.
79+
80+
```shell
81+
kubectl create configmap node-problem-detector-config --from-file=config/
82+
```
83+
84+
1. `컨피그맵(ConfigMap)`을 사용하도록 `node-problem-detector.yaml`을 변경한다.
85+
86+
{{< codenew file="debug/node-problem-detector-configmap.yaml" >}}
87+
88+
4. 새로운 설정 파일을 사용하여 노드 문제 감지기를 재생성한다.
89+
90+
```shell
91+
# 만약 노드 문제 감지기가 동작하고 있다면, 재생성 전 삭제한다
92+
kubectl delete -f https://k8s.io/examples/debug/node-problem-detector.yaml
93+
kubectl apply -f https://k8s.io/examples/debug/node-problem-detector-configmap.yaml
94+
```
95+
96+
{{< note >}}
97+
이 접근법은 노드 문제 감지기를 `kubectl`로 시작했을 때에만 적용된다.
98+
{{< /note >}}
99+
100+
만약 노드 문제 감지기가 클러스터 애드온으로 실행된 경우, 설정 덮어쓰기가 지원되지 않는다.
101+
애드온 매니저는 `컨피그맵(ConfigMap)`을 지원하지 않는다.
102+
103+
## 커널 모니터
104+
105+
*커널 모니터*는 노드 문제 감지기에서 지원하는 시스템 로그 모니터링 데몬이다.
106+
커널 모니터는 커널 로그를 감시하며, 미리 설정된 규칙에 따라 알려진 커널 이슈를 감지한다.
107+
108+
커널 모니터는 [`config/kernel-monitor.json`](https://github.com/kubernetes/node-problem-detector/blob/v0.1/config/kernel-monitor.json)
109+
미리 설정된 규칙 모음과 커널 이슈를 매칭한다.
110+
규칙 리스트는 확장 가능하다. 설정을 덮어쓰기 해 규칙 리스트를 확장할 수 있다.
111+
112+
### 신규 노드컨디션(NodeConditions) 추가하기
113+
114+
신규 `NodeCondition`를 지원하려면, `config/kernel-monitor.json``conditions`필드 내 조건 정의를 생성해야한다.
115+
예를 들면 아래와 같다.
116+
117+
```json
118+
{
119+
"type": "NodeConditionType",
120+
"reason": "CamelCaseDefaultNodeConditionReason",
121+
"message": "arbitrary default node condition message"
122+
}
123+
```
124+
125+
### 신규 문제 감지하기
126+
127+
신규 문제를 감지하려면 `config/kernel-monitor.json``rules`필드를
128+
신규 규칙 정의로 확장하면 된다.
129+
130+
```json
131+
{
132+
"type": "temporary/permanent",
133+
"condition": "NodeConditionOfPermanentIssue",
134+
"reason": "CamelCaseShortReason",
135+
"message": "regexp matching the issue in the kernel log"
136+
}
137+
```
138+
139+
### 커널 로그 장치를 위한 경로 설정하기 {#kernel-log-device-path}
140+
141+
운영 체제 (OS) 배포판의 커널 로그 경로를 확인한다.
142+
리눅스 커널 [로그 장치(log device)](https://www.kernel.org/doc/Documentation/ABI/testing/dev-kmsg)는 보통 `/dev/kmsg`와 같이 표시된다. 하지만, 로그 경로 장소는 OS 배포판마다 상이하다.
143+
`config/kernel-monitor.json``log` 필드는 컨테이너 내부의 로그 경로를 나타낸다.
144+
`log` 필드를 노드 문제 감지기가 감시하는 장치 경로와 일치하도록 구성하면 된다.
145+
146+
### 기타 로그 포맷 지원 추가하기 {#support-other-log-format}
147+
148+
커널 모니터는 커널 로그의 내부 데이터 구조를 해석하기 위해
149+
[`Translator`](https://github.com/kubernetes/node-problem-detector/blob/v0.1/pkg/kernelmonitor/translator/translator.go) 플러그인을 사용한다.
150+
신규 로그 포맷을 사용하기 위해 신규 해석기를 구현할 수 있다.
151+
152+
<!-- discussion -->
153+
154+
## 권장 사항 및 제약 사항
155+
156+
노드 헬스를 모니터링하기 위해 클러스터에 노드 문제 탐지기를 실행할 것을 권장한다.
157+
노드 문제 감지기를 실행할 때, 각 노드에 추가 리소스 오버헤드가 발생할 수 있다.
158+
다음과 같은 이유 때문에 일반적으로는 문제가 없다.
159+
160+
* 커널 로그는 비교적 천천히 늘어난다.
161+
* 노드 문제 감지기에는 리소스 제한이 설정되어 있다.
162+
* 높은 부하가 걸리더라도, 리소스 사용량은 허용 가능한 수준이다. 추가 정보를 위해 노드 문제 감지기의
163+
[벤치마크 결과](https://github.com/kubernetes/node-problem-detector/issues/2#issuecomment-220255629)를 살펴보자.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
apiVersion: apps/v1
2+
kind: DaemonSet
3+
metadata:
4+
name: node-problem-detector-v0.1
5+
namespace: kube-system
6+
labels:
7+
k8s-app: node-problem-detector
8+
version: v0.1
9+
kubernetes.io/cluster-service: "true"
10+
spec:
11+
selector:
12+
matchLabels:
13+
k8s-app: node-problem-detector
14+
version: v0.1
15+
kubernetes.io/cluster-service: "true"
16+
template:
17+
metadata:
18+
labels:
19+
k8s-app: node-problem-detector
20+
version: v0.1
21+
kubernetes.io/cluster-service: "true"
22+
spec:
23+
hostNetwork: true
24+
containers:
25+
- name: node-problem-detector
26+
image: k8s.gcr.io/node-problem-detector:v0.1
27+
securityContext:
28+
privileged: true
29+
resources:
30+
limits:
31+
cpu: "200m"
32+
memory: "100Mi"
33+
requests:
34+
cpu: "20m"
35+
memory: "20Mi"
36+
volumeMounts:
37+
- name: log
38+
mountPath: /log
39+
readOnly: true
40+
- name: config # config/ 디렉토리를 컨피그맵 볼륨(ConfigMap volume)으로 덮어쓴다
41+
mountPath: /config
42+
readOnly: true
43+
volumes:
44+
- name: log
45+
hostPath:
46+
path: /var/log/
47+
- name: config # 컨피그맵 볼륨(ConfigMap volume)을 정의한다
48+
configMap:
49+
name: node-problem-detector-config
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
apiVersion: apps/v1
2+
kind: DaemonSet
3+
metadata:
4+
name: node-problem-detector-v0.1
5+
namespace: kube-system
6+
labels:
7+
k8s-app: node-problem-detector
8+
version: v0.1
9+
kubernetes.io/cluster-service: "true"
10+
spec:
11+
selector:
12+
matchLabels:
13+
k8s-app: node-problem-detector
14+
version: v0.1
15+
kubernetes.io/cluster-service: "true"
16+
template:
17+
metadata:
18+
labels:
19+
k8s-app: node-problem-detector
20+
version: v0.1
21+
kubernetes.io/cluster-service: "true"
22+
spec:
23+
hostNetwork: true
24+
containers:
25+
- name: node-problem-detector
26+
image: k8s.gcr.io/node-problem-detector:v0.1
27+
securityContext:
28+
privileged: true
29+
resources:
30+
limits:
31+
cpu: "200m"
32+
memory: "100Mi"
33+
requests:
34+
cpu: "20m"
35+
memory: "20Mi"
36+
volumeMounts:
37+
- name: log
38+
mountPath: /log
39+
readOnly: true
40+
volumes:
41+
- name: log
42+
hostPath:
43+
path: /var/log/

0 commit comments

Comments
 (0)