티스토리 뷰
CLOUD/Monitoring
Grafana 설치 및 셋팅하기 (프로메테우스 연동) '/var/lib/grafana/plugins': Permission denied
헐리 2021. 10. 21. 16:01쿠버네티스 위에서 설치
https://grafana.com/docs/grafana/latest/installation/kubernetes/
Deploy Grafana on Kubernetes
› Installation › Deploy Grafana on Kubernetes Deploy Grafana on Kubernetes This page explains how to install and run Grafana on Kubernetes (K8S). It uses Kubernetes manifests for the setup. If you prefer Helm, refer to the Grafana Helm community charts
grafana.com
아래 파일을 만들어서 kubectl apply 를 해야하는데 그전에 pv가 필요하다.
또한 pv와 연결되 로컬 디렉토리 권한이 472여야 한다. (관련 명령어는 아래에 있다)
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: grafana-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: grafana
name: grafana
spec:
selector:
matchLabels:
app: grafana
template:
metadata:
labels:
app: grafana
spec:
securityContext:
fsGroup: 472
supplementalGroups:
- 0
containers:
- name: grafana
image: grafana/grafana:7.5.2
imagePullPolicy: IfNotPresent
ports:
- containerPort: 3000
name: http-grafana
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /robots.txt
port: 3000
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 2
livenessProbe:
failureThreshold: 3
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
tcpSocket:
port: 3000
timeoutSeconds: 1
resources:
requests:
cpu: 250m
memory: 750Mi
volumeMounts:
- mountPath: /var/lib/grafana
name: grafana-pv
volumes:
- name: grafana-pv
persistentVolumeClaim:
claimName: grafana-pvc
---
apiVersion: v1
kind: Service
metadata:
name: grafana
spec:
ports:
- port: 3000
protocol: TCP
targetPort: http-grafana
selector:
app: grafana
sessionAffinity: None
type: LoadBalancer #NodePort로 변경
'/var/lib/grafana/plugins': Permission denied 에러해결방법
sudo chown -R 472:472 /<pv volumemount 경로>
이 정도로 수정하고 Kubectl apply를 한다
Dashboard 생성후
기본 3000포트 또느 nodeport로 접속하면 다음과 같은 gui를 볼 수 있다.
초기 계정은
admin/admin이다
프로메테우스와 연동
다음과 같이 configuration의 data source에서 prometheus를 선택한다.
HTTP URL에 프로메테우스 서버의 주소를 적는다
'CLOUD > Monitoring' 카테고리의 다른 글
[Prometheus] Helm prometheus operator에 Nginx 추가하기 (0) | 2022.02.18 |
---|---|
프로메테우스 쿼리 (0) | 2022.02.10 |
Helm 으로 Prometheus 설치 (에러해결 node exporter bind: address already in use) (0) | 2022.02.09 |
[쿠버네티스 모니터링] Grafana Loki 설치 (helm) + 그라파나와 연동 (0) | 2022.01.20 |
kubesphere 설치하기 (Minimal KubeSphere on Kubernetes) + kubesphere Loadbalaner 서비스 + 프로메테우스, 그라파나 (0) | 2021.10.14 |