-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Make k8s meta processor initialisation asynchronous #16373
Conversation
Signed-off-by: chrismark <[email protected]>
Signed-off-by: chrismark <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only some small details, and there seems to be some format error.
Signed-off-by: chrismark <[email protected]>
Signed-off-by: chrismark <[email protected]>
Changed some stuff and added testing notes. Tested it with minikube with the process described in the PR's description. |
Signed-off-by: chrismark <[email protected]>
"time" | ||
|
||
"github.com/cloudflare/cfssl/log" | ||
|
||
"github.com/elastic/beats/libbeat/common/kubernetes/metadata" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit. Imports order, this libbeat import should be below with the other ones.
Signed-off-by: chrismark <[email protected]>
While fixing the import order I noticed that one import("github.com/cloudflare/cfssl/log") was not used 🤔 so I removed it and also tried to unify the logging using the processor's logger along. Sorry for the back-and-forth 🙂 . |
Good catch! |
Signed-off-by: chrismark <[email protected]>
(cherry picked from commit 4891c04)
What does this PR do?
This PR changes
add_kubernetes_metadata
processor so as to get initialised asynchronously and being able to handlenode not ready
situations.Why is it important?
This will be solve the problem of having to restart Beat in case the processor was not initialised if the node was not ready yet when Beat started.
How to test this PR locally
With the use of Minikube:
minikube start
minikube ssh
in one tab so as to handle k8s health up and downexport KUBECONFIG=~/.kube/config
add_kubernetes_metadata
processor is enabled:2020-02-18T12:25:12.825+0200 INFO add_kubernetes_metadata/kubernetes.go:77 add_kubernetes_metadata: kubernetes env detected, with version: v1.17.0
in your logs, meaning that processor was able to reach k8s API.sudo systemctl stop docker
to bring docker down and make k8s API unreachable2020-02-18T12:27:16.958+0200 INFO add_kubernetes_metadata/kubernetes.go:89 add_kubernetes_metadata: could not detect kubernetes env: Get https://192.168.64.6:8443/version?timeout=32s: dial tcp 192.168.64.6:8443: connect: connection refused
sudo systemctl start
docker.Related issues