Plutono

Learn more about the plutono Plugin. Use it to install the web dashboarding system Plutono to collect, correlate, and visualize Prometheus metrics for your Greenhouse cluster.

The main terminologies used in this document can be found in core-concepts.

Overview

Observability is often required for the operation and automation of service offerings. Plutono provides you with tools to display Prometheus metrics on live dashboards with insightful charts and visualizations. In the Greenhouse context, this complements the kube-monitoring plugin, which automatically acts as a Plutono data source which is recognized by Plutono. In addition, the Plugin provides a mechanism that automates the lifecycle of datasources and dashboards without having to restart Plutono.

Plutono Architecture

Disclaimer

This is not meant to be a comprehensive package that covers all scenarios. If you are an expert, feel free to configure the Plugin according to your needs.

Contribution is highly appreciated. If you discover bugs or want to add functionality to the plugin, then pull requests are always welcome.

Quick Start

This guide provides a quick and straightforward way how to use Plutono as a Greenhouse Plugin on your Kubernetes cluster.

Prerequisites

  • A running and Greenhouse-managed Kubernetes cluster
  • kube-monitoring Plugin installed to have at least one Prometheus instance running in the cluster

The plugin works by default with anonymous access enabled. If you use the standard configuration in the kube-monitoring plugin, the data source and some kubernetes-operations dashboards are already pre-installed.

Step 1: Add your dashboards

Dashboards are selected from ConfigMaps across namespaces. The plugin searches for ConfigMaps with the label plutono-dashboard: "true" and imports them into Plutono. The ConfigMap must contain a key like my-dashboard.json with the dashboard JSON content. Example

A guide on how to create dashboards can be found here.

Step 2: Add your datasources

Data sources are selected from Secrets across namespaces. The plugin searches for Secrets with the label plutono-dashboard: "true" and imports them into Plutono. The Secrets should contain valid datasource configuration YAML. Example

Values

