Change:
examples/monitoring/influx-grafana- and friends NEED to be replaced by a replication controller ASAP. As it stands they are bad examples. Also, they should probably move to contrib/monitoring to match contrib/logging and contrib/dns

Discussion:
<ins> apiVersion: "v1beta1" kind: "Service" id: "monitoring-grafana" port: 8087 containerPort: 80 selector: name: "influxGrafana" </ins>

<ins> apiVersion: "v1beta1" id: "monitoring-heapsterController" kind: "ReplicationController" desiredState: replicas: 1 replicaSelector: name: "heapster" podTemplate: desiredState: manifest: version: "v1beta1" id: "monitoring-heapsterController" containers: - name: "heapster" image: "kubernetes/heapster:v0.5" labels: name: "heapster" uses: "monitoring-influxdb" labels: name: "heapster" </ins>

<del> { "id": "heapster", "kind": "Pod", "apiVersion": "v1beta1", "desiredState": { "manifest": { "version": "v1beta1", "id": "heapster", "containers": [ { "name": "heapster", "image": "kubernetes/heapster" } ] } }, "labels": { "name": "heapster" } } </del>

<del> { "id": "influx-grafana", "kind": "Pod", "apiVersion": "v1beta1", "desiredState": { "manifest": { "version": "v1beta1", "id": "influx-grafana", "containers": [ { "name": "influxdb", "image": "kubernetes/heapster_influxdb", "ports": [ { "containerPort": 8083, "hostPort": 8083 }, { "containerPort": 8086, "hostPort": 8086 }, { "containerPort": 8090, "hostPort": 8090 }, { "containerPort": 8099, "hostPort": 8099 } ] }, { "name": "grafana", "image": "kubernetes/heapster_grafana", "ports": [ { "containerPort": 80, "hostPort": 80 } ], "env": [ { "name": "HTTP_USER", "value": "{KUBE_USER}" }, { "name": "HTTP_PASS", "value": "{KUBE_PASSWORD}" } ] }, { "name": "elasticsearch", "image": "dockerfile/elasticsearch", "ports": [ { "containerPort": 9200, "hostPort": 9200 }, { "containerPort": 9300 } ] } ] } }, "labels": { "name": "influxdb" } } </del>

<del> { "id": "influx-master", "kind": "Service", "apiVersion": "v1beta1", "port": 8085, "containerPort": 8086, "provider": "kubernetes-default", "component": "influxdb", "selector": { "name": "influxdb" } } </del>

<ins> apiVersion: "v1beta1" kind: "ReplicationController" id: "monitoring-influxGrafanaController" desiredState: replicas: 1 replicaSelector: name: "influxGrafana" podTemplate: labels: name: "influxGrafana" desiredState: manifest: version: "v1beta1" id: "monitoring-influxGrafanaController" containers: - name: "influxdb" image: "kubernetes/heapster_influxdb:v0.2" ports: - containerPort: 8083 hostPort: 8083 - containerPort: 8086 hostPort: 8086 - name: "grafana" image: "kubernetes/heapster_grafana:v0.2" ports: - containerPort: 80 hostPort: 80 env: - name: "HTTP_USER" value: "admin" - name: "HTTP_PASS" value: "**None**" labels: name: "influxGrafana" </ins>

<ins> apiVersion: "v1beta1" kind: "Service" id: "monitoring-influxdb" port: 8085 containerPort: 8086 selector: name: "influxGrafana" </ins>

echo "Setting up cluster monitoring using Heapster." detect-project <del> if ! gcloud compute firewall-rules --project "{$PROJECT}" describe monitoring-heapster &>/dev/null; then </del> <ins> if ! gcloud compute firewall-rules --project "${PROJECT}" describe monitoring-heapster &> /dev/null; then </ins> if ! gcloud compute firewall-rules create monitoring-heapster  --project "${PROJECT}"  --target-tags="${MINION_TAG}"  --network="${NETWORK}"  <del> --allow tcp:80 tcp:8083 tcp:8086 tcp:9200; then echo "Failed to set up firewall for monitoring" && false </del> <ins> --allow tcp:80 tcp:8083 tcp:8086; then echo -e "${color_red}Failed to set up firewall for monitoring ${color_norm}" && false </ins> fi fi <del> # Re-use master auth for Grafana get-password ensure-temp-dir sed -e "s/{KUBE_USER}/$KUBE_USER/g"  -e "s/{KUBE_PASSWORD}/$KUBE_PASSWORD/g"  "${KUBE_ROOT}/cluster/addons/cluster-monitoring/influx-grafana-pod.json"  > "${KUBE_TEMP}/influx-grafana-pod.json" </del> local kubectl="${KUBE_ROOT}/cluster/kubectl.sh" <del> if "${kubectl}" create -f "${KUBE_TEMP}/influx-grafana-pod.json" &> /dev/null  && "${kubectl}" create -f "${KUBE_ROOT}/cluster/addons/cluster-monitoring/influx-grafana-service.json" &> /dev/null  && "${kubectl}" create -f "${KUBE_ROOT}/cluster/addons/cluster-monitoring/heapster-pod.json" &> /dev/null; then local dashboard_url="http://$(${kubectl} get -o json pod influx-grafana | grep hostIP | awk '{print $2}' | sed 's/[,|"]//g')" echo echo "Grafana dashboard will be available at $dashboard_url. Wait for the monitoring dashboard to be online." echo "Use the master user name and password for the dashboard." echo </del> <ins> local grafana_host="" if "${kubectl}" create -f "${KUBE_ROOT}/cluster/addons/cluster-monitoring/" &> /dev/null; then # wait for pods to be scheduled on a node. echo "waiting for monitoring pods to be scheduled." for i in `seq 1 10`; do grafana_host=$("${kubectl}" get pods -l name=influxGrafana -o template -t {{range.items}}{{.currentState.hostIP}}:{{end}}) if [[ $grafana_host != *"<"* ]]; then break fi sleep 10 done if [[ $grafana_host != *"<"* ]]; then echo echo -e "${color_green}Grafana dashboard will be available at ${color_yellow}http://$grafana_host${color_green}. Wait for the monitoring dashboard to be online.${color_norm}" echo else echo -e "${color_red}monitoring pods failed to be scheduled.${color_norm}" fi </ins> else <del> echo "Failed to Setup Monitoring" </del> <ins> echo -e "${color_red}Failed to Setup Monitoring ${color_norm}" </ins> teardown-monitoring fi fi

detect-project local kubectl="${KUBE_ROOT}/cluster/kubectl.sh" <del> "${kubectl}" delete pods heapster &> /dev/null || true "${kubectl}" delete pods influx-grafana &> /dev/null || true "${kubectl}" delete services influx-master &> /dev/null || true </del> <ins> local kubecfg="${KUBE_ROOT}/cluster/kubecfg.sh" "${kubecfg}" resize monitoring-influxGrafanaController 0 &> /dev/null || true "${kubecfg}" resize monitoring-heapsterController 0 &> /dev/null || true "${kubectl}" delete -f "${KUBE_ROOT}/cluster/addons/cluster-monitoring/" &> /dev/null || true </ins> if gcloud compute firewall-rules describe --project "${PROJECT}" monitoring-heapster &> /dev/null; then gcloud compute firewall-rules delete  --project "${PROJECT}"