Deploying Grafana to Kubernetes

Now let's also deploy Grafana to our Kubernetes cluster, so that we can manage this tool the same way as all the other components of our distributed application. As the tool that allows us to create dashboards for monitoring the application, Grafana can be considered mission-critical and thus warrants this treatment.

Deploying Grafana to the cluster is pretty straightforward. Let's do it as follows:

  1. Add a new file called grafana.yaml to the ch17/kube folder.
  2. To this file, add the definition for a Kubernetes Deployment for Grafana:
apiVersion: apps/v1kind: Deploymentmetadata:  name: grafana-deployment  labels:    app: grafana    purpose: monitoring-demospec:  replicas: 1  selector:    matchLabels:      app: grafana purpose: ...

Get Learn Docker - Fundamentals of Docker 19.x - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.