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

PSP/SCC for Beats #3133

Closed
david-kow opened this issue May 25, 2020 · 5 comments
Closed

PSP/SCC for Beats #3133

david-kow opened this issue May 25, 2020 · 5 comments
Labels
discuss We need to figure this out >feature Adds or discusses adding a feature to the product v1.2.0

Comments

@david-kow
Copy link
Contributor

Some of the Beats need additional permissions to succesfully run. Eg.: Filebeat needs to access hostpath for other pods logs and Metricbeat needs to access /proc for obtaining process information.

In clusters with security enabled, Beat pods need to have permission to use a PSP/SCC that allows that.

Given the above, we can either:

  1. do nothing in the code, document the need for correct PSP to be existing and specifying it for Beats pod templates
    • simple for us
    • start up experience not as nice as it could be
  2. create the necessary PSP/SCC during ECK installation (behind a flag in the eck manifest generation) and use it by default
    • might be surprising for the users
    • requires user to specify whether openshift is a target cluster or not during manifest generation
    • implementation is fairly simple
    • start up experience is nice
  3. have the controller create and manage the necessary PSP/SCC.
    • will only create the additional resources when necessary
    • implementation seems complicated and requires a lot of new permissions for the controller

I think I'd be opting for 2, but wanted to discuss broadly. Thougths?

@david-kow david-kow added discuss We need to figure this out v1.2.0 labels May 25, 2020
@botelastic botelastic bot added the triage label May 25, 2020
@david-kow david-kow added the >feature Adds or discusses adding a feature to the product label May 25, 2020
@botelastic botelastic bot removed the triage label May 25, 2020
This was referenced May 25, 2020
@pebrc
Copy link
Collaborator

pebrc commented May 27, 2020

  1. sounds good to me too.

@barkbay
Copy link
Contributor

barkbay commented Jun 2, 2020

Regarding the second option, creating the SCC is interesting but the user still have to add the right ServiceAccounts to it.

For example with something like:
> oc adm policy add-scc-to-user elastic-beats -z elastic-operator-beat-autodiscover-filebeat-sample -n elastic-monitoring
(where elastic-beats is the name of the SCC)

@david-kow
Copy link
Contributor Author

I need to take back my original suggestion.

  • we don't provide PSPs today for other resources (correct PSP and SecurityContext need to be provided by the user)
  • the required PSP will vary a lot depending on Beat type and its config
  • as we can't precreate SCC, due to what @barkbay pointed out. Users would have a different experience on OpenShift or we would need to heavily special case it in the operator code

Given that, I'd propose the following:

  • we expect users to provide correct PSP/SCC, but we offer samples (we will need them anyway for testing)
  • the operator creates a ServiceAccount with a well-known name template that users can target with SCC or bind to using separate ClusterRoleBinding

This way we are consistent and operator logic stays fairly simple while users have available example PSPs/SCCs that we know work.

@sebgl
Copy link
Contributor

sebgl commented Jun 5, 2020

@david-kow your last suggestion makes sense to me. I think it's better for us to start with less magic and maybe add some magic later than the other way around.

IIUC our Beats Quickstart docs would look like the following:

  1. Deploy this Filebeat/Metricbeat yaml file
  2. If your cluster is running with the PSP feature enabled, or if you're running with Openshift see [these instructions]

PSP/SCC instructions:

  • if you're running on Openshift, apply this SCC in which you must include the serviceAccount name we create for your beat resource
  • if you're running Kubernetes with PSP enabled, apply this PSP and this ClusterRoleBinding in which you must include the serviceAccount name we create for your beat resource

@pebrc pebrc added the :beats label Jun 8, 2020
@david-kow
Copy link
Contributor Author

This is implemented with #3041. Docs issue will come separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss We need to figure this out >feature Adds or discusses adding a feature to the product v1.2.0
Projects
None yet
Development

No branches or pull requests

4 participants