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 daemonset = k.apps.v1beta2.daemonSet;
local container = daemonset.mixin.spec.template.spec.containersType; local container = daemonset.mixin.spec.template.spec.containersType;
local containerPort = container.portsType; local containerPort = container.portsType;
local containerEnv = container.envType;
local podLabels = { 'k8s-app': 'arm-exporter' }; local podLabels = { 'k8s-app': 'arm-exporter' };
local armExporter = local armExporter =
container.new('arm-exporter', $._config.imageRepos.armExporter + ':' + $._config.versions.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.withRequests({ cpu: '50m', memory: '50Mi' }) +
container.mixin.resources.withLimits({ cpu: '100m', memory: '100Mi' }); container.mixin.resources.withLimits({ cpu: '100m', memory: '100Mi' });
local ip = containerEnv.fromFieldPath('IP', 'status.podIP');
local proxy = local proxy =
container.new('kube-rbac-proxy', $._config.imageRepos.kubeRbacProxy + ':' + $._config.versions.kubeRbacProxy) + container.new('kube-rbac-proxy', $._config.imageRepos.kubeRbacProxy + ':' + $._config.versions.kubeRbacProxy) +
container.withArgs([ container.withArgs([
'--secure-listen-address=:9243', '--secure-listen-address=$(IP):9243',
'--upstream=http://127.0.0.1:9243/', '--upstream=http://127.0.0.1:9243/',
]) + ]) +
container.withPorts(containerPort.new(9243) + containerPort.withHostPort(9243) + containerPort.withName('https')) + container.withPorts(containerPort.new(9243) + containerPort.withHostPort(9243) + containerPort.withName('https')) +
container.mixin.resources.withRequests({ cpu: '10m', memory: '20Mi' }) + 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]; local c = [armExporter, proxy];
daemonset.new() + daemonset.new() +

View File

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

View File

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