OpenMCF logoOpenMCF

Loading...

Kubernetes Grafana

Deploys Grafana on Kubernetes using the official Grafana Helm chart (v8.7.0). Provisions a ClusterIP service with configurable container resources, optional namespace creation, and optional external/internal ingress via nginx ingress controllers.

What Gets Created

When you deploy a KubernetesGrafana resource, OpenMCF provisions:

  • Kubernetes Namespace — created if createNamespace is true
  • Grafana Helm Release — the official grafana chart (v8.7.0) from https://grafana.github.io/helm-charts, which creates:
    • A Grafana pod with default admin credentials (admin / admin)
    • Kubernetes ClusterIP Service on port 80 for cluster-internal access
    • Persistence disabled by default
  • Ingress Resources (when ingress.enabled is true):
    • External Ingress — routes traffic from the configured hostname to the Grafana service using the nginx ingress class
    • Internal Ingress — routes traffic from an internal- prefixed hostname to the same service using the nginx-internal ingress class

Prerequisites

  • A Kubernetes cluster with kubectl configured for access
  • nginx ingress controller installed (only if using ingress)
  • nginx-internal ingress controller installed (only if using internal ingress)

Quick Start

Create a file grafana.yaml:

apiVersion: kubernetes.openmcf.org/v1
kind: KubernetesGrafana
metadata:
  name: my-grafana
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: dev.KubernetesGrafana.my-grafana
spec:
  namespace:
    value: grafana-dev
  createNamespace: true

Deploy:

openmcf apply -f grafana.yaml

This creates a Grafana instance with default resources (1 CPU / 1Gi memory limit, 50m CPU / 100Mi memory request) in the grafana-dev namespace. Access the dashboard with admin / admin via the port-forward command in the stack outputs.

Configuration Reference

Required Fields

FieldTypeDescriptionValidation
namespaceStringValueOrRefKubernetes namespace for the Grafana deployment. Use value for a direct string or valueFrom to reference a KubernetesNamespace resource.Required
containerobjectContainer specification including resource allocations.Required

Optional Fields

FieldTypeDefaultDescription
createNamespaceboolfalseCreate the namespace if it does not exist.
container.resources.limits.cpustring"1000m"CPU limit for the Grafana container.
container.resources.limits.memorystring"1Gi"Memory limit for the Grafana container.
container.resources.requests.cpustring"50m"CPU request for the Grafana container.
container.resources.requests.memorystring"100Mi"Memory request for the Grafana container.
ingress.enabledboolfalseEnable external and internal access via nginx ingress.
ingress.hostnamestring--Full hostname for external access (e.g., grafana.example.com). Required when ingress.enabled is true. An internal ingress is also created at internal-{hostname}.

Examples

Grafana with Custom Resources

Increase CPU and memory for a busier monitoring environment:

apiVersion: kubernetes.openmcf.org/v1
kind: KubernetesGrafana
metadata:
  name: monitoring-grafana
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: dev.KubernetesGrafana.monitoring-grafana
spec:
  namespace:
    value: monitoring
  createNamespace: true
  container:
    resources:
      limits:
        cpu: "2000m"
        memory: "4Gi"
      requests:
        cpu: "250m"
        memory: "512Mi"

Grafana in an Existing Namespace

Deploy into a pre-existing namespace without creating it, and reference a KubernetesNamespace resource via valueFrom:

apiVersion: kubernetes.openmcf.org/v1
kind: KubernetesGrafana
metadata:
  name: team-grafana
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: staging.KubernetesGrafana.team-grafana
spec:
  namespace:
    valueFrom:
      kind: KubernetesNamespace
      metadata:
        name: observability-ns
      fieldPath: spec.name
  container:
    resources:
      limits:
        cpu: "1000m"
        memory: "2Gi"
      requests:
        cpu: "100m"
        memory: "256Mi"

Full-Featured with Ingress

External and internal access through nginx ingress controllers:

apiVersion: kubernetes.openmcf.org/v1
kind: KubernetesGrafana
metadata:
  name: prod-grafana
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: prod.KubernetesGrafana.prod-grafana
spec:
  namespace:
    value: production
  createNamespace: true
  container:
    resources:
      limits:
        cpu: "4000m"
        memory: "8Gi"
      requests:
        cpu: "500m"
        memory: "1Gi"
  ingress:
    enabled: true
    hostname: grafana.example.com

This creates two ingress resources: one external at grafana.example.com (nginx ingress class) and one internal at internal-grafana.example.com (nginx-internal ingress class).

Stack Outputs

After deployment, the following outputs are available in status.outputs:

OutputTypeDescription
namespacestringKubernetes namespace where Grafana was created
servicestringName of the Kubernetes service for Grafana (e.g., my-grafana-grafana)
portForwardCommandstringReady-to-run kubectl port-forward command for local access on port 8080
kubeEndpointstringCluster-internal endpoint (e.g., my-grafana-grafana.grafana-dev.svc.cluster.local)
externalHostnamestringExternal URL when ingress is enabled (e.g., https://grafana.example.com)
internalHostnamestringInternal URL for private ingress (e.g., https://internal-grafana.example.com)

Related Components

  • KubernetesNamespace — pre-create a namespace to reference via valueFrom
  • KubernetesIngressNginx — deploy the nginx ingress controller required for Grafana ingress
  • KubernetesPostgres — deploy PostgreSQL as a Grafana database backend
  • KubernetesRedis — deploy Redis for Grafana caching

Next article

Kubernetes gRPC Route

Kubernetes gRPC Route Provision a Kubernetes Gateway API GRPCRoute -- namespaced gRPC routing rules that attach to a Gateway and forward matching requests to backend Services. Match by hostname, gRPC service/method, or header; transform with filters; and split traffic across weighted backends. What Gets Created A namespaced gateway.networking.k8s.io/v1 GRPCRoute custom resource. One or more rules, each with matches, optional filters, and backend refs. Optional per-rule and per-backend filters...
Read next article
Presets
1 ready-to-deploy configurationView presets →