Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use HTTP liveness probe instead of tetra status #2474

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions cmd/tetragon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
"github.com/cilium/tetragon/pkg/fileutils"
"github.com/cilium/tetragon/pkg/filters"
tetragonGrpc "github.com/cilium/tetragon/pkg/grpc"
"github.com/cilium/tetragon/pkg/health"
"github.com/cilium/tetragon/pkg/logger"
"github.com/cilium/tetragon/pkg/metrics"
"github.com/cilium/tetragon/pkg/metrics/metricsconfig"
Expand Down Expand Up @@ -245,6 +246,19 @@ func tetragonExecute() error {
bpf.CheckOrMountDebugFS()
bpf.CheckOrMountCgroup2()

// start liveness probe http endpoint
go func() {
http.HandleFunc("/liveness", func(w http.ResponseWriter, _ *http.Request) {
resp, err := health.GetHealth()
if err == nil && len(resp.HealthStatus) == 1 && resp.HealthStatus[0].Status == tetragon.HealthStatusResult_HEALTH_STATUS_RUNNING {
w.WriteHeader(http.StatusOK)
} else {
w.WriteHeader(http.StatusServiceUnavailable)
}
})
http.ListenAndServe(":6789", nil)
}()

if option.Config.PprofAddr != "" {
go func() {
if err := servePprof(option.Config.PprofAddr); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion docs/content/en/docs/reference/helm-chart.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion install/kubernetes/tetragon/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions install/kubernetes/tetragon/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@ tetragon:
securityContext:
privileged: true
# -- Overrides the default livenessProbe for the tetragon container.
livenessProbe: {}
# grpc:
# port: 54321
livenessProbe:
timeoutSeconds: 60
httpGet:
path: "/liveness"
port: 6789

# Tetragon puts processes in an LRU cache. The cache is used to find ancestors
# for subsequently exec'ed processes.
Expand Down
Loading