Skip to content

Improve config/recipes/elastic-agent/fleet-kubernetes-integration-nonroot.yaml with drop capabilities#8811

Closed
barkbay wants to merge 1 commit intoelastic:mainfrom
barkbay:non-root-agent-with-dropped-cap
Closed

Improve config/recipes/elastic-agent/fleet-kubernetes-integration-nonroot.yaml with drop capabilities#8811
barkbay wants to merge 1 commit intoelastic:mainfrom
barkbay:non-root-agent-with-dropped-cap

Conversation

@barkbay
Copy link
Contributor

@barkbay barkbay commented Sep 4, 2025

This PR improves config/recipes/elastic-agent/fleet-kubernetes-integration-nonroot.yaml to explain how to run Fleet server with dropped capabilities and ro file system.

(I think ECK should ideally do that by default as it is already the case for Elasticsearch and Kibana)

@prodsecmachine
Copy link
Collaborator

prodsecmachine commented Sep 4, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

@botelastic botelastic bot added the triage label Sep 4, 2025
@barkbay barkbay added the >docs Documentation label Sep 4, 2025
@botelastic botelastic bot removed the triage label Sep 4, 2025
@botelastic botelastic bot removed the triage label Sep 4, 2025
@barkbay barkbay marked this pull request as ready for review September 4, 2025 07:20
spec:
serviceAccountName: fleet-server
automountServiceAccountToken: true
## Uncomment the following lines to run fleet-server with restricted privileges and drop capabilities.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 things I'm not sure:

  1. Should it be the default in this recipe? (Said differently, should we remove the #?)
  2. Do we want to apply the same changes to the Agents below? I think we don't as it could break some packages which may require some capabilities to run correctly?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a managed elastic-agent, the important bits are:

  • have the CONFIG_PATH and the STATE_PATH being writable and persisted across restarts (hence the 2 env vars below)
  • the -c /etc/agent/elastic-agent.yml which will cause the config file to be copied in the state path and used allowing for some initial config injection from secrets/config maps.

The securityContext part is optional and depends on how locked down the user wants the agent containers to be and it's more a case-by-case choice so I would leave that commented and let the user be stricter if he needs to be.

The changes I mentioned above need to be replicated to the elastic-agent Agent as well.

@barkbay
Copy link
Contributor Author

barkbay commented Sep 4, 2025

I'm closing this PR since what we are trying to solve here is not related to whether the container is running as root or not. This needs to be addressed at the operator level and therefore requires an issue to discuss how to solve this.

@barkbay barkbay closed this Sep 4, 2025
@rhr323 rhr323 added the exclude-from-release-notes Exclude this PR from appearing in the release notes label Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>docs Documentation exclude-from-release-notes Exclude this PR from appearing in the release notes v3.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants