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

Proposal to modify 'get_process_container_description' function #394

Open
yunnniverse opened this issue Sep 30, 2024 · 0 comments
Open

Proposal to modify 'get_process_container_description' function #394

yunnniverse opened this issue Sep 30, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@yunnniverse
Copy link

Problem

In my Ubuntu 20.04, scaphandre can't catch the Kubernetes information (Kubernetes_node_name, kubernetes_namespace, kubernetes_pod_name) in case of container scheduler is Kubernetes.

I tried debugging, and I clearly found a process related to Kubernetes, and in that process's proc/pid/cgroup file, there is a line that contains 'kubepods'.

However, despite the existence of this information, Scaphandre was unable to retrieve the Kubernetes data.

Solution

After debugging, I realized that the structure of the container ID line to be compared was slightly different.

container_id : "cri-container-(id)"
final_id : "containers://(id)"

In code, src/sensors/utils.rs:553

if let Some(final_id) = 
    id.strip_prefix("containerd://")
         {
            final_id == container_id
         }

This code compares (id) and cri-container-(id)
Then of course result will be false.

So I changed this code like below

    id.strip_prefix("containerd://")
         {
            **container_id.contains(final_id)**
         }

I think this will be better way to get containers information. How do you all think??

@yunnniverse yunnniverse added the enhancement New feature or request label Sep 30, 2024
@bpetit bpetit added this to General Oct 17, 2024
@github-project-automation github-project-automation bot moved this to Triage in General Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Triage
Development

No branches or pull requests

1 participant