Skip to content

Commit

Permalink
Merge pull request #4 from sapcc/containerd
Browse files Browse the repository at this point in the history
Add support for containerd
  • Loading branch information
jknipper authored Sep 20, 2022
2 parents 89f4aa6 + 112471a commit abbcac1
Show file tree
Hide file tree
Showing 2,190 changed files with 587,400 additions and 69,867 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
FROM golang:1.16-alpine3.13 AS builder
FROM golang:1.19-alpine3.16 AS builder

WORKDIR /go/src/github.com/sapcc/kuberntes-oomkill-exporter
ADD go.mod go.sum ./
RUN go mod download
ADD cache/main.go .
RUN go build -v -o /dev/null
RUN CGO_ENABLED=0 go build -v -o /dev/null
ADD . .
RUN CGOENABLED=0 go build -v -o /kubernetes-oomkill-exporter
RUN CGO_ENABLED=0 go build -v -o /kubernetes-oomkill-exporter

FROM alpine:3.13
FROM alpine:3.16
LABEL maintainer="[email protected]"
LABEL source_repository="https://github.com/sapcc/kubernetes-oomkill-exporter"

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
TARGET = kubernetes-oomkill-exporter
GOTARGET = github.com/sapcc/$(TARGET)
REGISTRY ?= sapcc
VERSION ?= 0.4.0
VERSION ?= 0.5.0
IMAGE = $(REGISTRY)/$(BIN)
DOCKER ?= docker

Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@

----

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.
`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.

A Prometheus query for alerting could look something like this:
```
sum by(namespace, pod_name) (changes(klog_pod_oomkill[30m])) > 2
```

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.


## License
Expand Down
5 changes: 3 additions & 2 deletions cache/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ package main

import (
_ "flag"
_ "fmt"
_ "net/http"
_ "regexp"
_ "strings"

_ "docker.io/go-docker"
_ "docker.io/go-docker/api/types"
_ "github.com/containerd/containerd"
_ "github.com/containerd/containerd/namespaces"
_ "github.com/golang/glog"
_ "github.com/prometheus/client_golang/prometheus"
_ "github.com/prometheus/client_golang/prometheus/promhttp"
Expand Down
93 changes: 60 additions & 33 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,42 +1,69 @@
module github.com/sapcc/kubernetes-oomkill-exporter

go 1.19

require (
code.cloudfoundry.org/clock v0.0.0-20180518195852-02e53af36e6c // indirect
docker.io/go-docker v1.0.0
github.com/Microsoft/go-winio v0.4.11 // indirect
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/docker/distribution v2.7.0+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.3.3 // indirect
github.com/containerd/containerd v1.6.8
github.com/euank/go-kmsg-parser v2.0.0+incompatible
github.com/gogo/protobuf v1.1.1 // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf // indirect
github.com/json-iterator/go v1.1.5 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/prometheus/client_golang v1.11.1
github.com/stretchr/testify v1.7.0
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f
k8s.io/node-problem-detector v0.6.0
)

require (
code.cloudfoundry.org/clock v0.0.0-20180518195852-02e53af36e6c // indirect
github.com/Microsoft/go-winio v0.5.1 // indirect
github.com/Microsoft/hcsshim v0.9.4 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/containerd/cgroups v1.0.3 // indirect
github.com/containerd/continuity v0.2.2 // indirect
github.com/containerd/fifo v1.0.0 // indirect
github.com/containerd/ttrpc v1.1.0 // indirect
github.com/containerd/typeurl v1.0.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
github.com/go-logr/logr v1.2.2 // indirect
github.com/gogo/googleapis v1.4.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.6 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.2.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.11.13 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/moby/locker v1.0.1 // indirect
github.com/moby/sys/mountinfo v0.5.0 // indirect
github.com/moby/sys/signal v0.6.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/onsi/ginkgo v1.7.0 // indirect
github.com/onsi/gomega v1.4.3 // indirect
github.com/opencontainers/go-digest v1.0.0-rc1 // indirect
github.com/opencontainers/image-spec v1.0.1 // indirect
github.com/pkg/errors v0.8.0 // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 // indirect
github.com/opencontainers/runc v1.1.2 // indirect
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 // indirect
github.com/opencontainers/selinux v1.10.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v0.9.1
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 // indirect
github.com/prometheus/common v0.0.0-20181126121408-4724e9255275 // indirect
github.com/prometheus/procfs v0.0.0-20181126161756-619930b0b471 // indirect
github.com/spf13/pflag v1.0.3 // indirect
github.com/stretchr/testify v1.2.2
github.com/tedsuo/ifrit v0.0.0-20180802180643-bea94bb476cc // indirect
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f // indirect
golang.org/x/sys v0.0.0-20181128092732-4ed8d59d0b35 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.30.0 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
go.opencensus.io v0.23.0 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect
google.golang.org/grpc v1.43.0 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
k8s.io/api v0.0.0-20181121071145-b7bd5f2d334c // indirect
k8s.io/apimachinery v0.0.0-20181126191516-4a9a8137c0a1 // indirect
k8s.io/klog v0.1.0 // indirect
k8s.io/node-problem-detector v0.6.0
sigs.k8s.io/yaml v1.1.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/api v0.22.5 // indirect
k8s.io/apimachinery v0.22.5 // indirect
k8s.io/klog/v2 v2.30.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
)
Loading

0 comments on commit abbcac1

Please sign in to comment.