Improve the monitoring setup script and fix bugs in the monitoring config.

This commit is contained in:
Vishnu Kannan 2014-11-07 01:23:14 +00:00
parent ad9cb982e5
commit 37af9210ba
7 changed files with 46 additions and 17 deletions

View File

@ -430,9 +430,6 @@ function kube-down {
# Detect the project into $PROJECT # Detect the project into $PROJECT
detect-project detect-project
# Monitoring might have been setup. It doesn't hurt to attempt shutdown even it wasn't setup.
teardown-monitoring
echo "Bringing down cluster" echo "Bringing down cluster"
gcutil deletefirewall \ gcutil deletefirewall \
--project "${PROJECT}" \ --project "${PROJECT}" \
@ -577,21 +574,41 @@ function restart-kube-proxy {
function setup-monitoring { function setup-monitoring {
if [ $MONITORING ]; then if [ $MONITORING ]; then
teardown-monitoring teardown-monitoring
kubectl.sh create -f "${KUBE_ROOT}/examples/monitoring/influx-grafana-pod.json" && if ! gcutil getfirewall monitoring-heapster &> /dev/null; then
kubectl.sh create -f "${KUBE_ROOT}/examples/monitoring/influx-grafana-service.json" && gcutil addfirewall monitoring-heapster \
kubectl.sh create -f "${KUBE_ROOT}/examples/monitoring/heapster-pod.json" --project "${PROJECT}" \
--norespect_terminal_width \
--sleep_between_polls "${POLL_SLEEP_INTERVAL}" \
--target_tags="${MINION_TAG}" \
--allowed "tcp:80,tcp:8083,tcp:8086,tcp:9200";
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Failed to Setup Firewall for Monitoring" && false
fi
fi
kubectl.sh create -f "${KUBE_ROOT}/examples/monitoring/influx-grafana-pod.json" > /dev/null &&
kubectl.sh create -f "${KUBE_ROOT}/examples/monitoring/influx-grafana-service.json" > /dev/null &&
kubectl.sh create -f "${KUBE_ROOT}/examples/monitoring/heapster-pod.json" > /dev/null
if [ $? -ne 0 ]; then
echo "Failed to Setup Monitoring"
teardown-monitoring teardown-monitoring
else else
dashboardIP="http://`kubectl.sh get -o json pod influx-grafana | grep hostIP | awk '{print $2}' | sed 's/[,|\"]//g'`" dashboardIP="http://admin:admin@`kubectl.sh get -o json pod influx-grafana | grep hostIP | awk '{print $2}' | sed 's/[,|\"]//g'`"
echo "Grafana dashboard is available at $dashboardIP" echo "Grafana dashboard will be available at $dashboardIP. Wait for the monitoring dashboard to be online."
echo "username is 'admin' and password is 'admin'"
fi fi
fi fi
} }
function teardown-monitoring { function teardown-monitoring {
kubectl.sh delete pods heapster || true if [ $MONITORING ]; then
kubectl.sh delete pods influx-grafana || true kubectl.sh delete pods heapster &> /dev/null || true
kubectl.sh delete services influx-master || true kubectl.sh delete pods influx-grafana &> /dev/null || true
kubectl.sh delete services influx-master &> /dev/null || true
gcutil deletefirewall \
--project "${PROJECT}" \
--norespect_terminal_width \
--sleep_between_polls "${POLL_SLEEP_INTERVAL}" \
--force \
monitoring-heapster || true > /dev/null
fi
} }

View File

@ -322,3 +322,7 @@ kube-up() {
echo " subject to \"Man in the middle\" type attacks." echo " subject to \"Man in the middle\" type attacks."
echo echo
} }
function setup-monitoring {
echo "TODO"
}

View File

@ -172,3 +172,7 @@ function ssh-to-node {
function restart-kube-proxy { function restart-kube-proxy {
ssh-to-node "$1" "sudo systemctl restart kube-proxy" ssh-to-node "$1" "sudo systemctl restart kube-proxy"
} }
function setup-monitoring {
echo "TODO"
}

View File

@ -471,3 +471,7 @@ function test-setup {
function test-teardown { function test-teardown {
echo "TODO" echo "TODO"
} }
function setup-monitoring {
echo "TODO"
}

View File

@ -5,6 +5,6 @@
"port": 8085, "port": 8085,
"containerPort": 8086, "containerPort": 8086,
"provider": "kubernetes-default", "provider": "kubernetes-default",
"component": "influxdb" "component": "influxdb",
"selector": { "name": "influxdb" } "selector": { "name": "influxdb" }
} }