Skip to content

Instantly share code, notes, and snippets.

@ironcladlou
Created February 13, 2018 21:37
Show Gist options
  • Save ironcladlou/18a0042021890077f593f1eba894d9e0 to your computer and use it in GitHub Desktop.
Save ironcladlou/18a0042021890077f593f1eba894d9e0 to your computer and use it in GitHub Desktop.
#!/bin/bash
# REQUIRES: https://github.com/coreos/prometheus-operator/pull/986
OPERATOR=$HOME/Projects/prometheus-operator/src/github.com/coreos/prometheus-operator
oc login -u system:admin
oc new-project monitoring
oc apply -f $OPERATOR/contrib/kube-prometheus/manifests/prometheus-operator
oc adm policy add-scc-to-user anyuid -z prometheus-operator
oc adm policy add-scc-to-user anyuid -z prometheus
oc adm policy add-scc-to-user anyuid -z default
oc adm policy add-cluster-role-to-user cluster-reader -z default
printf "Waiting for Operator to register custom resource definitions..."
until oc get customresourcedefinitions servicemonitors.monitoring.coreos.com > /dev/null 2>&1; do sleep 1; printf "."; done
echo "Done!"
oc apply -f $OPERATOR/contrib/kube-prometheus/manifests/prometheus/prometheus-k8s-service-account.yaml
oc apply -f $OPERATOR/contrib/kube-prometheus/manifests/prometheus/prometheus-k8s-roles.yaml
oc apply -f $OPERATOR/contrib/kube-prometheus/manifests/prometheus/prometheus-k8s-role-bindings.yaml
oc adm policy add-scc-to-user anyuid -z prometheus-k8s
oc apply -f $OPERATOR/contrib/kube-prometheus/manifests/prometheus/prometheus-k8s.yaml
oc apply -f $OPERATOR/contrib/kube-prometheus/manifests/prometheus/prometheus-k8s-service.yaml
oc expose service prometheus-k8s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment