Setup your own grafana on Openshift 3.11 plateform to monitor entire cluster resources and object.
Follow bellow steps to perform the setup
Create a New project first
oc new-project mygrafana
Get the existing grafana secret from openshift-monitoring project
oc get secrets grafana-datasources -n openshift-monitoring --export -o yaml > grafana-datasources.yaml
Now create secret in my own grafana project
oc create -f grafana-datasources.yaml -n mygrafana
Now get the version of grafana that is being used in your openshift-monitoring namespace
[root@occontrol ~]# oc get deployment grafana -n openshift-monitoring --export -o yaml | grep 'image: grafana'
image: grafana/grafana:5.2.1
Now setup a deployment of the grafana using same image version
oc new-app --name=grafana grafana/grafana:5.2.1 -n mygrafana
Now we will mount the secret grafana-datasources.yaml in this new deployment.
# oc set volume dc/grafana --add --name=grafana-dashsources --type=secret --secret-name=grafana-datasources --mount-path=/etc/grafana/provisioning/datasources --namespace=mygrafana
Mount one empty dir also to /var/lib/grafana path
# oc set volume dc/grafana --add --name=grafana-storage --mount-path=/var/lib/grafana --namespace=mygrafana
You can validate both mounted volume with bellow command
# oc set volume dc/grafana
deploymentconfigs/grafana
secret/grafana-datasources as grafana-dashsources
mounted at /etc/grafana/provisioning/datasources
empty directory as grafana-storage
mounted at /var/lib/grafana
Now we can create ingress for grafana deployment
oc expose svc/grafana -n mygrafana
you can access your custom grafana from url now.
In my case : http://grafana-mygrafana.apps.mylab.local
Comments
Post a Comment