Last active
May 2, 2023 19:16
-
-
Save bfolkens/ab31e8b1de918f450f49f9f961083fe4 to your computer and use it in GitHub Desktop.
Kubernetes deployment for the statsd-exporter tool
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: statsd-exporter | |
namespace: <namespace> | |
spec: | |
strategy: | |
rollingUpdate: | |
maxSurge: 25% | |
maxUnavailable: 25% | |
type: RollingUpdate | |
replicas: 3 | |
selector: | |
matchLabels: | |
app: statsd-exporter | |
template: | |
metadata: | |
annotations: | |
prometheus.io/port: "9102" | |
prometheus.io/scrape: "true" | |
labels: | |
app: statsd-exporter | |
spec: | |
containers: | |
- args: | |
- --statsd.mapping-config=/etc/statsd.yml | |
- --statsd.listen-udp=:9125 | |
- --statsd.listen-tcp=:9125 | |
- --web.listen-address=:9102 | |
- --log.level=info | |
volumeMounts: | |
- mountPath: /etc/statsd.yml | |
subPath: statsd.yml | |
name: statsd-yaml | |
readOnly: true | |
image: prom/statsd-exporter:v0.23.1 | |
name: statsd-exporter | |
lifecycle: | |
preStop: | |
exec: | |
command: ["sleep", "240"] | |
livenessProbe: | |
failureThreshold: 1 | |
exec: | |
command: | |
- wget | |
- --no-verbose | |
- --tries=1 | |
- --spider | |
- http://localhost:9102/metrics | |
initialDelaySeconds: 90 | |
periodSeconds: 60 | |
successThreshold: 1 | |
timeoutSeconds: 10 | |
readinessProbe: | |
failureThreshold: 1 | |
exec: | |
command: | |
- wget | |
- --no-verbose | |
- --tries=1 | |
- --spider | |
- http://localhost:9102/metrics | |
initialDelaySeconds: 5 | |
periodSeconds: 3 | |
successThreshold: 1 | |
timeoutSeconds: 10 | |
ports: | |
- containerPort: 9125 | |
protocol: UDP | |
- containerPort: 9125 | |
protocol: TCP | |
- containerPort: 9102 | |
protocol: TCP | |
resources: | |
requests: | |
cpu: 200m | |
memory: 200Mi | |
terminationGracePeriodSeconds: 300 | |
volumes: | |
- name: statsd-yaml | |
configMap: | |
name: statsd | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: statsd-exporter | |
namespace: <namespace> | |
spec: | |
ports: | |
- name: ingress-tcp | |
port: 9125 | |
protocol: TCP | |
targetPort: 9125 | |
- name: ingress-udp | |
port: 9125 | |
protocol: UDP | |
targetPort: 9125 | |
selector: | |
app: statsd-exporter | |
type: ClusterIP | |
--- | |
kind: ConfigMap | |
metadata: | |
name: statsd | |
namespace: <namespace> | |
apiVersion: v1 | |
data: | |
statsd.yml: | | |
defaults: | |
# By default all histogram use following buckets | |
timer_type: histogram | |
ttl: 20m | |
buckets: [5, 30, 50, 80, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000] | |
mappings: | |
# Example of a particular metric using probably different bucket(not in this case, having just for sample) | |
- match: sample_metrics.* | |
timer_type: histogram | |
buckets: [5, 30, 50, 80, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 15000, 25000, 35000, 45000, 60000] | |
name: "sample_metrics" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment