k3s 에 grafana, prometheus 설치하기
반응형
multipass 로 설치한 k3s 에 grafana 와 prometheus 를 설치한다. 이를 위해 k3s 가 설치되어 있어야 한다.
https://jjoyling.tistory.com/197
k3s kubeconfig 설정
/etc/rancher/k3s/k3s.yaml 정보를 ./kubeconfig 파일로 복사한다.
파일 내부에 서버 정보를 multipass IP 로 변경해준다.
설정이 완료되면 multipass 접속 없이 맥북 터미널에서 조작이 가능하다.
multipass list
Name State IPv4 Image
k3s Running 192.168.64.2 Ubuntu 20.04 LTS
10.42.0.0
10.42.0.1
# kubeconfig 파일 내부 변경
server: https://192.168.64.2:6443
# kubeconfig 설정 후 kubectl 명령어 사용
export KUBECONFIG=./kubeconfig
kubectl get all
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.43.0.1 <none> 443/TCP 53m
Prometheus 설치
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
# 네임스페이스 생성
kubectl create namespace mon
# Helm Chart로 Prometheus 설치
helm install prometheus prometheus-community/prometheus \
--namespace mon
helm chart 를 이용하여 prometheus 설치 완료 , 접근하여 설치 확인
kubectl port-forward -n mon svc/prometheus-server 9090:80
prometheus-server 서비스를 9090 포트로 포워딩하여 맥북에서 localhost:9090 으로 확인이 가능함.
grafana 설치
helm repo add grafana https://grafana.github.io/helm-charts
helm repo update
# 네임스페이스 생성 (이미 monitoring 네임스페이스가 있다면 생략 가능)
kubectl create namespace mon
# Grafana 설치
helm install grafana grafana/grafana \
--namespace mon \
--set adminPassword=admin \
--set service.type=NodePort
grafana 관련 서비스가 생성됨, 접속해보자.
kubectl get svc -n mon | grep grafana
grafana NodePort 10.43.86.133 <none> 80:31527/TCP 18m
서비스를 조회해보면 31527 포트로 NodePort 서비스가 생성되어 있다.
multipass 인스턴스의 31527 포트로 접속이 가능하다는 의미이다. multipass IP 를 확인해보자.
설치 시 설정한 초기 계정은 admin/admin 이다.
내 mac 에서는 192.168.64.2:31527 로 접속이 가능하다.
반응형
'⇥ DevOps Tech 🙋🏻♀️ > ✏️ Cloud' 카테고리의 다른 글
K8S Controller (ReplicaSet, Deployment) (0) | 2024.12.11 |
---|---|
grafana 에 prometheus 연결하기 (0) | 2024.12.08 |
K3S 설치 - mac (multipass) (0) | 2024.12.08 |
AWS (region, availability zone AZ, edge location) (0) | 2024.07.25 |
[docker] iptables failed - No chain/target/match by that name (0) | 2022.06.21 |
댓글
이 글 공유하기
다른 글
-
K8S Controller (ReplicaSet, Deployment)
K8S Controller (ReplicaSet, Deployment)
2024.12.11 -
grafana 에 prometheus 연결하기
grafana 에 prometheus 연결하기
2024.12.08 -
K3S 설치 - mac (multipass)
K3S 설치 - mac (multipass)
2024.12.08 -
AWS (region, availability zone AZ, edge location)
AWS (region, availability zone AZ, edge location)
2024.07.25