mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-05 03:03:40 +00:00
Move heapster data files to cluster/addons.
Also pretty up the JSON (make it real JSON) and streamline the sed in cluster/gce/init.sh.
This commit is contained in:
3
cluster/addons/cluster-monitoring/README.md
Normal file
3
cluster/addons/cluster-monitoring/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Heapster
|
||||
|
||||
Heapster enables monitoring of Kubernetes Clusters using [cAdvisor](https://github.com/google/cadvisor). The kubelet will communicate with an instance of cAdvisor running on localhost and proxy container stats to Heapster. Kubelet will attempt to connect to cAdvisor on port 4194 by default but this port can be configured with kubelet's `-cadvisor_port` run flag. Detailed information about heapster can be found [here](https://github.com/GoogleCloudPlatform/heapster).
|
20
cluster/addons/cluster-monitoring/heapster-pod.json
Normal file
20
cluster/addons/cluster-monitoring/heapster-pod.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"id": "heapster",
|
||||
"kind": "Pod",
|
||||
"apiVersion": "v1beta1",
|
||||
"desiredState": {
|
||||
"manifest": {
|
||||
"version": "v1beta1",
|
||||
"id": "heapster",
|
||||
"containers": [
|
||||
{
|
||||
"name": "heapster",
|
||||
"image": "kubernetes/heapster"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"labels": {
|
||||
"name": "heapster"
|
||||
}
|
||||
}
|
71
cluster/addons/cluster-monitoring/influx-grafana-pod.json
Normal file
71
cluster/addons/cluster-monitoring/influx-grafana-pod.json
Normal file
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"id": "influx-master",
|
||||
"kind": "Service",
|
||||
"apiVersion": "v1beta1",
|
||||
"port": 8085,
|
||||
"containerPort": 8086,
|
||||
"provider": "kubernetes-default",
|
||||
"component": "influxdb",
|
||||
"selector": {
|
||||
"name": "influxdb"
|
||||
}
|
||||
}
|
@@ -746,15 +746,14 @@ function setup-monitoring {
|
||||
get-password
|
||||
ensure-temp-dir
|
||||
|
||||
cp "${KUBE_ROOT}/examples/monitoring/influx-grafana-pod.json" "${KUBE_TEMP}/influx-grafana-pod.0.json"
|
||||
sed "s/HTTP_USER, \"value\": \"[^\"]*\"/HTTP_USER, \"value\": \"$KUBE_USER\"/g" \
|
||||
"${KUBE_TEMP}/influx-grafana-pod.0.json" > "${KUBE_TEMP}/influx-grafana-pod.1.json"
|
||||
sed "s/HTTP_PASS, \"value\": \"[^\"]*\"/HTTP_PASS, \"value\": \"$KUBE_PASSWORD\"/g" \
|
||||
"${KUBE_TEMP}/influx-grafana-pod.1.json" > "${KUBE_TEMP}/influx-grafana-pod.2.json"
|
||||
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"
|
||||
local kubectl="${KUBE_ROOT}/cluster/kubectl.sh"
|
||||
if "${kubectl}" create -f "${KUBE_TEMP}/influx-grafana-pod.2.json" &> /dev/null \
|
||||
&& "${kubectl}" create -f "${KUBE_ROOT}/examples/monitoring/influx-grafana-service.json" &> /dev/null \
|
||||
&& "${kubectl}" create -f "${KUBE_ROOT}/examples/monitoring/heapster-pod.json" &> /dev/null; then
|
||||
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."
|
||||
|
Reference in New Issue
Block a user