Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

kube-prometheus-stack - New Dashboard in Grafana

Tags:

I am using kube-prometheus-stack for monitoring the kubernetes cluster. This helm chart has some default Grafana view. Apart from the default one, i want to add more dashboard.

To achieve

  1. Created a Configmap with json and applied
  2. Restarted the grafana pod. After doing this, still my new dashboard is not visible in grafana. Please guide me , what i am missing

ConfigMap Content:

apiVersion: v1
data:
grafana-dummy-dashboard.json: |-
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": 15,
"links": [],
"panels": [
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "-- Grafana --",
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 19,
"w": 24,
"x": 0,
"y": 0
},
"hiddenSeries": false,
"id": 2,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"dataLinks": []
},
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Grafana Fake Data",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
}
],
"schemaVersion": 25,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
]
},
"timezone": "",
"title": "Grafana dummy dashboard",
"uid": "UlxCrx4Gk",
"version": 2
}
kind: ConfigMap
metadata:
creationTimestamp: "2021-02-25T18:36:09Z"
managedFields:

apiVersion: v1
fieldsType: FieldsV1
fieldsV1:
f:data:
.: {}
f:grafana-dummy-dashboard.json: {}
manager: kubectl-create
operation: Update
time: "2021-02-25T18:36:09Z"
name: my-config
namespace: monitoring
resourceVersion: "1226938"
selfLink: /api/v1/namespaces/monitoring/configmaps/my-config
uid: 958764ee-5f84-48a2-93eb-1c6728779af3

Grafana Pod Spec

apiVersion: v1
kind: Pod
metadata:
annotations:
checksum/config: 6dff7c26bb7ba0d9ef70e1c8c606456a48d31530440dd2eeedeb61881f30031d
checksum/dashboards-json-config: 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b
checksum/sc-dashboard-provider-config: 004de7c58cd5fe4be7264a0e096aae5c620da7f9d019a9eccbe4e94a815078e0
checksum/secret: e4e24c4feb60f298b35a0d758e2358bb89d37d783878f3d51068593a3db7b7d3
creationTimestamp: "2021-02-25T18:40:18Z"
generateName: mon-grafana-565645c6d4-
labels:
app.kubernetes.io/instance: mon
app.kubernetes.io/name: grafana
pod-template-hash: 565645c6d4
managedFields:

apiVersion: v1
fieldsType: FieldsV1
fieldsV1:
f:metadata:
f:annotations:
.: {}
f:checksum/config: {}
f:checksum/dashboards-json-config: {}
f:checksum/sc-dashboard-provider-config: {}
f:checksum/secret: {}
f:generateName: {}
f:labels:
.: {}
f:app.kubernetes.io/instance: {}
f:app.kubernetes.io/name: {}
f:pod-template-hash: {}
f:ownerReferences:
.: {}
k:{"uid":"af69e5b4-aab1-4446-b948-e1eff68802a3"}:
.: {}
f:apiVersion: {}
f:blockOwnerDeletion: {}
f:controller: {}
f:kind: {}
f:name: {}
f:uid: {}
f:spec:
f:containers:
k:{"name":"grafana"}:
.: {}
f:env:
.: {}
k:{"name":"GF_SECURITY_ADMIN_PASSWORD"}:
.: {}
f:name: {}
f:valueFrom:
.: {}
f:secretKeyRef:
.: {}
f🔑 {}
f:name: {}
k:{"name":"GF_SECURITY_ADMIN_USER"}:
.: {}
f:name: {}
f:valueFrom:
.: {}
f:secretKeyRef:
.: {}
f🔑 {}
f:name: {}
f:image: {}
f:imagePullPolicy: {}
f:livenessProbe:
.: {}
f:failureThreshold: {}
f:httpGet:
.: {}
f:path: {}
f:port: {}
f:scheme: {}
f:initialDelaySeconds: {}
f:periodSeconds: {}
f:successThreshold: {}
f:timeoutSeconds: {}
f:name: {}
f:ports:
.: {}
k:{"containerPort":80,"protocol":"TCP"}:
.: {}
f:containerPort: {}
f:name: {}
f:protocol: {}
k:{"containerPort":3000,"protocol":"TCP"}:
.: {}
f:containerPort: {}
f:name: {}
f:protocol: {}
f:readinessProbe:
.: {}
f:failureThreshold: {}
f:httpGet:
.: {}
f:path: {}
f:port: {}
f:scheme: {}
f:periodSeconds: {}
f:successThreshold: {}
f:timeoutSeconds: {}
f:resources: {}
f:terminationMessagePath: {}
f:terminationMessagePolicy: {}
f:volumeMounts:
.: {}
k:{"mountPath":"/etc/grafana/grafana.ini"}:
.: {}
f:mountPath: {}
f:name: {}
f:subPath: {}
k:{"mountPath":"/etc/grafana/provisioning/dashboards/sc-dashboardproviders.yaml"}:
.: {}
f:mountPath: {}
f:name: {}
f:subPath: {}
k:{"mountPath":"/etc/grafana/provisioning/datasources"}:
.: {}
f:mountPath: {}
f:name: {}
k:{"mountPath":"/tmp/dashboards"}:
.: {}
f:mountPath: {}
f:name: {}
k:{"mountPath":"/var/lib/grafana"}:
.: {}
f:mountPath: {}
f:name: {}
k:{"name":"grafana-sc-dashboard"}:
.: {}
f:env:
.: {}
k:{"name":"FOLDER"}:
.: {}
f:name: {}
f:value: {}
k:{"name":"LABEL"}:
.: {}
f:name: {}
f:value: {}
k:{"name":"METHOD"}:
.: {}
f:name: {}
k:{"name":"RESOURCE"}:
.: {}
f:name: {}
f:value: {}
f:image: {}
f:imagePullPolicy: {}
f:name: {}
f:resources: {}
f:terminationMessagePath: {}
f:terminationMessagePolicy: {}
f:volumeMounts:
.: {}
k:{"mountPath":"/tmp/dashboards"}:
.: {}
f:mountPath: {}
f:name: {}
f:dnsPolicy: {}
f:enableServiceLinks: {}
f:initContainers:
.: {}
k:{"name":"grafana-sc-datasources"}:
.: {}
f:env:
.: {}
k:{"name":"FOLDER"}:
.: {}
f:name: {}
f:value: {}
k:{"name":"LABEL"}:
.: {}
f:name: {}
f:value: {}
k:{"name":"METHOD"}:
.: {}
f:name: {}
f:value: {}
k:{"name":"RESOURCE"}:
.: {}
f:name: {}
f:value: {}
f:image: {}
f:imagePullPolicy: {}
f:name: {}
f:resources: {}
f:terminationMessagePath: {}
f:terminationMessagePolicy: {}
f:volumeMounts:
.: {}
k:{"mountPath":"/etc/grafana/provisioning/datasources"}:
.: {}
f:mountPath: {}
f:name: {}
f:restartPolicy: {}
f:schedulerName: {}
f:securityContext:
.: {}
f:fsGroup: {}
f:runAsGroup: {}
f:runAsUser: {}
f:serviceAccount: {}
f:serviceAccountName: {}
f:terminationGracePeriodSeconds: {}
f:volumes:
.: {}
k:{"name":"config"}:
.: {}
f:configMap:
.: {}
f:defaultMode: {}
f:name: {}
f:name: {}
k:{"name":"sc-dashboard-provider"}:
.: {}
f:configMap:
.: {}
f:defaultMode: {}
f:name: {}
f:name: {}
k:{"name":"sc-dashboard-volume"}:
.: {}
f:emptyDir: {}
f:name: {}
k:{"name":"sc-datasources-volume"}:
.: {}
f:emptyDir: {}
f:name: {}
k:{"name":"storage"}:
.: {}
f:emptyDir: {}
f:name: {}
manager: kube-controller-manager
operation: Update
time: "2021-02-25T18:40:18Z"
apiVersion: v1
fieldsType: FieldsV1
fieldsV1:
f:status:
f:conditions:
k:{"type":"ContainersReady"}:
.: {}
f:lastProbeTime: {}
f:lastTransitionTime: {}
f:status: {}
f:type: {}
k:{"type":"Initialized"}:
.: {}
f:lastProbeTime: {}
f:lastTransitionTime: {}
f:status: {}
f:type: {}
k:{"type":"Ready"}:
.: {}
f:lastProbeTime: {}
f:lastTransitionTime: {}
f:status: {}
f:type: {}
f:containerStatuses: {}
f:hostIP: {}
f:initContainerStatuses: {}
f:phase: {}
f:podIP: {}
f:podIPs:
.: {}
k:{"ip":"10.233.64.91"}:
.: {}
f:ip: {}
f:startTime: {}
manager: kubelet
operation: Update
time: "2021-02-25T18:40:25Z"
name: mon-grafana-565645c6d4-526hg
namespace: monitoring
ownerReferences:
apiVersion: apps/v1
blockOwnerDeletion: true
controller: true
kind: ReplicaSet
name: mon-grafana-565645c6d4
uid: af69e5b4-aab1-4446-b948-e1eff68802a3
resourceVersion: "1227952"
selfLink: /api/v1/namespaces/monitoring/pods/mon-grafana-565645c6d4-526hg
uid: 74487dc2-aac9-4950-81c3-7ab73895eced
spec:
containers:
env:
name: METHOD
name: LABEL
value: grafana_dashboard
name: FOLDER
value: /tmp/dashboards
name: RESOURCE
value: both
image: quay.io/kiwigrid/k8s-sidecar:1.10.6
imagePullPolicy: IfNotPresent
name: grafana-sc-dashboard
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
mountPath: /tmp/dashboards
name: sc-dashboard-volume
mountPath: /var/run/secrets/kubernetes.io/serviceaccount
name: mon-grafana-token-p9x96
readOnly: true
env:
name: GF_SECURITY_ADMIN_USER
valueFrom:
secretKeyRef:
key: admin-user
name: mon-grafana
name: GF_SECURITY_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
key: admin-password
name: mon-grafana
image: grafana/grafana:7.4.2
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 10
httpGet:
path: /api/health
port: 3000
scheme: HTTP
initialDelaySeconds: 60
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 30
name: grafana
ports:
containerPort: 80
name: service
protocol: TCP
containerPort: 3000
name: grafana
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /api/health
port: 3000
scheme: HTTP
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
mountPath: /etc/grafana/grafana.ini
name: config
subPath: grafana.ini
mountPath: /var/lib/grafana
name: storage
mountPath: /tmp/dashboards
name: sc-dashboard-volume
mountPath: /etc/grafana/provisioning/dashboards/sc-dashboardproviders.yaml
name: sc-dashboard-provider
subPath: provider.yaml
mountPath: /etc/grafana/provisioning/datasources
name: sc-datasources-volume
mountPath: /var/run/secrets/kubernetes.io/serviceaccount
name: mon-grafana-token-p9x96
readOnly: true
dnsPolicy: ClusterFirst
enableServiceLinks: true
initContainers:
env:
name: METHOD
value: LIST
name: LABEL
value: grafana_datasource
name: FOLDER
value: /etc/grafana/provisioning/datasources
name: RESOURCE
value: both
image: quay.io/kiwigrid/k8s-sidecar:1.10.6
imagePullPolicy: IfNotPresent
name: grafana-sc-datasources
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
mountPath: /etc/grafana/provisioning/datasources
name: sc-datasources-volume
mountPath: /var/run/secrets/kubernetes.io/serviceaccount
name: mon-grafana-token-p9x96
readOnly: true
nodeName: iyappan-k8s-node-1
priority: 0
restartPolicy: Always
schedulerName: default-scheduler
securityContext:
fsGroup: 472
runAsGroup: 472
runAsUser: 472
serviceAccount: mon-grafana
serviceAccountName: mon-grafana
terminationGracePeriodSeconds: 30
tolerations:
effect: NoExecute
key: node.kubernetes.io/not-ready
operator: Exists
tolerationSeconds: 300
effect: NoExecute
key: node.kubernetes.io/unreachable
operator: Exists
tolerationSeconds: 300
volumes:
configMap:
defaultMode: 420
name: mon-grafana
name: config
emptyDir: {}
name: storage
emptyDir: {}
name: sc-dashboard-volume
configMap:
defaultMode: 420
name: mon-grafana-config-dashboards
name: sc-dashboard-provider
emptyDir: {}
name: sc-datasources-volume
name: mon-grafana-token-p9x96
secret:
defaultMode: 420
secretName: mon-grafana-token-p9x96
status:
conditions:
lastProbeTime: null
lastTransitionTime: "2021-02-25T18:40:21Z"
status: "True"
type: Initialized
lastProbeTime: null
lastTransitionTime: "2021-02-25T18:40:25Z"
status: "True"
type: Ready
lastProbeTime: null
lastTransitionTime: "2021-02-25T18:40:25Z"
status: "True"
type: ContainersReady
lastProbeTime: null
lastTransitionTime: "2021-02-25T18:40:18Z"
status: "True"
type: PodScheduled
containerStatuses:
containerID: docker://947d93368594c216e375313ec725e38ec92d2177b9f7d72348cd1101a32eb71a
image: grafana/grafana:7.4.2
imageID: docker-pullable://grafana/grafana@sha256:29e4e68a557fac7ead72496acea16a9b89626f3311ba7c4a9e39f7fb99f8f68f
lastState: {}
name: grafana
ready: true
restartCount: 0
started: true
state:
running:
startedAt: "2021-02-25T18:40:21Z"
containerID: docker://5f067be9334d0c431085bc935912addfab19ada57c6c44c6faa265800ad0cc62
image: quay.io/kiwigrid/k8s-sidecar:1.10.6
imageID: docker-pullable://quay.io/kiwigrid/k8s-sidecar@sha256:49ffea7ccdbbd5021e2bd20c11a956be23c2f28c558c57b93ac50aa0974fb49c
lastState: {}
name: grafana-sc-dashboard
ready: true
restartCount: 0
started: true
state:
running:
startedAt: "2021-02-25T18:40:21Z"
hostIP: 172.168.1.59
initContainerStatuses:
containerID: docker://56bdc029dfcf286bbecec325f8c0036a869b2bb0d97a90d5eb62776b77a5e2e9
image: quay.io/kiwigrid/k8s-sidecar:1.10.6
imageID: docker-pullable://quay.io/kiwigrid/k8s-sidecar@sha256:49ffea7ccdbbd5021e2bd20c11a956be23c2f28c558c57b93ac50aa0974fb49c
lastState: {}
name: grafana-sc-datasources
ready: true
restartCount: 0
state:
terminated:
containerID: docker://56bdc029dfcf286bbecec325f8c0036a869b2bb0d97a90d5eb62776b77a5e2e9
exitCode: 0
finishedAt: "2021-02-25T18:40:20Z"
reason: Completed
startedAt: "2021-02-25T18:40:19Z"
phase: Running
podIP: 10.233.64.91
podIPs:
ip: 10.233.64.91
qosClass: BestEffort
startTime: "2021-02-25T18:40:18Z"

@iyappansg

Leave a comment No file chosen

like image 331
Iyappan Sankaran Avatar asked Feb 25 '21 18:02

Iyappan Sankaran


1 Answers

Resolved the issue.After adding the label in configmap,it started working

apiVersion: v1
data:
grafana-dummy-dashboard.json: |-
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": 15,
"links": [],
"panels": [
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "-- Grafana --",
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 19,
"w": 24,
"x": 0,
"y": 0
},
"hiddenSeries": false,
"id": 2,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"dataLinks": []
},
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Grafana Fake Data",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
}
],
"schemaVersion": 25,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
]
},
"timezone": "",
"title": "Grafana dummy dashboard",
"uid": "UlxCrx4Gk",
"version": 2
}
kind: ConfigMap
metadata:
managedFields:

apiVersion: v1
fieldsType: FieldsV1
fieldsV1:
f:data:
.: {}
f:grafana-dummy-dashboard.json: {}
manager: kubectl-create
operation: Update
time: "2021-02-25T18:36:09Z"
name: my-config
namespace: monitoring
labels:
      grafana_dashboard: "1"
like image 63
Iyappan Sankaran Avatar answered Oct 05 '22 18:10

Iyappan Sankaran