Skip to content

Grafana

This section shows all available options that can be overridden in the config.jsonnet file.

All Grafana config is stored under the grafana object in the config.

js
{
  grafana+: {
    annotations:: {
      deployment: {},
      ingress: {},
      pod: {},
    },
    dashboards:: [
      {
        definition: importstr '../../dashboards/kubernetes-node-resources.json',
        file: 'kubernetes-node-resources.json',
        folder: 'Kubernetes',
        title: 'Node Resources',
      },
      {
        definition: importstr '../../dashboards/kubernetes-pod-resources.json',
        file: 'kubernetes-pod-resources.json',
        folder: 'Kubernetes',
        title: 'Pod Resources',
      },
    ],
    env:: {},
    image:: 'grafana/grafana:9.5.1',
    ingress:: {},
    labels:: {
      deployment: {},
      pod: {},
      selector: {'app.kubernetes.io/name': 'grafana'},
    },
    name:: 'grafana',
    path:: '/',
    ports:: {
      external: 80,
      internal: 3000,
    },
    resources:: {
      cpu: {request: '50m', limit: '200m'},
      memory: {request: '32Mi', limit: '128Mi'},
    },
    secrets:: {
      admin: {
        username: '<fill with admin username>',
        password: '<fill with admin password>',
      },
    },
    security:: {
      tls: {
        enabled: false,
        issuer: '<fill with certificate issuer>',
      },
    },
  }
}
FieldDescription / Default
annotations.deploymentAnnotations added at the deployment (topmost) level.
{}
annotations.ingressAnnotations added to the ingress.
{}
annotations.podAnnotations added at the pod level.
{}
dashboardsArray of dashboard definitions that are provisioned.
See Custom Dashboards.
[ /* various default dashboards */ ]
envEnvironment variables that are added to the Grafana container. See Customize Grafana
{}
hostHostname where the UI is exposed.
undefined
imageDocker image that gets deployed.
grafana/grafana:9.5.1
ingress.classNameClass name added to the Grafana ingress.
undefined
labels.deploymentLabels added at the deployment (topmost) level.
{}
labels.podLabels added at the pod level.
{}
labels.selectorSelector used for all Grafana k8s resources.
{'app.kubernetes.io/name': 'grafana'}
nameName used for the k8s resources.
grafana
pathPath where the UI is exposed.
/
ports.externalExternal port where the UI is exposed.
80
ports.internalInternal port used inside the container.
3000
resources.cpu.requestMin. requested amount of CPU time.
50m
resources.cpu.limitMax. allowed amount of CPU time.
200m
resources.memory.requestMin. requested amount of memory.
32Mi
resources.memory.limitMax. allowed amount of memory.
128Mi
secrets.admin.usernameAdmin username for Grafana.
<fill with admin username>
secrets.admin.passwordAdmin password for Grafana.
<fill with admin password>
security.tls.enabledEnables TLS, creating a certificate to access Grafana over HTTPS.
false
security.tls.issuerIssuer or ClusterIssuer where the certificate is requested. See cert-manager documentation on how to set one up.
<fill with certificate issuer>

Customize Grafana

While it is possible to configure the most common options through the Jsonnet config above, it doesn't cover all use cases.
Grafana itself is quite customizable and allows to set any possible option through environment variables. See overide configuration with environment variabls on the official Grafana documentation.

The environment variables can be set by using the env field mentioned above.
An example may look like this:

js
{
  grafana+: {
    env+:: {
      'GF_AUTH_DISABLE_LOGIN_FORM': true,
      'GF_AUTH_GITHUB_AUTH_URL': 'https://github.com/login/oauth/authorize',
      'GF_AUTH_GITHUB_ENABLED': true,
    },
  }
}