Skip to content

An operator for Grafana that installs and manages Grafana instances, Dashboards and Datasources through Kubernetes/OpenShift CRs

License

Notifications You must be signed in to change notification settings

pddg/grafana-operator

 
 

Repository files navigation

The Grafana Operator is a Kubernetes operator built to help you manage your Grafana instances and its resources in and outside of Kubernetes.

Whether you’re running one Grafana instance or many, the Grafana Operator simplifies the processes of installing, configuring, and maintaining Grafana and its resources. Additionally, it's perfect for those who prefer to manage resources using infrastructure as code or using GitOps workflows through tools like ArgoCD and Flux CD.

Getting Started

Installation

Option 1: Helm Chart

Deploy the Grafana Operator easily in your cluster using Helm:

helm upgrade -i grafana-operator oci://ghcr.io/grafana/helm-charts/grafana-operator --version v5.6.3

Option 2: Kustomize & More

Prefer Kustomize, Openshift OLM, or Kubernetes directly? Find detailed instructions in our Installation Guide.

For even more detailed setups, see our documentation.

Example: Deploying Grafana & A Dashboard

Here's a simple example of deploying Grafana and a Grafana Dashboard using the custom resources (CRs) defined by the Grafana Operator:

apiVersion: grafana.integreatly.org/v1beta1
kind: Grafana
metadata:
  name: grafana
  labels:
    dashboards: "grafana"
spec:
  config:
    log:
      mode: "console"
    auth:
      disable_login_form: false
    security:
      admin_user: root
      admin_password: secret

---
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDashboard
metadata:
  name: sample-dashboard
spec:
  resyncPeriod: 30s
  instanceSelector:
    matchLabels:
      dashboards: "grafana"
  json: >
    {
      "title": "Simple Dashboard",
      "timezone": "browser",
      "refresh": "5s",
      "panels": [],
      "time": {
        "from": "now-6h",
        "to": "now"
      }
    }

For more tailored setups and resources management, check out these guides:

Why Grafana Operator?

Switching to Grafana Operator from traditional deployments amplifies your efficiency by:

  • Enabling multi-instance and multi-namespace Grafana deployments effortlessly.
  • Simplifying dashboard, data sources, and plugin management through code.
  • Supporting both Kubernetes and Openshift with smart adjustments based on the environment.
  • Allowing management of external Grafana instances for robust GitOps integration.
  • Providing multi-architecture support, making it versatile across different platforms.
  • Offering one-click installation through Operatorhub/OLM.

Get In Touch!

Got questions or suggestions? Let us know! The quickest way to reach us is through our GitHub Issues or by joining our weekly public meeting on Tuesdays at 12:30 PM UTC (link here).

Feel free to drop into our Grafana Operator discussions on:

Kubernetes Slack Grafana Slack

Contributing

For more information on how to contribute to the operator look at CONTRIBUTING.md.

Version Support and Development Mindset

Caution

v4 will stop receiving bug fixes and security updates as of the 22nd of December 2023. We recommend you migrate to v5 if you haven't yet! Please follow our v4 -> v5 Migration Guide to mitigate any potential future risks.

V5 is the current, actively developed and maintained version of the operator, which you can find on the Master Branch.

A more in-depth overview of v5 is available in the intro blog

V5 is a ground-up rewrite of the operator to refocus development on:

  • Performance
  • Reliability
  • Maintainability
  • Extensibility
  • Testability
  • Usability

The previous versions of the operator have some serious tech-debt issues, which effectively prevent community members that aren't massively familiar with the project and/or its codebase from contributing features that they wish to see.

These previous versions, we're built on a "as-needed" basis, meaning that whatever was the fastest way to reach the desired feature, was the way it was implemented. This lead to situations where controllers for different resources were using massively different logic, and features were added wherever and however they could be made to work.

V5 aims to re-focus the operator with a more thought out architecture and framework, that will work better, both for developers and users. With certain standards and approaches, we can provide a better user experience through:

  • Better designed Custom Resource Definitions (Upstream Grafana Native fields will be supported without having to whitelist them in the operator logic).
    • Upstream documentation can be followed to define the Grafana Operator Custom Resources.
    • This also means a change in API versions for the resources, but we see this as a benefit, our previous mantra of maintaining a seamless upgrade from version to version, limited us in the changes we wanted to make for a long time.
  • A more streamlined Grafana resource management workflow, one that will be reflected across all controllers.
  • Using an upstream Grafana API client (standardizing our interactions with the Grafana API, moving away from bespoke logic).
  • The use of a more up-to-date Operator-SDK version, making use of newer features.
    • along with all relevant dependencies being kept up-to-date.
  • Proper testing.
  • Cleaning and cutting down on code.
  • Multi-instance and Multi-namespace support!

About

An operator for Grafana that installs and manages Grafana instances, Dashboards and Datasources through Kubernetes/OpenShift CRs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 62.5%
  • Jsonnet 31.7%
  • Makefile 3.8%
  • Shell 0.8%
  • Smarty 0.5%
  • Lua 0.5%
  • Dockerfile 0.2%