Skip to content

Commit abbcac1

Browse files
authored
Merge pull request #4 from sapcc/containerd
Add support for containerd
2 parents 89f4aa6 + 112471a commit abbcac1

File tree

2,190 files changed

+587400
-69867
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,190 files changed

+587400
-69867
lines changed

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
FROM golang:1.16-alpine3.13 AS builder
1+
FROM golang:1.19-alpine3.16 AS builder
22

33
WORKDIR /go/src/github.com/sapcc/kuberntes-oomkill-exporter
44
ADD go.mod go.sum ./
55
RUN go mod download
66
ADD cache/main.go .
7-
RUN go build -v -o /dev/null
7+
RUN CGO_ENABLED=0 go build -v -o /dev/null
88
ADD . .
9-
RUN CGOENABLED=0 go build -v -o /kubernetes-oomkill-exporter
9+
RUN CGO_ENABLED=0 go build -v -o /kubernetes-oomkill-exporter
1010

11-
FROM alpine:3.13
11+
FROM alpine:3.16
1212
LABEL maintainer="jan.knipper@sap.com"
1313
LABEL source_repository="https://github.com/sapcc/kubernetes-oomkill-exporter"
1414

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
TARGET = kubernetes-oomkill-exporter
22
GOTARGET = github.com/sapcc/$(TARGET)
33
REGISTRY ?= sapcc
4-
VERSION ?= 0.4.0
4+
VERSION ?= 0.5.0
55
IMAGE = $(REGISTRY)/$(BIN)
66
DOCKER ?= docker
77

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,14 @@
55

66
----
77

8-
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.
8+
`kubernetes-oomkill-exporter` is parsing kernel log for killed pods, collects information like namespace from ~~docker~~ containerd and exposes them in a Prometheus 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.
99

10+
A Prometheus query for alerting could look something like this:
11+
```
12+
sum by(namespace, pod_name) (changes(klog_pod_oomkill[30m])) > 2
13+
```
14+
15+
Note: Recent versions of `kubernetes-oomkill-exporter` (`>=0.5.0`) are only working with nodes running containerd as container runtime. If you are using docker please use a version prior than that.
1016

1117

1218
## License

cache/main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ package main
66

77
import (
88
_ "flag"
9+
_ "fmt"
910
_ "net/http"
1011
_ "regexp"
1112
_ "strings"
1213

13-
_ "docker.io/go-docker"
14-
_ "docker.io/go-docker/api/types"
14+
_ "github.com/containerd/containerd"
15+
_ "github.com/containerd/containerd/namespaces"
1516
_ "github.com/golang/glog"
1617
_ "github.com/prometheus/client_golang/prometheus"
1718
_ "github.com/prometheus/client_golang/prometheus/promhttp"

go.mod

Lines changed: 60 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,69 @@
11
module github.com/sapcc/kubernetes-oomkill-exporter
22

3+
go 1.19
4+
35
require (
4-
code.cloudfoundry.org/clock v0.0.0-20180518195852-02e53af36e6c // indirect
5-
docker.io/go-docker v1.0.0
6-
github.com/Microsoft/go-winio v0.4.11 // indirect
7-
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 // indirect
8-
github.com/davecgh/go-spew v1.1.1 // indirect
9-
github.com/docker/distribution v2.7.0+incompatible // indirect
10-
github.com/docker/go-connections v0.4.0 // indirect
11-
github.com/docker/go-units v0.3.3 // indirect
6+
github.com/containerd/containerd v1.6.8
127
github.com/euank/go-kmsg-parser v2.0.0+incompatible
13-
github.com/gogo/protobuf v1.1.1 // indirect
148
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
15-
github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf // indirect
16-
github.com/json-iterator/go v1.1.5 // indirect
17-
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
9+
github.com/prometheus/client_golang v1.11.1
10+
github.com/stretchr/testify v1.7.0
11+
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f
12+
k8s.io/node-problem-detector v0.6.0
13+
)
14+
15+
require (
16+
code.cloudfoundry.org/clock v0.0.0-20180518195852-02e53af36e6c // indirect
17+
github.com/Microsoft/go-winio v0.5.1 // indirect
18+
github.com/Microsoft/hcsshim v0.9.4 // indirect
19+
github.com/beorn7/perks v1.0.1 // indirect
20+
github.com/cespare/xxhash/v2 v2.1.2 // indirect
21+
github.com/containerd/cgroups v1.0.3 // indirect
22+
github.com/containerd/continuity v0.2.2 // indirect
23+
github.com/containerd/fifo v1.0.0 // indirect
24+
github.com/containerd/ttrpc v1.1.0 // indirect
25+
github.com/containerd/typeurl v1.0.2 // indirect
26+
github.com/davecgh/go-spew v1.1.1 // indirect
27+
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
28+
github.com/go-logr/logr v1.2.2 // indirect
29+
github.com/gogo/googleapis v1.4.0 // indirect
30+
github.com/gogo/protobuf v1.3.2 // indirect
31+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
32+
github.com/golang/protobuf v1.5.2 // indirect
33+
github.com/google/go-cmp v0.5.6 // indirect
34+
github.com/google/gofuzz v1.2.0 // indirect
35+
github.com/google/uuid v1.2.0 // indirect
36+
github.com/json-iterator/go v1.1.12 // indirect
37+
github.com/klauspost/compress v1.11.13 // indirect
38+
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
39+
github.com/moby/locker v1.0.1 // indirect
40+
github.com/moby/sys/mountinfo v0.5.0 // indirect
41+
github.com/moby/sys/signal v0.6.0 // indirect
1842
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
19-
github.com/modern-go/reflect2 v1.0.1 // indirect
20-
github.com/onsi/ginkgo v1.7.0 // indirect
21-
github.com/onsi/gomega v1.4.3 // indirect
22-
github.com/opencontainers/go-digest v1.0.0-rc1 // indirect
23-
github.com/opencontainers/image-spec v1.0.1 // indirect
24-
github.com/pkg/errors v0.8.0 // indirect
43+
github.com/modern-go/reflect2 v1.0.2 // indirect
44+
github.com/opencontainers/go-digest v1.0.0 // indirect
45+
github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 // indirect
46+
github.com/opencontainers/runc v1.1.2 // indirect
47+
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 // indirect
48+
github.com/opencontainers/selinux v1.10.1 // indirect
49+
github.com/pkg/errors v0.9.1 // indirect
2550
github.com/pmezard/go-difflib v1.0.0 // indirect
26-
github.com/prometheus/client_golang v0.9.1
27-
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 // indirect
28-
github.com/prometheus/common v0.0.0-20181126121408-4724e9255275 // indirect
29-
github.com/prometheus/procfs v0.0.0-20181126161756-619930b0b471 // indirect
30-
github.com/spf13/pflag v1.0.3 // indirect
31-
github.com/stretchr/testify v1.2.2
32-
github.com/tedsuo/ifrit v0.0.0-20180802180643-bea94bb476cc // indirect
33-
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a
34-
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f // indirect
35-
golang.org/x/sys v0.0.0-20181128092732-4ed8d59d0b35 // indirect
51+
github.com/prometheus/client_model v0.2.0 // indirect
52+
github.com/prometheus/common v0.30.0 // indirect
53+
github.com/prometheus/procfs v0.7.3 // indirect
54+
github.com/sirupsen/logrus v1.8.1 // indirect
55+
go.opencensus.io v0.23.0 // indirect
56+
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
57+
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect
58+
golang.org/x/text v0.3.7 // indirect
59+
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect
60+
google.golang.org/grpc v1.43.0 // indirect
61+
google.golang.org/protobuf v1.27.1 // indirect
3662
gopkg.in/inf.v0 v0.9.1 // indirect
37-
k8s.io/api v0.0.0-20181121071145-b7bd5f2d334c // indirect
38-
k8s.io/apimachinery v0.0.0-20181126191516-4a9a8137c0a1 // indirect
39-
k8s.io/klog v0.1.0 // indirect
40-
k8s.io/node-problem-detector v0.6.0
41-
sigs.k8s.io/yaml v1.1.0 // indirect
63+
gopkg.in/yaml.v2 v2.4.0 // indirect
64+
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
65+
k8s.io/api v0.22.5 // indirect
66+
k8s.io/apimachinery v0.22.5 // indirect
67+
k8s.io/klog/v2 v2.30.0 // indirect
68+
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
4269
)

0 commit comments

Comments
 (0)