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

Mount /etc/machine-id in elastic-agent-managed-kubernetes.yaml #512

Closed
daniel-almeida opened this issue Jun 3, 2022 · 2 comments · Fixed by #530
Closed

Mount /etc/machine-id in elastic-agent-managed-kubernetes.yaml #512

daniel-almeida opened this issue Jun 3, 2022 · 2 comments · Fixed by #530
Assignees
Labels
8.5-candidate Team:Elastic-Agent Label for the Agent team Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Comments

@daniel-almeida
Copy link
Contributor

daniel-almeida commented Jun 3, 2022

Describe the enhancement:

Change the yaml for managed Agent in k8s so that it has a volume for /etc/machine-id that is mounted in the Agent's container.

New volume mount for the elastic-agent container:

- name: etc-mid
  mountPath: /etc/machine-id
  readOnly: true

New volume:

- name: etc-mid
  hostPath:
    path: /etc/machine-id
    type: File

Describe a specific use case for the enhancement or feature:

To determine host ID, Agent needs the content of /etc/machine-id (see https://github.com/elastic/go-sysinfo/blob/main/providers/linux/machineid.go#L32).

Currently, the file is present in the container, but empty, which results in Agent using the value "" when determining the host ID, and sending an empty host ID to endpoint. That makes the policy status unhealthy because Endpoint requires a valid host ID.

@daniel-almeida daniel-almeida added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team Team:Elastic-Agent Label for the Agent team labels Jun 3, 2022
@lrishi
Copy link

lrishi commented Jun 3, 2022

Cc: @norrietaylor @m-sample @qcorporation

@m-sample
Copy link

m-sample commented Jun 3, 2022

+1 on readOnly! Given that type: File means A file must exist at the given path we should test what happens when that file does not exist (e.g. on some mutant, hacked over Linux setup). If it's not a good response (e.g. Pod fails to launch) we may want to document it well for SDH avoidance or perhaps leave the type field as unspecified for 'no checks' behavior.

(Pod volume mount type field docs: https://kubernetes.io/docs/concepts/storage/volumes/#hostpath )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.5-candidate Team:Elastic-Agent Label for the Agent team Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants