From cc59711dafcd6ff3f6c9df3ece23c0fbe6dfc306 Mon Sep 17 00:00:00 2001 From: Jan Knipper Date: Fri, 3 Sep 2021 11:37:51 +0200 Subject: [PATCH] Fix image, readme --- Dockerfile | 11 ++++------- Makefile | 4 ++-- README.md | 4 +++- yaml/oomkill-exporter.yaml | 7 +++++-- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9f24b0f2..7bdf07be 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,16 @@ -FROM golang:1.11 AS builder +FROM golang:1.16-alpine3.13 AS builder WORKDIR /go/src/github.com/sapcc/kuberntes-oomkill-exporter -ENV GO111MODULE=on \ - CGOENABLED=0 ADD go.mod go.sum ./ RUN go mod download ADD cache/main.go . RUN go build -v -o /dev/null ADD . . -RUN go build -v -o /kubernetes-oomkill-exporter -RUN go test -v -RUN go vet +RUN CGOENABLED=0 go build -v -o /kubernetes-oomkill-exporter -FROM alpine:3.8 +FROM alpine:3.13 LABEL maintainer="jan.knipper@sap.com" +LABEL source_repository="https://github.com/sapcc/kubernetes-oomkill-exporter" RUN apk --no-cache add ca-certificates COPY --from=builder /kubernetes-oomkill-exporter /kubernetes-oomkill-exporter diff --git a/Makefile b/Makefile index 48195872..c462c506 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,14 @@ TARGET = kubernetes-oomkill-exporter GOTARGET = github.com/sapcc/$(TARGET) REGISTRY ?= sapcc -VERSION ?= 0.3.0 +VERSION ?= 0.3.1 IMAGE = $(REGISTRY)/$(BIN) DOCKER ?= docker all: container container: - $(DOCKER) build -t $(REGISTRY)/$(TARGET):latest -t $(REGISTRY)/$(TARGET):$(VERSION) . + $(DOCKER) build --network=host -t $(REGISTRY)/$(TARGET):latest -t $(REGISTRY)/$(TARGET):$(VERSION) . push: $(DOCKER) push $(REGISTRY)/$(TARGET):latest diff --git a/README.md b/README.md index f0e052f8..4d72e877 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,9 @@ ---- -kubernetes-oomkill-exporter is parsing kernel log for killed pods, collects information like namespace from docker and exposes them in a metric. +kubernetes-oomkill-exporter is parsing kernel log for killed pods, collects information like namespace from docker and exposes them in a metric. It can be deployed as a `DaemonSet` to run on every node in your cluster, see [here for an example](yaml/oomkill-exporter.yaml). Exported metric is called `klog_pod_oomkill` and counts the amount of oomkills of a certain pod. + + ## License This project is licensed under the Apache2 License - see the [LICENSE](LICENSE) file for details diff --git a/yaml/oomkill-exporter.yaml b/yaml/oomkill-exporter.yaml index 733d83e1..687c252d 100644 --- a/yaml/oomkill-exporter.yaml +++ b/yaml/oomkill-exporter.yaml @@ -18,8 +18,8 @@ spec: spec: containers: - name: oomkill-exporter - image: sapcc/kubernetes-oomkill-exporter:latest - imagePullPolicy: Always + image: sapcc/kubernetes-oomkill-exporter:0.3.1 + imagePullPolicy: IfNotPresent args: - -logtostderr - -v=5 @@ -44,6 +44,8 @@ spec: ports: - name: metrics containerPort: 9102 + tolerations: + - operator: Exists volumes: - name: kmsg hostPath: @@ -51,3 +53,4 @@ spec: - name: docker hostPath: path: /var/run/docker.sock +