Installing Prometheus

Let's run through an install of Prometheus using the new pattern that we've discovered. First, let's use the Prometheus definition file to create the deployment. We'll use Helm here to install the Operator!

Make sure you have Helm installed, and then make sure you've initialized it:

$ helm init
master $ helm init
Creating /root/.helm
...
Adding stable repo with URL: https://kubernetes-charts.storage.googleapis.com
Adding local repo with URL: http://127.0.0.1:8879/charts
$HELM_HOME has been configured at /root/.helm.
...
Happy Helming!
$

Next, we can install the various Operator packages required for this demo:

$ helm repo add coreos https://s3-eu-west-1.amazonaws.com/coreos-charts/stable/
"coreos" has been added to your repositories

Now, install the Operator:

$ helm install coreos/prometheus-operator --name prometheus-operator

You can see that it's installed and running by first checking the installation:

$ helm ls prometheus-operator
NAME REVISION UPDATED STATUS CHART NAMESPACE
prometheus-operator 1 Mon Jul 23 02:10:18 2018 DEPLOYED prometheus-operator-0.0.28 default

Then, look at the pods:

$ kubectl get pods
NAME READY STATUS RESTARTS AGE
prometheus-operator-d75587d6-bmmvx 1/1 Running 0 2m

Now, we can install kube-prometheus to get all of our dependencies up and running:

$ helm install coreos/kube-prometheus --name kube-prometheus --set global.rbacEnable=true
NAME: kube-prometheus
LAST DEPLOYED: Mon Jul 23 02:15:59 2018
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:

==> v1/Alertmanager
NAME AGE
kube-prometheus 1s

==> v1/Pod(related)
NAME READY STATUS RESTARTS AGE
kube-prometheus-exporter-node-45rwl 0/1 ContainerCreating 0 1s
kube-prometheus-exporter-node-d84mp 0/1 ContainerCreating 0 1s
kube-prometheus-exporter-kube-state-844bb6f589-z58b6 0/2 ContainerCreating 0 1s
kube-prometheus-grafana-57d5b4d79f-mgqw5 0/2 ContainerCreating 0 1s

==> v1beta1/ClusterRoleBinding
NAME AGE
psp-kube-prometheus-alertmanager 1s
kube-prometheus-exporter-kube-state 1s
psp-kube-prometheus-exporter-kube-state 1s
psp-kube-prometheus-exporter-node 1s
psp-kube-prometheus-grafana 1s
kube-prometheus 1s
psp-kube-prometheus 1s

We've truncated the output here as there's a lot of information. Let's look at the pods again:

$ kubectl get pods
NAME READY STATUS RESTARTS AGE
alertmanager-kube-prometheus-0 2/2 Running 0 3m
kube-prometheus-exporter-kube-state-85975c8577-vfl6t 2/2
Running 0 2m
kube-prometheus-exporter-node-45rwl 1/1 Running 0 3m
kube-prometheus-exporter-node-d84mp 1/1 Running 0 3m
kube-prometheus-grafana-57d5b4d79f-mgqw5 2/2 Running 0 3m
prometheus-kube-prometheus-0 3/3 Running 1 3m
prometheus-operator-d75587d6-bmmvx 1/1 Running 0 8m

Nicely done!

If you forward the port for prometheus-kube-prometheus-0 to 8448, you should be able to see the Prometheus dashboard, which we'll revisit in later chapters as we explore high availability and the productionalization of your Kubernetes cluster. You can check this out at http://localhost:8449/alerts.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.5.154