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