Monitoring Cluster Components


K8s 를 운영할 때 모니터링 할 수 있는 지표는 Node 개수, CPU, Memory, Network, Disk 등이 있다. 이런 지표들은 kubelet 의 내장 컴포넌트 중 하나인 cAdvisor 를 통해 제공된다. K8s 는 기본적으로 제공하는 모니터링 툴이 없기 때문에 Prometheus, ELK, Datadog, Dynatrace 등 3rd Party 솔루션을 통해 K8s Cluster 를 모니터링 할 수 있다.

kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
kubectl top node
kubectl top pod

Metric Server Pod 를 Cluster 에 배포한 뒤 위 명령어들을 통해 지표를 확인할 수 있다.

Managing Application Logs


docker logs -f {container-name}

Docker Container 로 Application 을 실행했을 때 위 명령어로 Application Log 를 확인할 수 있는 것 처럼,

kubectl logs -f {pod-name} {container-name}

위 명령어로 Pod 내 특정 Container 의 Log 를 확인할 수 있다.

References