Deploying Prometheus to Kubernetes

As indicated, we start by deploying Prometheus to Kubernetes. Let's first define the Kubernetes YAML file that we can use to do so. First, we need to define a Kubernetes Deployment that will create a ReplicaSet of Prometheus server instances, and then we will define a Kubernetes service to expose Prometheus to us, so that we can access it from within a browser tab or that Grafana can access it. Let's do it:

  1. Create a ch17/kube folder, and navigate to it:
$ mkdir -p ~/fod/ch17/kube && cd ~/fod/ch17/kube
  1. Add a file called prometheus.yaml to this folder.
  2. Add the following code snippet to this file; it defines Deployment for Prometheus:
apiVersion: apps/v1kind: Deploymentmetadata: name: prometheus-deployment ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.