grafana / grafana-operator

An operator for Grafana that installs and manages Grafana instances, Dashboards and Datasources through Kubernetes/OpenShift CRs
https://grafana.github.io/grafana-operator/
Apache License 2.0
863 stars 384 forks source link
community go golang grafana grafana-operator hacktober k8s kubernetes kubernetes-operator monitoring observability open-source openshift openshift-v4 operator
# Grafana Operator [![Grafana](https://img.shields.io/badge/grafana-%23F46800.svg?&logo=grafana&logoColor=white)](https://grafana.com/) [![Grafana Operator](https://img.shields.io/badge/Grafana%20Operator-orange)](https://grafana.github.io/grafana-operator/) [![GitHub tag](https://img.shields.io/github/tag/grafana/grafana-operator.svg)](https://github.com/grafana/grafana-operator/tags) [![GitHub Last Commit](https://img.shields.io/github/last-commit/grafana/grafana-operator)](https://github.com/grafana/grafana-operator/tags) [![GitHub Contributors](https://img.shields.io/github/contributors/grafana/grafana-operator)](https://github.com/grafana/grafana-operator/tags) **[Official Documentation](https://grafana-operator.github.io/grafana-operator/)** | **[Quickstart](#getting-started)** | **[Installation](#installation)** | **[Tutorials](https://grafana.com/docs/grafana-cloud/developer-resources/infrastructure-as-code/grafana-operator/)**

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.12.0

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"
    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:

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 Mondays at 11:00 Central European (Summer) Time (09:00/10:00 UTC in Summer/Winter) (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:

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: