Skip to content

Proposal to modify 'get_process_container_description' function #394

Open
@yunnniverse

Description

@yunnniverse

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??

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions