From cfe22338a95c8470e365d40fdfd916920073543d Mon Sep 17 00:00:00 2001 From: Alessandro Sottile Date: Fri, 22 Jan 2021 20:02:35 +0100 Subject: [PATCH 1/2] add dockerfile --- Dockerfile | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4ddb8fd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM golang:rc-alpine3.13 AS builder +RUN go get github.com/sberk42/fritzbox_exporter/ + +FROM alpine:latest +ARG USERNAME PASSWORD GWURL +ENV USERNAME ${USERNAME} && \ +PASSWORD ${PASSWORD} && \ +GWURL ${GWURL} +WORKDIR /root/ +COPY --from=builder /go/bin/fritzbox_exporter . +COPY metrics.json metrics-lua.json ./ +EXPOSE 9042 +ENTRYPOINT ./fritzbox_exporter -gateway-url ${GWURL} -password ${PASSWORD} -username ${USERNAME} -listen-address 0.0.0.0:9042 From 2e7bb045342bb1e2110a5b1460e14d896aca2b67 Mon Sep 17 00:00:00 2001 From: "Sottile, Alessandro, Vodafone Italy" Date: Sun, 21 Feb 2021 09:35:03 +0100 Subject: [PATCH 2/2] add k8s deployment and service --- k8s-fritzbox.yaml | 75 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 k8s-fritzbox.yaml diff --git a/k8s-fritzbox.yaml b/k8s-fritzbox.yaml new file mode 100644 index 0000000..438aded --- /dev/null +++ b/k8s-fritzbox.yaml @@ -0,0 +1,75 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: fritzbox-exporter + name: fritzbox-exporter + namespace: metrics-app +spec: + progressDeadlineSeconds: 600 + replicas: 1 + revisionHistoryLimit: 10 + selector: + matchLabels: + app: fritzbox-exporter + strategy: + rollingUpdate: + maxSurge: 25% + maxUnavailable: 25% + type: RollingUpdate + template: + metadata: + labels: + app: fritzbox-exporter + name: fritzbox-exporter + spec: + containers: + - env: + - name: GWURL + value: 'http://ip-fritzbox:49000' + - name: USERNAME + value: 'username' + - name: PASSWORD + value: 'password' + image: alexxanddr/fritzbox-exporter:latest + imagePullPolicy: Always + name: fritzbox-exporter + resources: {} + securityContext: + privileged: false + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + dnsPolicy: ClusterFirst + hostAliases: + - hostnames: + - fritz.box + ip: 'ip-fritzbox' + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + terminationGracePeriodSeconds: 30 +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + prometheus.io/path: /metrics + prometheus.io/port: "9042" + prometheus.io/scrape: "true" + labels: + app: fritzbox-exporter + name: fritzbox-exporter + namespace: metrics-app +spec: + clusterIP: + ports: + - name: tcp + port: 9042 + protocol: TCP + targetPort: 9042 + selector: + app: fritzbox-exporter + sessionAffinity: None + type: ClusterIP +status: + loadBalancer: {}