Skip to content

Simplest script for DO k8s grafana

Pavel Lobashov edited this page Mar 18, 2021 · 3 revisions
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo add stable https://charts.helm.sh/stable
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update

helm install nfs-server stable/nfs-server-provisioner \
  --set persistence.enabled=true \
  --set persistence.storageClass=do-block-storage \
  --set persistence.size=20Gi
kubectl apply -f ./pvc/ds-files.yaml
sleep 60
kubectl get pvc ds-files
# Should see bound message

helm install rabbitmq bitnami/rabbitmq \
  --set metrics.enabled=true
  
helm install redis bitnami/redis \
  --set cluster.enabled=false \
  --set usePassword=false \
  --set image.tag=5.0.7-debian-10-r51 \
  --set metrics.enabled=true

wget https://raw.githubusercontent.com/ONLYOFFICE/server/master/schema/postgresql/createdb.sql
kubectl create configmap init-db-scripts \
  --from-file=./createdb.sql
helm install postgresql bitnami/postgresql \
  --set initdbScriptsConfigMap=init-db-scripts \
  --set postgresqlDatabase=postgres \
  --set persistence.size=8Gi \
  --set metrics.enabled=true

helm install statsd-exporter prometheus-community/prometheus-statsd-exporter \
  --set statsd.udpPort=8125 \
  --set statsd.tcpPort=8126 \
  --set statsd.eventFlushInterval=30000ms
vim ./configmaps/documentserver.yaml # METRICS_ENABLED: "true"

kubectl create secret generic license
kubectl apply -f ./configmaps/documentserver.yaml
kubectl create secret generic jwt \
  --from-literal=JWT_ENABLED=true \
  --from-literal=JWT_SECRET=jwtsecret

kubectl apply -f ./deployments/spellchecker.yaml
sleep 60
kubectl get deployment spellchecker
# wait to show READY 2/2

kubectl apply -f ./services/spellchecker.yaml
kubectl apply -f ./services/example.yaml
kubectl apply -f ./services/docservice.yaml
kubectl apply -f ./deployments/docservice.yaml
sleep 60
kubectl get deployment docservice
# wait to show READY 2/2

kubectl apply -f ./deployments/converter.yaml
sleep 60
kubectl get deployment converter
# wait to show READY 2/2

kubectl apply -f ./configmaps/example.yaml
kubectl apply -f ./pods/example.yaml

helm install nginx-ingress -f ./ingresses/ingress_values.yaml ingress-nginx/ingress-nginx
kubectl apply -f ./services/documentserver.yaml
kubectl apply -f ./ingresses/documentserver.yaml
sleep 120
kubectl get service documentserver -o jsonpath="{.status.loadBalancer.ingress[*].ip}"


helm repo add kube-state-metrics https://kubernetes.github.io/kube-state-metrics
helm repo update

helm install prometheus prometheus-community/prometheus

kubectl apply -f ./configmaps/grafana.yaml
kubectl apply -f ./secrets/grafana-datasource.yaml
./metrics/get_dashboard.sh
helm install grafana bitnami/grafana \
  --set service.port=80 \
  --set config.useGrafanaIniFile=true \
  --set config.grafanaIniConfigMap=grafana-ini \
  --set datasources.secretName=grafana-datasource \
  --set dashboardsProvider.enabled=true \
  --set dashboardsConfigMaps[0].configMapName=dashboard-node-exporter \
  --set dashboardsConfigMaps[0].fileName=dashboard-node-exporter.json \
  --set dashboardsConfigMaps[1].configMapName=dashboard-deployment \
  --set dashboardsConfigMaps[1].fileName=dashboard-deployment.json \
  --set dashboardsConfigMaps[2].configMapName=dashboard-redis \
  --set dashboardsConfigMaps[2].fileName=dashboard-redis.json \
  --set dashboardsConfigMaps[3].configMapName=dashboard-rabbitmq \
  --set dashboardsConfigMaps[3].fileName=dashboard-rabbitmq.json \
  --set dashboardsConfigMaps[4].configMapName=dashboard-postgresql \
  --set dashboardsConfigMaps[4].fileName=dashboard-postgresql.json \
  --set dashboardsConfigMaps[5].configMapName=dashboard-nginx-ingress \
  --set dashboardsConfigMaps[5].fileName=dashboard-nginx-ingress.json \
  --set dashboardsConfigMaps[5].configMapName=dashboard-documentserver \
  --set dashboardsConfigMaps[5].fileName=documentserver-statsd-exporter.json

kubectl apply -f ./ingresses/grafana.yaml

# Get admin pass for grafana
# Access via 
# http(s)://your-domain-name/grafana/
# user: Admin
# pass: decoded
kubectl get secret grafana-admin --namespace default -o jsonpath="{.data.GF_SECURITY_ADMIN_PASSWORD}" | base64 --decode
Clone this wiki locally