45 lines
2.1 KiB
Makefile
45 lines
2.1 KiB
Makefile
# export KUBECONFIG=kubeconfig.yaml
|
|
|
|
|
|
kind-up:
|
|
kind create cluster --name grafana
|
|
kind get kubeconfig --name grafana > kubeconfig.yaml
|
|
kubectl create namespace meta && kubectl create namespace prod
|
|
helm repo add grafana https://grafana.github.io/helm-charts && helm repo update
|
|
|
|
helm install loki grafana/loki --namespace meta --values loki-values.yaml
|
|
helm install kps prometheus-community/kube-prometheus-stack --namespace meta -f prometheus-values.yaml
|
|
helm install grafana grafana/grafana --values grafana-values.yml --namespace meta
|
|
helm install k8s-monitoring grafana/k8s-monitoring --values ./k8s-monitoring-values.yml -n meta --create-namespace
|
|
|
|
kubectl apply -f pyservice.yaml
|
|
|
|
kind-down:
|
|
kind delete cluster --name grafana
|
|
|
|
forward-loki:
|
|
kubectl port-forward --namespace meta svc/loki-gateway 3100:80
|
|
|
|
forward-grafana:
|
|
#!/bin/bash
|
|
export POD_NAME=$(kubectl get pods --namespace meta -l "app.kubernetes.io/name=grafana,app.kubernetes.io/instance=grafana" -o jsonpath="{.items[0].metadata.name}")
|
|
kubectl --namespace meta port-forward $POD_NAME 3000
|
|
|
|
forward-alloy-logs:
|
|
#!/bin/bash
|
|
export POD_NAME=$(kubectl get pods --namespace meta -l "app.kubernetes.io/name=alloy-logs,app.kubernetes.io/instance=k8s" -o jsonpath="{.items[0].metadata.name}")
|
|
kubectl --namespace meta port-forward $POD_NAME 12345
|
|
|
|
forward-otel-collector:
|
|
#!/bin/bash
|
|
export POD_NAME=$(kubectl get pods --namespace meta -l "app.kubernetes.io/name=otel-collector,app.kubernetes.io/instance=k8s" -o jsonpath="{.items[0].metadata.name}")
|
|
kubectl --namespace meta port-forward $POD_NAME 4317
|
|
|
|
get-inotify-max-user-watches:
|
|
#!/bin/bashcat /proc/sys/fs/inotify/max_user_watches
|
|
|
|
export POD_NAME=$(kubectl get pods --namespace meta -l "app.kubernetes.io/name=grafana,app.kubernetes.io/instance=grafana" -o jsonpath="{.items[0].metadata.name}")
|
|
# kubectl exec -n <grafana-namespace> <grafana-pod> -- sh -c "ulimit -n && cat /proc/sys/fs/inotify/max_user_watches"
|
|
kubectl exec -n meta $POD_NAME -- sh -c "ulimit -n && cat /proc/sys/fs/inotify/max_user_watches"
|
|
|
|
|