Fix arm-exporter port/ip allocation. Update dashboard

This commit is contained in:
CarlosEDP 2019-02-27 13:18:13 -03:00
parent c2d9b9b91a
commit 9116c87d69
3 changed files with 34 additions and 18 deletions

View File

@ -10,22 +10,30 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
local daemonset = k.apps.v1beta2.daemonSet;
local container = daemonset.mixin.spec.template.spec.containersType;
local containerPort = container.portsType;
local containerEnv = container.envType;
local podLabels = { 'k8s-app': 'arm-exporter' };
local armExporter =
container.new('arm-exporter', $._config.imageRepos.armExporter + ':' + $._config.versions.armExporter) +
container.withCommand([
'/bin/rpi_exporter',
'--web.listen-address=127.0.0.1:9243',
]) +
container.mixin.resources.withRequests({ cpu: '50m', memory: '50Mi' }) +
container.mixin.resources.withLimits({ cpu: '100m', memory: '100Mi' });
local ip = containerEnv.fromFieldPath('IP', 'status.podIP');
local proxy =
container.new('kube-rbac-proxy', $._config.imageRepos.kubeRbacProxy + ':' + $._config.versions.kubeRbacProxy) +
container.withArgs([
'--secure-listen-address=:9243',
'--secure-listen-address=$(IP):9243',
'--upstream=http://127.0.0.1:9243/',
]) +
container.withPorts(containerPort.new(9243) + containerPort.withHostPort(9243) + containerPort.withName('https')) +
container.mixin.resources.withRequests({ cpu: '10m', memory: '20Mi' }) +
container.mixin.resources.withLimits({ cpu: '20m', memory: '40Mi' });
container.mixin.resources.withLimits({ cpu: '20m', memory: '40Mi' }) +
container.withEnv([ip]);
local c = [armExporter, proxy];
daemonset.new() +

View File

@ -15,7 +15,10 @@ spec:
k8s-app: arm-exporter
spec:
containers:
- image: carlosedp/arm_exporter:latest
- command:
- /bin/rpi_exporter
- --web.listen-address=127.0.0.1:9243
image: carlosedp/arm_exporter:latest
name: arm-exporter
resources:
limits:
@ -25,8 +28,13 @@ spec:
cpu: 50m
memory: 50Mi
- args:
- --secure-listen-address=:9243
- --secure-listen-address=$(IP):9243
- --upstream=http://127.0.0.1:9243/
env:
- name: IP
valueFrom:
fieldRef:
fieldPath: status.podIP
image: carlosedp/kube-rbac-proxy:v0.4.1
name: kube-rbac-proxy
ports:

View File

@ -2297,8 +2297,8 @@ items:
"editable": true,
"gnetId": null,
"graphTooltip": 1,
"id": 16,
"iteration": 1551271295198,
"id": 19,
"iteration": 1551275508525,
"links": [
],
@ -3772,14 +3772,14 @@ items:
],
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"full": true,
"lineColor": "rgb(31, 120, 193)",
"show": true
},
"tableColumn": "",
"targets": [
{
"expr": "sum(node_memory_MemTotal_bytes)",
"expr": "sum(elasticsearch_jvm_memory_committed_bytes)",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "",
@ -3789,7 +3789,7 @@ items:
}
],
"thresholds": "",
"title": "Total Memory",
"title": "Total Memory Available",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
@ -3860,14 +3860,14 @@ items:
],
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"full": true,
"lineColor": "rgb(31, 120, 193)",
"show": true
},
"tableColumn": "",
"targets": [
{
"expr": "sum(node_memory_MemFree_bytes)",
"expr": "sum(elasticsearch_jvm_memory_used_bytes)",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "",
@ -3876,7 +3876,7 @@ items:
}
],
"thresholds": "",
"title": "Total Memory Free",
"title": "Memory Usage",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
@ -3947,14 +3947,14 @@ items:
],
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"full": true,
"lineColor": "rgb(31, 120, 193)",
"show": true
},
"tableColumn": "",
"targets": [
{
"expr": "sum(node_memory_MemAvailable_bytes)",
"expr": "sum(elasticsearch_jvm_memory_committed_bytes)-sum(elasticsearch_jvm_memory_used_bytes)",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "",
@ -3963,7 +3963,7 @@ items:
}
],
"thresholds": "",
"title": "Total Memory Available",
"title": "Free Memory",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
@ -4658,7 +4658,7 @@ items:
"value": "$__all"
},
"datasource": "$server",
"definition": "",
"definition": "label_values(elasticsearch_cluster_health_status,cluster)",
"hide": 0,
"includeAll": true,
"label": null,
@ -4712,8 +4712,8 @@ items:
]
},
"timezone": "utc",
"title": "ElasticSearch Cluster",
"uid": "n_nxrE_mk78",
"title": "ElasticSearch Cluster 2",
"uid": "n_nxrE_mk7",
"version": 1
}
kind: ConfigMap