From dca94666ec7352b0b1119b927b22f757f75ab53e Mon Sep 17 00:00:00 2001 From: Otto Yiu Date: Wed, 27 Jun 2018 14:56:45 -0700 Subject: [PATCH] add Dockerfile and kubernetes example --- Dockerfile | 11 ++++++++ examples/kubernetes/daemonset.yaml | 40 ++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 Dockerfile create mode 100644 examples/kubernetes/daemonset.yaml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..db9f6bb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +from golang:1.10 as builder +arg CMD +run wget -o/dev/null -O/usr/local/bin/dep https://github.com/golang/dep/releases/download/v0.3.2/dep-linux-amd64 && \ + chmod +x /usr/local/bin/dep +workdir ${GOPATH}/src/github.com/czerwonk/bird_exporter +copy . . +run make deps build && cp bird_exporter /bird_exporter + +from golang:1.10 +copy --from=builder /bird_exporter /bird_exporter +entrypoint ["/bird_exporter"] diff --git a/examples/kubernetes/daemonset.yaml b/examples/kubernetes/daemonset.yaml new file mode 100644 index 0000000..c517b7b --- /dev/null +++ b/examples/kubernetes/daemonset.yaml @@ -0,0 +1,40 @@ +apiVersion: extensions/v1beta1 +kind: DaemonSet +metadata: + name: bird-exporter + namespace: kube-system + labels: + app: bird-exporter +spec: + updateStrategy: + type: RollingUpdate + template: + metadata: + labels: + app: bird-exporter + spec: + tolerations: + - key: node-role.kubernetes.io/master + effect: NoSchedule + containers: + - name: bird-exporter + image: bird_exporter:latest + args: ["-format.new=true", "-bird.socket=/var/run/bird/bird.ctl"] + resources: + limits: + cpu: 100m + memory: 32Mi + requests: + cpu: 100m + memory: 32Mi + volumeMounts: + - mountPath: /var/run/bird/ + name: bird-socket + readOnly: true + ports: + - containerPort: 9324 + name: metrics + volumes: + - name: bird-socket + hostPath: + path: /var/run/bird/