Grafana Mimir
Grafana Mimir project forked from Cortex. Various different methods you can use to ingest data but for this PoC I chose to use prometheus with remote write.
Pros
- Easy to set up
- Baked in High Availability as all components are stateless
- Has caching component enabled by default
- Can deploy two seperate modes: monolithic and microservices
- Exposes http cardinality API
- Setup in one command. Minimal configuration
- Runbooks available: https://grafana.com/docs/mimir/latest/operators-guide/mimir-runbooks/
Cons
- As it stands, only helm and jsonnet deployment available
- Complicated setup with many components
- Fairly new project — limited resources online for guidance
- Lack of documentation
- Not widely adopted by community
install
https://grafana.com/docs/helm-charts/mimir-distributed/latest/get-started-helm-charts/
Before you begin
- General knowledge about using a Kubernetes cluster.
- Understanding of what the kubectl command does.
- Understanding of what the helm command does.
• A single Kubernetes node with a minimum of 4 cores and 16GiB RAM
helm repo add grafana <https://grafana.github.io/helm-charts>
helm repo update
helm -n mimir install mimir grafana/mimir-distributed --create-namespace
kubectl -n mimir get pods
Generate some metrics for testing
The Grafana Mimir Helm chart can collect metrics, logs, or both, about Grafana Mimir itself. This is called metamonitoring. In the example that follows, metamonitoring scrapes metrics about Grafana Mimir itself, and then writes those metrics to the same Grafana Mimir instance.
- Download the Grafana Agent Operator Custom Resource Definitions (CRDs) from https://github.com/grafana/agent/tree/main/production/operator/crds.If you did not enable metamonitoring when the chart was first installed, you must manually install the CRDs before performing a Helm upgrade to enable metamonitoring.
- Helm only installs Custom Resource Definitions on an initial chart installation, and not on a chart upgrade. For details, see Some caveats and explanations.
- Install the CRDs on your cluster:
git clone <https://github.com/grafana/agent.git>
cd agent/
kubectl create -f production/operator/crds/
----
metaMonitoring:
serviceMonitor:
enabled: true
grafanaAgent:
enabled: true
installOperator: true
metrics:
additionalRemoteWriteConfigs:
- url: "<http://mimir-nginx.mimir-test.svc:80/api/v1/push>"
---
helm -n mimir upgrade mimir grafana/mimir-distributed -f custom.yaml
install grafana
https://grafana.com/docs/grafana/latest/setup-grafana/installation/kubernetes/
touch grafana.yaml
vim grafana.yaml
---
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:latest
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
kubectl apply -f grafana.yaml --namespace=mimir-test
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
grafana LoadBalancer 10.84.14.175 34.97.70.203 3000:31585/TCP 17m
<http://34.97.70.203:3000>
추가 헬름차트 안전하게 관리 helm diff
https://github.com/databus23/helm-diff
helm plugin install <https://github.com/databus23/helm-diff>
helm -n mimir-test diff upgrade mimir grafana/mimir-distributed -f custom.yaml
'Engineering' 카테고리의 다른 글
Performance Test Metric 도구 간단 정리 (Promethus, Thanos, Cortex, Mimir, Victoria Metrics) (0) | 2024.04.01 |
---|---|
Performance Test 환경구성 (0) | 2024.04.01 |
AWS External ALB, Internal ALB, EKS Targetgroupbinding 구성 (0) | 2024.03.08 |
AWS EKS ALB 하나로 여러 Ingress 구성 ( Ingress Group, TargetGroupBinding) (0) | 2024.02.06 |
eksctl로 eks 구축해보기 with 스팟 인스턴스 (0) | 2024.01.25 |