install pushgw
This commit is contained in:
parent
5fd2cdc6df
commit
8d6fc06973
|
@ -9,6 +9,16 @@
|
|||
}
|
||||
},
|
||||
"version": "master"
|
||||
},
|
||||
{
|
||||
"name": "prometheus-pushgateway",
|
||||
"source": {
|
||||
"git": {
|
||||
"remote": "https://github.com/latchmihay/kube-prometheus-pushgateway",
|
||||
"subdir": "prometheus-pushgateway"
|
||||
}
|
||||
},
|
||||
"version": "master"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -132,6 +132,17 @@
|
|||
"version": "89f35ef22db0dc24c523bf8be473bcbcf9ac81f6",
|
||||
"sum": "KCO153lAOWmWfoj3rQGhLB+8UmyvQ2Bghu/ewDqVum4="
|
||||
},
|
||||
{
|
||||
"name": "prometheus-pushgateway",
|
||||
"source": {
|
||||
"git": {
|
||||
"remote": "https://github.com/latchmihay/kube-prometheus-pushgateway",
|
||||
"subdir": "prometheus-pushgateway"
|
||||
}
|
||||
},
|
||||
"version": "77534af823ee6e7e889f83c04930f28666c7ab14",
|
||||
"sum": "Xahez0mgGdUIUt823gC3CEELInzGBsamCvml/+AJcmg="
|
||||
},
|
||||
{
|
||||
"name": "promgrafonnet",
|
||||
"source": {
|
||||
|
|
42
monitoring/manifests/prometheus-pushgateway-deployment.yaml
Normal file
42
monitoring/manifests/prometheus-pushgateway-deployment.yaml
Normal file
|
@ -0,0 +1,42 @@
|
|||
apiVersion: apps/v1beta2
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app: prometheus-pushgateway
|
||||
name: prometheus-pushgateway
|
||||
namespace: monitoring
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: prometheus-pushgateway
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: prometheus-pushgateway
|
||||
spec:
|
||||
containers:
|
||||
- image: prom/pushgateway:v1.1.0
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /#/status
|
||||
port: 9091
|
||||
initialDelaySeconds: 10
|
||||
timeoutSeconds: 10
|
||||
name: pushgateway
|
||||
ports:
|
||||
- containerPort: 9091
|
||||
name: metrics
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /#/status
|
||||
port: 9091
|
||||
initialDelaySeconds: 10
|
||||
timeoutSeconds: 10
|
||||
resources:
|
||||
limits:
|
||||
cpu: 50m
|
||||
memory: 100Mi
|
||||
requests:
|
||||
cpu: 50m
|
||||
memory: 100Mi
|
15
monitoring/manifests/prometheus-pushgateway-service.yaml
Normal file
15
monitoring/manifests/prometheus-pushgateway-service.yaml
Normal file
|
@ -0,0 +1,15 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: prometheus-pushgateway
|
||||
name: prometheus-pushgateway
|
||||
namespace: monitoring
|
||||
spec:
|
||||
ports:
|
||||
- name: http
|
||||
port: 9091
|
||||
targetPort: http
|
||||
selector:
|
||||
app: prometheus-pushgateway
|
||||
type: ClusterIP
|
|
@ -0,0 +1,15 @@
|
|||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
labels:
|
||||
prometheus: k8s
|
||||
name: prometheus-pushgateway
|
||||
namespace: monitoring
|
||||
spec:
|
||||
endpoints:
|
||||
- honorLabels: true
|
||||
port: http
|
||||
jobLabel: k8s-app
|
||||
selector:
|
||||
matchLabels:
|
||||
app: prometheus-pushgateway
|
|
@ -1,5 +1,6 @@
|
|||
local kp =
|
||||
(import 'kube-prometheus/kube-prometheus.libsonnet') +
|
||||
(import 'prometheus-pushgateway/pushgateway.libsonnet') +
|
||||
// Uncomment the following imports to enable its patches
|
||||
// (import 'kube-prometheus/kube-prometheus-anti-affinity.libsonnet') +
|
||||
// (import 'kube-prometheus/kube-prometheus-managed-cluster.libsonnet') +
|
||||
|
@ -9,6 +10,9 @@ local kp =
|
|||
{
|
||||
_config+:: {
|
||||
namespace: 'monitoring',
|
||||
versions+:: {
|
||||
pushgateway: 'v1.1.0',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -24,5 +28,5 @@ local kp =
|
|||
{ ['alertmanager-' + name]: kp.alertmanager[name] for name in std.objectFields(kp.alertmanager) } +
|
||||
{ ['prometheus-' + name]: kp.prometheus[name] for name in std.objectFields(kp.prometheus) } +
|
||||
{ ['prometheus-adapter-' + name]: kp.prometheusAdapter[name] for name in std.objectFields(kp.prometheusAdapter) } +
|
||||
{ ['grafana-' + name]: kp.grafana[name] for name in std.objectFields(kp.grafana) }
|
||||
|
||||
{ ['grafana-' + name]: kp.grafana[name] for name in std.objectFields(kp.grafana) } +
|
||||
{ ['prometheus-pushgateway-' + name]: kp.pushgateway[name] for name in std.objectFields(kp.pushgateway) }
|
||||
|
|
14
monitoring/vendor/prometheus-pushgateway/jsonnetfile.json
vendored
Normal file
14
monitoring/vendor/prometheus-pushgateway/jsonnetfile.json
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "ksonnet",
|
||||
"source": {
|
||||
"git": {
|
||||
"remote": "https://github.com/ksonnet/ksonnet-lib",
|
||||
"subdir": ""
|
||||
}
|
||||
},
|
||||
"version": "master"
|
||||
}
|
||||
]
|
||||
}
|
86
monitoring/vendor/prometheus-pushgateway/pushgateway.libsonnet
vendored
Normal file
86
monitoring/vendor/prometheus-pushgateway/pushgateway.libsonnet
vendored
Normal file
|
@ -0,0 +1,86 @@
|
|||
local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
|
||||
|
||||
{
|
||||
_config+:: {
|
||||
namespace: 'pushgateway',
|
||||
|
||||
versions+:: {
|
||||
pushgateway: 'v0.8.0',
|
||||
},
|
||||
|
||||
imageRepos+:: {
|
||||
pushgateway: 'prom/pushgateway',
|
||||
},
|
||||
|
||||
pushgateway+:: {
|
||||
name: "prometheus-pushgateway",
|
||||
port: 9091,
|
||||
labels: { app: $._config.pushgateway.name},
|
||||
cpu: "50m",
|
||||
memory: "100Mi"
|
||||
}
|
||||
},
|
||||
|
||||
pushgateway+:: {
|
||||
deployment:
|
||||
local deployment = k.apps.v1beta2.deployment;
|
||||
local container = deployment.mixin.spec.template.spec.containersType;
|
||||
local containerPort = container.portsType;
|
||||
local podSelector = deployment.mixin.spec.template.spec.selectorType;
|
||||
|
||||
local c =
|
||||
container.new('pushgateway', $._config.imageRepos.pushgateway + ':' + $._config.versions.pushgateway) +
|
||||
container.withPorts(containerPort.newNamed($._config.pushgateway.port, 'metrics')) +
|
||||
container.mixin.resources.withRequests({ cpu: $._config.pushgateway.cpu, memory: $._config.pushgateway.memory }) +
|
||||
container.mixin.resources.withLimits({ cpu: $._config.pushgateway.cpu, memory: $._config.pushgateway.memory }) +
|
||||
container.mixin.livenessProbe.withInitialDelaySeconds(10) +
|
||||
container.mixin.livenessProbe.withTimeoutSeconds(10)+
|
||||
container.mixin.livenessProbe.httpGet.withPath("/#/status") +
|
||||
container.mixin.livenessProbe.httpGet.withPort($._config.pushgateway.port) +
|
||||
container.mixin.readinessProbe.withInitialDelaySeconds(10) +
|
||||
container.mixin.readinessProbe.withTimeoutSeconds(10)+
|
||||
container.mixin.readinessProbe.httpGet.withPath("/#/status") +
|
||||
container.mixin.readinessProbe.httpGet.withPort($._config.pushgateway.port);
|
||||
|
||||
deployment.new($._config.pushgateway.name, 1, c, $._config.pushgateway.labels) +
|
||||
deployment.mixin.metadata.withNamespace($._config.namespace) +
|
||||
deployment.mixin.metadata.withLabels($._config.pushgateway.labels) +
|
||||
deployment.mixin.spec.selector.withMatchLabels($._config.pushgateway.labels),
|
||||
|
||||
service:
|
||||
local service = k.core.v1.service;
|
||||
local servicePort = k.core.v1.service.mixin.spec.portsType;
|
||||
|
||||
local pushgatewayPort = servicePort.newNamed('http', $._config.pushgateway.port, 'http');
|
||||
|
||||
service.new($._config.pushgateway.name, $.pushgateway.deployment.spec.selector.matchLabels, pushgatewayPort) +
|
||||
service.mixin.metadata.withNamespace($._config.namespace) +
|
||||
service.mixin.metadata.withLabels($._config.pushgateway.labels) +
|
||||
service.mixin.spec.withType('ClusterIP'),
|
||||
|
||||
serviceMonitor:
|
||||
{
|
||||
apiVersion: 'monitoring.coreos.com/v1',
|
||||
kind: 'ServiceMonitor',
|
||||
metadata: {
|
||||
name: $._config.pushgateway.name,
|
||||
namespace: $._config.namespace,
|
||||
labels: {
|
||||
'prometheus': 'k8s',
|
||||
},
|
||||
},
|
||||
spec: {
|
||||
jobLabel: 'k8s-app',
|
||||
selector: {
|
||||
matchLabels: $._config.pushgateway.labels,
|
||||
},
|
||||
endpoints: [
|
||||
{
|
||||
port: 'http',
|
||||
honorLabels: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
Reference in a new issue