KeyTypeDefaultDescription
global.imagePullSecretslist[]To help compatibility with other charts which use global.imagePullSecrets. Allow either an array of {name: pullSecret} maps (k8s-style), or an array of strings (more common helm-style). Can be templated. global: imagePullSecrets: - name: pullSecret1 - name: pullSecret2 or global: imagePullSecrets: - pullSecret1 - pullSecret2
global.imageRegistrystringnilOverrides the Docker registry globally for all images
plutono.“plutono.ini”.“auth.anonymous”.enabledbooltrue
plutono.“plutono.ini”.“auth.anonymous”.org_rolestring"Admin"
plutono.“plutono.ini”.auth.disable_login_formbooltrue
plutono.“plutono.ini”.log.modestring"console"
plutono.“plutono.ini”.paths.datastring"/var/lib/plutono/"
plutono.“plutono.ini”.paths.logsstring"/var/log/plutono"
plutono.“plutono.ini”.paths.pluginsstring"/var/lib/plutono/plugins"
plutono.“plutono.ini”.paths.provisioningstring"/etc/plutono/provisioning"
plutono.admin.existingSecretstring""
plutono.admin.passwordKeystring"admin-password"
plutono.admin.userKeystring"admin-user"
plutono.adminPasswordstring"strongpassword"
plutono.adminUserstring"admin"
plutono.affinityobject{}Affinity for pod assignment (evaluated as template) ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
plutono.alertingobject{}
plutono.assertNoLeakedSecretsbooltrue
plutono.automountServiceAccountTokenbooltrueShould the service account be auto mounted on the pod
plutono.autoscalingobject{"behavior":{},"enabled":false,"maxReplicas":5,"minReplicas":1,"targetCPU":"60","targetMemory":""}Create HorizontalPodAutoscaler object for deployment type
plutono.containerSecurityContext.allowPrivilegeEscalationboolfalse
plutono.containerSecurityContext.capabilities.drop[0]string"ALL"
plutono.containerSecurityContext.seccompProfile.typestring"RuntimeDefault"
plutono.createConfigmapbooltrueEnable creating the plutono configmap
plutono.dashboardProvidersobject{}
plutono.dashboardsobject{}
plutono.dashboardsConfigMapsobject{}
plutono.datasourcesobject{}
plutono.deploymentStrategyobject{"type":"RollingUpdate"}See kubectl explain deployment.spec.strategy for more # ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy
plutono.dnsConfigobject{}
plutono.dnsPolicystringnildns configuration for pod
plutono.downloadDashboards.envobject{}
plutono.downloadDashboards.envFromSecretstring""
plutono.downloadDashboards.envValueFromobject{}
plutono.downloadDashboards.resourcesobject{}
plutono.downloadDashboards.securityContext.allowPrivilegeEscalationboolfalse
plutono.downloadDashboards.securityContext.capabilities.drop[0]string"ALL"
plutono.downloadDashboards.securityContext.seccompProfile.typestring"RuntimeDefault"
plutono.downloadDashboardsImage.pullPolicystring"IfNotPresent"
plutono.downloadDashboardsImage.registrystring"docker.io"The Docker registry
plutono.downloadDashboardsImage.repositorystring"curlimages/curl"
plutono.downloadDashboardsImage.shastring""
plutono.downloadDashboardsImage.tagstring"8.13.0"
plutono.enableKubeBackwardCompatibilityboolfalseEnable backward compatibility of kubernetes where version below 1.13 doesn’t have the enableServiceLinks option
plutono.enableServiceLinksbooltrue
plutono.envobject{}
plutono.envFromConfigMapslist[]The names of conifgmaps in the same kubernetes namespace which contain values to be added to the environment Each entry should contain a name key, and can optionally specify whether the configmap must be defined with an optional key. Name is templated. ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#configmapenvsource-v1-core
plutono.envFromSecretstring""The name of a secret in the same kubernetes namespace which contain values to be added to the environment This can be useful for auth tokens, etc. Value is templated.
plutono.envFromSecretslist[]The names of secrets in the same kubernetes namespace which contain values to be added to the environment Each entry should contain a name key, and can optionally specify whether the secret must be defined with an optional key. Name is templated.
plutono.envRenderSecretobject{}Sensible environment variables that will be rendered as new secret object This can be useful for auth tokens, etc. If the secret values contains “{{”, they’ll need to be properly escaped so that they are not interpreted by Helm ref: https://helm.sh/docs/howto/charts_tips_and_tricks/#using-the-tpl-function
plutono.envValueFromobject{}
plutono.extraConfigmapMountslist[]Values are templated.
plutono.extraContainerVolumeslist[]Volumes that can be used in init containers that will not be mounted to deployment pods
plutono.extraContainersstring""Enable an Specify container in extraContainers. This is meant to allow adding an authentication proxy to a plutono pod
plutono.extraEmptyDirMountslist[]
plutono.extraExposePortslist[]
plutono.extraInitContainerslist[]Additional init containers (evaluated as template) ref: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
plutono.extraLabelsobject{"plugin":"plutono"}Apply extra labels to common labels.
plutono.extraObjectslist[]Create a dynamic manifests via values:
plutono.extraSecretMountslist[]The additional plutono server secret mounts Defines additional mounts with secrets. Secrets must be manually created in the namespace.
plutono.extraVolumeMountslist[]The additional plutono server volume mounts Defines additional volume mounts.
plutono.extraVolumeslist[]
plutono.gossipPortNamestring"gossip"
plutono.headlessServiceboolfalseCreate a headless service for the deployment
plutono.hostAliaseslist[]overrides pod.spec.hostAliases in the plutono deployment’s pods
plutono.imageobject{"pullPolicy":"IfNotPresent","pullSecrets":[],"registry":"ghcr.io","repository":"credativ/plutono","sha":"","tag":"v7.5.37"}Use an alternate scheduler, e.g. “stork”. # ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/ # schedulerName: “default-scheduler”
plutono.image.pullSecretslist[]Optionally specify an array of imagePullSecrets. # Secrets must be manually created in the namespace. # ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ # Can be templated. #
plutono.image.tagstring"v7.5.37"Overrides the Plutono image tag whose default is the chart appVersion
plutono.ingress.annotationsobject{}
plutono.ingress.enabledboolfalse
plutono.ingress.extraPathslist[]Extra paths to prepend to every host configuration. This is useful when working with annotation based services.
plutono.ingress.hosts[0]string"chart-example.local"
plutono.ingress.labelsobject{}
plutono.ingress.pathstring"/"
plutono.ingress.pathTypestring"Prefix"pathType is only for k8s >= 1.1=
plutono.ingress.tlslist[]
plutono.lifecycleHooksobject{}
plutono.livenessProbe.failureThresholdint10
plutono.livenessProbe.httpGet.pathstring"/api/health"
plutono.livenessProbe.httpGet.portint3000
plutono.livenessProbe.initialDelaySecondsint60
plutono.livenessProbe.timeoutSecondsint30
plutono.namespaceOverridestring""
plutono.networkPolicy.allowExternalbooltrue@param networkPolicy.ingress When true enables the creation # an ingress network policy #
plutono.networkPolicy.egress.blockDNSResolutionboolfalse@param networkPolicy.egress.blockDNSResolution When enabled, DNS resolution will be blocked # for all pods in the plutono namespace.
plutono.networkPolicy.egress.enabledboolfalse@param networkPolicy.egress.enabled When enabled, an egress network policy will be # created allowing plutono to connect to external data sources from kubernetes cluster.
plutono.networkPolicy.egress.portslist[]@param networkPolicy.egress.ports Add individual ports to be allowed by the egress
plutono.networkPolicy.egress.tolist[]
plutono.networkPolicy.enabledboolfalse@param networkPolicy.enabled Enable creation of NetworkPolicy resources. Only Ingress traffic is filtered for now. #
plutono.networkPolicy.explicitNamespacesSelectorobject{}@param networkPolicy.explicitNamespacesSelector A Kubernetes LabelSelector to explicitly select namespaces from which traffic could be allowed # If explicitNamespacesSelector is missing or set to {}, only client Pods that are in the networkPolicy’s namespace # and that match other criteria, the ones that have the good label, can reach the plutono. # But sometimes, we want the plutono to be accessible to clients from other namespaces, in this case, we can use this # LabelSelector to select these namespaces, note that the networkPolicy’s namespace should also be explicitly added. # # Example: # explicitNamespacesSelector: # matchLabels: # role: frontend # matchExpressions: # - {key: role, operator: In, values: [frontend]} #
plutono.networkPolicy.ingressbooltrue@param networkPolicy.allowExternal Don’t require client label for connections # The Policy model to apply. When set to false, only pods with the correct # client label will have network access to plutono port defined. # When true, plutono will accept connections from any source # (with the correct destination port). #
plutono.nodeSelectorobject{}Node labels for pod assignment ref: https://kubernetes.io/docs/user-guide/node-selection/
plutono.persistenceobject{"accessModes":["ReadWriteOnce"],"disableWarning":false,"enabled":false,"extraPvcLabels":{},"finalizers":["kubernetes.io/pvc-protection"],"inMemory":{"enabled":false},"lookupVolumeName":true,"size":"10Gi","type":"pvc"}Enable persistence using Persistent Volume Claims ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
plutono.persistence.extraPvcLabelsobject{}Extra labels to apply to a PVC.
plutono.persistence.inMemoryobject{"enabled":false}If persistence is not enabled, this allows to mount the # local storage in-memory to improve performance #
plutono.persistence.lookupVolumeNamebooltrueIf ’lookupVolumeName’ is set to true, Helm will attempt to retrieve the current value of ‘spec.volumeName’ and incorporate it into the template.
plutono.pluginslist[]
plutono.podDisruptionBudgetobject{}See kubectl explain poddisruptionbudget.spec for more # ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/
plutono.podPortNamestring"plutono"
plutono.rbac.createbooltrue
plutono.rbac.extraClusterRoleRuleslist[]
plutono.rbac.extraRoleRuleslist[]
plutono.rbac.namespacedboolfalse
plutono.rbac.pspEnabledboolfalseUse an existing ClusterRole/Role (depending on rbac.namespaced false/true) useExistingRole: name-of-some-role useExistingClusterRole: name-of-some-clusterRole
plutono.rbac.pspUseAppArmorboolfalse
plutono.readinessProbe.httpGet.pathstring"/api/health"
plutono.readinessProbe.httpGet.portint3000
plutono.replicasint1
plutono.resourcesobject{}
plutono.revisionHistoryLimitint10
plutono.securityContext.fsGroupint472
plutono.securityContext.runAsGroupint472
plutono.securityContext.runAsNonRootbooltrue
plutono.securityContext.runAsUserint472
plutono.serviceobject{"annotations":{},"appProtocol":"","enabled":true,"ipFamilies":[],"ipFamilyPolicy":"","labels":{"greenhouse.sap/expose":"true"},"loadBalancerClass":"","loadBalancerIP":"","loadBalancerSourceRanges":[],"port":80,"portName":"service","targetPort":3000,"type":"ClusterIP"}Expose the plutono service to be accessed from outside the cluster (LoadBalancer service). # or access it from within the cluster (ClusterIP service). Set the service type and the port to serve it. # ref: http://kubernetes.io/docs/user-guide/services/ #
plutono.service.annotationsobject{}Service annotations. Can be templated.
plutono.service.appProtocolstring""Adds the appProtocol field to the service. This allows to work with istio protocol selection. Ex: “http” or “tcp”
plutono.service.ipFamilieslist[]Sets the families that should be supported and the order in which they should be applied to ClusterIP as well. Can be IPv4 and/or IPv6.
plutono.service.ipFamilyPolicystring""Set the ip family policy to configure dual-stack see Configure dual-stack
plutono.serviceAccount.automountServiceAccountTokenboolfalse
plutono.serviceAccount.createbooltrue
plutono.serviceAccount.labelsobject{}
plutono.serviceAccount.namestringnil
plutono.serviceAccount.nameTeststringnil
plutono.serviceMonitor.enabledboolfalseIf true, a ServiceMonitor CR is created for a prometheus operator # https://github.com/coreos/prometheus-operator #
plutono.serviceMonitor.intervalstring"30s"
plutono.serviceMonitor.labelsobject{}namespace: monitoring (defaults to use the namespace this chart is deployed to)
plutono.serviceMonitor.metricRelabelingslist[]
plutono.serviceMonitor.pathstring"/metrics"
plutono.serviceMonitor.relabelingslist[]
plutono.serviceMonitor.schemestring"http"
plutono.serviceMonitor.scrapeTimeoutstring"30s"
plutono.serviceMonitor.targetLabelslist[]
plutono.serviceMonitor.tlsConfigobject{}
plutono.sidecarobject{"alerts":{"enabled":false,"env":{},"extraMounts":[],"initAlerts":false,"label":"plutono_alert","labelValue":"","reloadURL":"http://localhost:3000/api/admin/provisioning/alerting/reload","resource":"both","script":null,"searchNamespace":null,"sizeLimit":{},"skipReload":false,"watchMethod":"WATCH"},"dashboards":{"SCProvider":true,"defaultFolderName":null,"enabled":true,"env":{},"envValueFrom":{},"extraMounts":[],"folder":"/tmp/dashboards","folderAnnotation":null,"label":"plutono-dashboard","labelValue":"true","provider":{"allowUiUpdates":false,"disableDelete":false,"folder":"","folderUid":"","foldersFromFilesStructure":false,"name":"sidecarProvider","orgid":1,"type":"file"},"reloadURL":"http://localhost:3000/api/admin/provisioning/dashboards/reload","resource":"both","script":null,"searchNamespace":"ALL","sizeLimit":{},"skipReload":false,"watchMethod":"WATCH"},"datasources":{"enabled":true,"env":{},"envValueFrom":{},"initDatasources":false,"label":"plutono-datasource","labelValue":"true","reloadURL":"http://localhost:3000/api/admin/provisioning/datasources/reload","resource":"both","script":null,"searchNamespace":"ALL","sizeLimit":{},"skipReload":false,"watchMethod":"WATCH"},"enableUniqueFilenames":false,"image":{"registry":"quay.io","repository":"kiwigrid/k8s-sidecar","sha":"","tag":"1.30.3"},"imagePullPolicy":"IfNotPresent","livenessProbe":{},"notifiers":{"enabled":false,"env":{},"initNotifiers":false,"label":"plutono_notifier","labelValue":"","reloadURL":"http://localhost:3000/api/admin/provisioning/notifications/reload","resource":"both","script":null,"searchNamespace":null,"sizeLimit":{},"skipReload":false,"watchMethod":"WATCH"},"readinessProbe":{},"resources":{},"securityContext":{"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"seccompProfile":{"type":"RuntimeDefault"}}}Sidecars that collect the configmaps with specified label and stores the included files them into the respective folders Requires at least Plutono 5 to work and can’t be used together with parameters dashboardProviders, datasources and dashboards
plutono.sidecar.alerts.envobject{}Additional environment variables for the alerts sidecar
plutono.sidecar.alerts.labelstring"plutono_alert"label that the configmaps with alert are marked with
plutono.sidecar.alerts.labelValuestring""value of label that the configmaps with alert are set to
plutono.sidecar.alerts.resourcestring"both"search in configmap, secret or both
plutono.sidecar.alerts.searchNamespacestringnilIf specified, the sidecar will search for alert config-maps inside this namespace. Otherwise the namespace in which the sidecar is running will be used. It’s also possible to specify ALL to search in all namespaces
plutono.sidecar.alerts.watchMethodstring"WATCH"Method to use to detect ConfigMap changes. With WATCH the sidecar will do a WATCH requests, with SLEEP it will list all ConfigMaps, then sleep for 60 seconds.
plutono.sidecar.dashboards.defaultFolderNamestringnilThe default folder name, it will create a subfolder under the folder and put dashboards in there instead
plutono.sidecar.dashboards.extraMountslist[]Additional dashboard sidecar volume mounts
plutono.sidecar.dashboards.folderstring"/tmp/dashboards"folder in the pod that should hold the collected dashboards (unless defaultFolderName is set)
plutono.sidecar.dashboards.folderAnnotationstringnilIf specified, the sidecar will look for annotation with this name to create folder and put graph here. You can use this parameter together with provider.foldersFromFilesStructureto annotate configmaps and create folder structure.
plutono.sidecar.dashboards.providerobject{"allowUiUpdates":false,"disableDelete":false,"folder":"","folderUid":"","foldersFromFilesStructure":false,"name":"sidecarProvider","orgid":1,"type":"file"}watchServerTimeout: request to the server, asking it to cleanly close the connection after that. defaults to 60sec; much higher values like 3600 seconds (1h) are feasible for non-Azure K8S watchServerTimeout: 3600 watchClientTimeout: is a client-side timeout, configuring your local socket. If you have a network outage dropping all packets with no RST/FIN, this is how long your client waits before realizing & dropping the connection. defaults to 66sec (sic!) watchClientTimeout: 60 provider configuration that lets plutono manage the dashboards
plutono.sidecar.dashboards.provider.allowUiUpdatesboolfalseallow updating provisioned dashboards from the UI
plutono.sidecar.dashboards.provider.disableDeleteboolfalsedisableDelete to activate a import-only behaviour
plutono.sidecar.dashboards.provider.folderstring""folder in which the dashboards should be imported in plutono
plutono.sidecar.dashboards.provider.folderUidstring""folder UID. will be automatically generated if not specified
plutono.sidecar.dashboards.provider.foldersFromFilesStructureboolfalseallow Plutono to replicate dashboard structure from filesystem
plutono.sidecar.dashboards.provider.namestring"sidecarProvider"name of the provider, should be unique
plutono.sidecar.dashboards.provider.orgidint1orgid as configured in plutono
plutono.sidecar.dashboards.provider.typestring"file"type of the provider
plutono.sidecar.dashboards.reloadURLstring"http://localhost:3000/api/admin/provisioning/dashboards/reload"Endpoint to send request to reload alerts
plutono.sidecar.dashboards.searchNamespacestring"ALL"Namespaces list. If specified, the sidecar will search for config-maps/secrets inside these namespaces. Otherwise the namespace in which the sidecar is running will be used. It’s also possible to specify ALL to search in all namespaces.
plutono.sidecar.dashboards.sizeLimitobject{}Sets the size limit of the dashboard sidecar emptyDir volume
plutono.sidecar.datasources.envobject{}Additional environment variables for the datasourcessidecar
plutono.sidecar.datasources.initDatasourcesboolfalseThis is needed if skipReload is true, to load any datasources defined at startup time. Deploy the datasources sidecar as an initContainer.
plutono.sidecar.datasources.reloadURLstring"http://localhost:3000/api/admin/provisioning/datasources/reload"Endpoint to send request to reload datasources
plutono.sidecar.datasources.resourcestring"both"search in configmap, secret or both
plutono.sidecar.datasources.scriptstringnilAbsolute path to shell script to execute after a datasource got reloaded
plutono.sidecar.datasources.searchNamespacestring"ALL"If specified, the sidecar will search for datasource config-maps inside this namespace. Otherwise the namespace in which the sidecar is running will be used. It’s also possible to specify ALL to search in all namespaces
plutono.sidecar.datasources.watchMethodstring"WATCH"Method to use to detect ConfigMap changes. With WATCH the sidecar will do a WATCH requests, with SLEEP it will list all ConfigMaps, then sleep for 60 seconds.
plutono.sidecar.image.registrystring"quay.io"The Docker registry
plutono.testFramework.enabledbooltrue
plutono.testFramework.image.registrystring"ghcr.io"
plutono.testFramework.image.repositorystring"cloudoperators/greenhouse-extensions-integration-test"
plutono.testFramework.image.tagstring"main"
plutono.testFramework.imagePullPolicystring"IfNotPresent"
plutono.testFramework.resourcesobject{}
plutono.testFramework.securityContextobject{}
plutono.tolerationslist[]Tolerations for pod assignment ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
plutono.topologySpreadConstraintslist[]Topology Spread Constraints ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/
plutono.useStatefulSetboolfalse

Example of extraVolumeMounts and extraVolumes

Configure additional volumes with extraVolumes and volume mounts with extraVolumeMounts.

Example for extraVolumeMounts and corresponding extraVolumes:

extraVolumeMounts:
  - name: plugins
    mountPath: /var/lib/plutono/plugins
    subPath: configs/plutono/plugins
    readOnly: false
  - name: dashboards
    mountPath: /var/lib/plutono/dashboards
    hostPath: /usr/shared/plutono/dashboards
    readOnly: false

extraVolumes:
  - name: plugins
    existingClaim: existing-plutono-claim
  - name: dashboards
    hostPath: /usr/shared/plutono/dashboards

Volumes default to emptyDir. Set to persistentVolumeClaim, hostPath, csi, or configMap for other types. For a persistentVolumeClaim, specify an existing claim name with existingClaim.

Import dashboards

There are a few methods to import dashboards to Plutono. Below are some examples and explanations as to how to use each method:

dashboards:
  default:
    some-dashboard:
      json: |
        {
          "annotations":

          ...
          # Complete json file here
          ...

          "title": "Some Dashboard",
          "uid": "abcd1234",
          "version": 1
        }        
    custom-dashboard:
      # This is a path to a file inside the dashboards directory inside the chart directory
      file: dashboards/custom-dashboard.json
    prometheus-stats:
      # Ref: https://plutono.com/dashboards/2
      gnetId: 2
      revision: 2
      datasource: Prometheus
    loki-dashboard-quick-search:
      gnetId: 12019
      revision: 2
      datasource:
      - name: DS_PROMETHEUS
        value: Prometheus
    local-dashboard:
      url: https://raw.githubusercontent.com/user/repository/master/dashboards/dashboard.json

Create a dashboard

  1. Click Dashboards in the main menu.

  2. Click New and select New Dashboard.

  3. Click Add new empty panel.

  4. Important: Add a datasource variable as they are provisioned in the cluster.

    • Go to Dashboard settings.
    • Click Variables.
    • Click Add variable.
    • General: Configure the variable with a proper Name as Type Datasource.
    • Data source options: Select the data source Type e.g. Prometheus.
    • Click Update.
    • Go back.
  5. Develop your panels.

    • On the Edit panel view, choose your desired Visualization.
    • Select the datasource variable you just created.
    • Write or construct a query in the query language of your data source.
    • Move and resize the panels as needed.
  6. Optionally add a tag to the dashboard to make grouping easier.

    • Go to Dashboard settings.
    • In the General section, add a Tag.
  7. Click Save. Note that the dashboard is saved in the browser’s local storage.

  8. Export the dashboard.

    • Go to Dashboard settings.
    • Click JSON Model.
    • Copy the JSON model.
    • Go to your Github repository and create a new JSON file in the dashboards directory.

BASE64 dashboards

Dashboards could be stored on a server that does not return JSON directly and instead of it returns a Base64 encoded file (e.g. Gerrit) A new parameter has been added to the url use case so if you specify a b64content value equals to true after the url entry a Base64 decoding is applied before save the file to disk. If this entry is not set or is equals to false not decoding is applied to the file before saving it to disk.

Gerrit use case

Gerrit API for download files has the following schema: https://yourgerritserver/a/{project-name}/branches/{branch-id}/files/{file-id}/content where {project-name} and {file-id} usually has ‘/’ in their values and so they MUST be replaced by %2F so if project-name is user/repo, branch-id is master and file-id is equals to dir1/dir2/dashboard the url value is https://yourgerritserver/a/user%2Frepo/branches/master/files/dir1%2Fdir2%2Fdashboard/content

Sidecar for dashboards

If the parameter sidecar.dashboards.enabled is set, a sidecar container is deployed in the plutono pod. This container watches all configmaps (or secrets) in the cluster and filters out the ones with a label as defined in sidecar.dashboards.label. The files defined in those configmaps are written to a folder and accessed by plutono. Changes to the configmaps are monitored and the imported dashboards are deleted/updated.

A recommendation is to use one configmap per dashboard, as a reduction of multiple dashboards inside one configmap is currently not properly mirrored in plutono.

NOTE: Configure your data sources in your dashboards as variables to keep them portable across clusters.

Example dashboard config:

Folder structure:

dashboards/
├── dashboard1.json
├── dashboard2.json
templates/
├──dashboard-json-configmap.yaml

Helm template to create a configmap for each dashboard:

{{- range $path, $bytes := .Files.Glob "dashboards/*.json" }}
---
apiVersion: v1
kind: ConfigMap

metadata:
  name: {{ printf "%s-%s" $.Release.Name $path | replace "/" "-" | trunc 63 }}
  labels:
    plutono-dashboard: "true"

data:
{{ printf "%s: |-" $path | replace "/" "-" | indent 2 }}
{{ printf "%s" $bytes | indent 4 }}

{{- end }}

Sidecar for datasources

If the parameter sidecar.datasources.enabled is set, an init container is deployed in the plutono pod. This container lists all secrets (or configmaps, though not recommended) in the cluster and filters out the ones with a label as defined in sidecar.datasources.label. The files defined in those secrets are written to a folder and accessed by plutono on startup. Using these yaml files, the data sources in plutono can be imported.

Should you aim for reloading datasources in Plutono each time the config is changed, set sidecar.datasources.skipReload: false and adjust sidecar.datasources.reloadURL to http://<svc-name>.<namespace>.svc.cluster.local/api/admin/provisioning/datasources/reload.

Secrets are recommended over configmaps for this usecase because datasources usually contain private data like usernames and passwords. Secrets are the more appropriate cluster resource to manage those.

Example datasource config:

apiVersion: v1
kind: Secret
metadata:
  name: plutono-datasources
  labels:
    # default value for: sidecar.datasources.label
    plutono-datasource: "true"
stringData:
  datasources.yaml: |-
    apiVersion: 1
    datasources:
      - name: my-prometheus
        type: prometheus
        access: proxy
        orgId: 1
        url: my-url-domain:9090
        isDefault: false
        jsonData:
          httpMethod: 'POST'
        editable: false    

NOTE: If you might include credentials in your datasource configuration, make sure to not use stringdata but base64 encoded data instead.

apiVersion: v1
kind: Secret
metadata:
  name: my-datasource
  labels:
    plutono-datasource: "true"
data:
  # The key must contain a unique name and the .yaml file type
  my-datasource.yaml: {{ include (print $.Template.BasePath "my-datasource.yaml") . | b64enc }}

Example values to add a datasource adapted from Grafana:

datasources:
 datasources.yaml:
  apiVersion: 1
  datasources:
      # <string, required> Sets the name you use to refer to
      # the data source in panels and queries.
    - name: my-prometheus
      # <string, required> Sets the data source type.
      type: prometheus
      # <string, required> Sets the access mode, either
      # proxy or direct (Server or Browser in the UI).
      # Some data sources are incompatible with any setting
      # but proxy (Server).
      access: proxy
      # <int> Sets the organization id. Defaults to orgId 1.
      orgId: 1
      # <string> Sets a custom UID to reference this
      # data source in other parts of the configuration.
      # If not specified, Plutono generates one.
      uid:
      # <string> Sets the data source's URL, including the
      # port.
      url: my-url-domain:9090
      # <string> Sets the database user, if necessary.
      user:
      # <string> Sets the database name, if necessary.
      database:
      # <bool> Enables basic authorization.
      basicAuth:
      # <string> Sets the basic authorization username.
      basicAuthUser:
      # <bool> Enables credential headers.
      withCredentials:
      # <bool> Toggles whether the data source is pre-selected
      # for new panels. You can set only one default
      # data source per organization.
      isDefault: false
      # <map> Fields to convert to JSON and store in jsonData.
      jsonData:
        httpMethod: 'POST'
        # <bool> Enables TLS authentication using a client
        # certificate configured in secureJsonData.
        # tlsAuth: true
        # <bool> Enables TLS authentication using a CA
        # certificate.
        # tlsAuthWithCACert: true
      # <map> Fields to encrypt before storing in jsonData.
      secureJsonData:
        # <string> Defines the CA cert, client cert, and
        # client key for encrypted authentication.
        # tlsCACert: '...'
        # tlsClientCert: '...'
        # tlsClientKey: '...'
        # <string> Sets the database password, if necessary.
        # password:
        # <string> Sets the basic authorization password.
        # basicAuthPassword:
      # <int> Sets the version. Used to compare versions when
      # updating. Ignored when creating a new data source.
      version: 1
      # <bool> Allows users to edit data sources from the
      # Plutono UI.
      editable: false

How to serve Plutono with a path prefix (/plutono)

In order to serve Plutono with a prefix (e.g., http://example.com/plutono), add the following to your values.yaml.

ingress:
  enabled: true
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/rewrite-target: /$1
    nginx.ingress.kubernetes.io/use-regex: "true"

  path: /plutono/?(.*)
  hosts:
    - k8s.example.dev

plutono.ini:
  server:
    root_url: http://localhost:3000/plutono # this host can be localhost

How to securely reference secrets in plutono.ini

This example uses Plutono file providers for secret values and the extraSecretMounts configuration flag (Additional plutono server secret mounts) to mount the secrets.

In plutono.ini:

plutono.ini:
  [auth.generic_oauth]
  enabled = true
  client_id = $__file{/etc/secrets/auth_generic_oauth/client_id}
  client_secret = $__file{/etc/secrets/auth_generic_oauth/client_secret}

Existing secret, or created along with helm:

---
apiVersion: v1
kind: Secret
metadata:
  name: auth-generic-oauth-secret
type: Opaque
stringData:
  client_id: <value>
  client_secret: <value>
  • Include in the extraSecretMounts configuration flag:
- extraSecretMounts:
  - name: auth-generic-oauth-secret-mount
    secretName: auth-generic-oauth-secret
    defaultMode: 0440
    mountPath: /etc/secrets/auth_generic_oauth
    readOnly: true