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

Cherry-pick #23610 to 7.x: Add deployment name in pod's meta #23713

Merged
merged 1 commit into from
Jan 27, 2021

Conversation

ChrsMark
Copy link
Member

@ChrsMark ChrsMark commented Jan 27, 2021

Cherry-pick of PR #23610 to 7.x branch. Original message:

What does this PR do?

This PR adds kubernetes.deployment.name in Pods' metadata. Right now we only add kubernetes.replicaset.name when a Pod is handled by a Deployment since a Deployment controls the Pod through a ReplicaSet and the ReplicaSet is considered as the direct owner of the Pod in k8s API. In this we need an extra step check to retrieve the owner of the ReplicaSet if possible.

Why is it important?

So as to correlate Pods with Deployments controlling them.

How to test this PR locally

  1. Deploy a sample Deployment on k8s: kubectl apply -f https://k8s.io/examples/controllers/nginx-deployment.yaml
  2. Deploy Metricbeat (instructions) on k8s and verify that events shiped by pod and state_pod metricset include kubernetes.deployment.name when kubernetes.replicaset.name exists. As an example see screenshots below.

Extra: Verify that add_kubernetes_metadata adds kubernetes.deployment.name when kubernetes.replicaset.name exists, using the following configuration with Filebeat on k8s:

filebeat.inputs:
- type: container
  paths:
    - /var/log/containers/*.log
  processors:
    - add_kubernetes_metadata:
        host: ${NODE_NAME}
        matchers:
        - logs_path:
            logs_path: "/var/log/containers/"

Related issues

Screenshots

Screenshot 2021-01-21 at 11 29 37 AM
Screenshot 2021-01-21 at 11 06 15 AM

@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations (Team:Integrations)

@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Jan 27, 2021
@ChrsMark ChrsMark merged commit 2b387eb into elastic:7.x Jan 27, 2021
@leosunmo
Copy link

Nice work @ChrsMark !! Very swift!

@zube zube bot removed the [zube]: Done label Apr 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Team:Integrations Label for the Integrations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants