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

operator: disable metrics server by default #2484

Merged

Conversation

yukinakanaka
Copy link
Contributor

@yukinakanaka yukinakanaka commented May 30, 2024

Fixes: #1778

Disable the operator's metrics server by default. If the metrics-bind-address flag is set, it will be enabled.
Regarding Helm, metrics-bind-address is set as 2113 by default when tetragonOperator.prometheus.enabled = true.

operator: Don't start metrics server if Helm value `tetragonOperator.prometheus.enabled` is set to false.

@yukinakanaka yukinakanaka requested a review from a team as a code owner May 30, 2024 02:01
@yukinakanaka yukinakanaka requested a review from tixxdz May 30, 2024 02:01
@yukinakanaka
Copy link
Contributor Author

I confirmed the operator's metrics server is disabled when tetragonOperator.prometheus.enabled = false is set. Here are the test results:

tetragonOperator.prometheus.enabled=false

Parameters for helm

helm upgrade --install --namespace kube-system tetragon ./install/kubernetes/tetragon \
 --set tetragon.image.override=cilium/tetragon:latest \
 --set tetragonOperator.image.override=cilium/tetragon-operator:latest \
  --set tetragon.hostProcPath=/procHost \
  --set tetragonOperator.prometheus.enabled=false

Access the port:2113

The curl failed. That means the operator doesn't listen on the 2113 port.

kubectl debug tetragon-operator-6dd97d997b-94hqv --image=alpine/curl -it -- curl -I localhost:2113/metrics

Defaulting debug container name to debugger-ztx2s.
curl: (7) Failed to connect to localhost port 2113 after 0 ms: Couldn't connect to server

Pod Log

There was no log relating to the metrics server

kubectl logs tetragon-operator-6dd97d997b-94hqv | grep metrics
(no result)

tetragonOperator.prometheus.enabled=true

Parameters for helm

helm upgrade --install --namespace kube-system tetragon ./install/kubernetes/tetragon \
 --set tetragon.image.override=cilium/tetragon:latest \
 --set tetragonOperator.image.override=cilium/tetragon-operator:latest \
  --set tetragon.hostProcPath=/procHost \
  --set tetragonOperator.prometheus.enabled=true

Access the port:2113

The operator returned 200.

kubectl debug tetragon-operator-dfb5b856f-fj566  --image=alpine/curl -it -- curl -I localhost:2113/metrics
Defaulting debug container name to debugger-tj6v8.

HTTP/1.1 200 OK
Content-Type: text/plain; version=0.0.4; charset=utf-8; escaping=values
Date: Thu, 30 May 2024 03:19:28 GMT

Pod Log

There were two lines of logs relating to the metrics server.

kubectl logs tetragon-operator-dfb5b856f-fj566 | grep metrics
Defaulted container "tetragon-operator" out of: tetragon-operator, debugger-j6tmh (ephem), debugger-k9cxr (ephem), debugger-xpv4n (ephem), debugger-qtcv7 (ephem)

time="2024-05-30T02:51:42Z" level=info msg="Starting metrics server" logger=controller-runtime.metrics subsys=operator
time="2024-05-30T02:51:42Z" level=info msg="Serving metrics server" bindAddress=":2113" logger=controller-runtime.metrics secure=false subsys=operator

@lambdanis lambdanis added release-note/bug This PR fixes an issue in a previous release of Tetragon. area/operator Related to Tetragon Operator labels May 30, 2024
Copy link
Contributor

@lambdanis lambdanis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

@lambdanis lambdanis merged commit 87139eb into cilium:main May 30, 2024
40 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/operator Related to Tetragon Operator release-note/bug This PR fixes an issue in a previous release of Tetragon.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Helm: Expose operator metrics
2 participants