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

Don't require IPC_LOCK and SYS_RESOURCE capabilities by default #237

Closed
johananl opened this issue Aug 14, 2019 · 8 comments
Closed

Don't require IPC_LOCK and SYS_RESOURCE capabilities by default #237

johananl opened this issue Aug 14, 2019 · 8 comments

Comments

@johananl
Copy link
Contributor

We should consider removing the extra capabilities which are currently added to the Cassandra containers by the operator:

SecurityContext: &corev1.SecurityContext{
Capabilities: &corev1.Capabilities{
Add: []corev1.Capability{
"IPC_LOCK", // C* wants to mlock/mlockall
"SYS_RESOURCE", // permit ulimit adjustments
},
},
},

Following #219 (comment) it is likely that we don't actually need these capabilities in the Cassandra container since things seem to work without them (albeit with potentially reduced performance). We may want to conditionally add these capabilities only when the sysctl support flag discussed in #208 is set to true.

@smiklosovic
Copy link
Collaborator

Seems as a good idea to me. What is the progress on 208?

@johananl
Copy link
Contributor Author

@smiklosovic looks like we are waiting for a response from @zegelin and @benbromhead.

I can take the initiative there and propose a solution for #208 following my comment in a new PR, but I thought @alourie was on it so didn't want to interfere.

@alourie
Copy link
Contributor

alourie commented Aug 19, 2019

@johananl @benbromhead @zegelin yes, I am basically waiting on the comment in #208. I can do this either stand alone or as a part of #218.

@DestyNova
Copy link

Hello, is there a workaround to avoid this problem? As it stands, I can't deploy Cassandra in one of our test clusters:

Warning  FailedCreate      60s (x26 over 6m16s)  statefulset-controller  create
  Pod cassandra-eolas-dc-0 in StatefulSet cassandra-eolas-dc failed error: pods
  "cassandra-eolas-dc-0" is forbidden: unable to validate against any pod security
  policy: [spec.initContainers[0].securityContext.privileged: Invalid value: true:
  Privileged containers are not allowed spec.containers[0].securityContext.capabilities.add:
  Invalid value: "IPC_LOCK": capability may not be added
  spec.containers[0].securityContext.capabilities.add:
  Invalid value: "SYS_RESOURCE": capability may not be added]

@johananl
Copy link
Contributor Author

Hello @DestyNova. Could you provide some information regarding your setup?

  • The version of the operator you are running.
  • Manifest used to create the Cassandra instance.

Relevant work is being done in #208.

As a workaround in the meantime, you may be able to tweak the relevant pod security policy in your cluster to allow the following:

  • Privileged containers
  • The IPC_LOCK capability
  • The SYS_RESOURCE capability

If you are not sure which PSP to edit, the following may give you a hint:

kubectl get pods <cassandra pod> -oyaml | grep psp

@DestyNova
Copy link

Thanks @johananl! I don't have access now, but I'll try that tomorrow 👍

@DestyNova
Copy link

@johananl I'm not sure what the version is, but::

image: gcr.io/cassandra-operator/cassandra-operator:latest
    imageID: docker-pullable://gcr.io/cassandra-operator/cassandra-operator@sha256:bf3a2d21f4036a9bc267c66bb4ed3fd6da0a8d94ec6db2b021ce6bb3bb3474b4

@johananl
Copy link
Contributor Author

johananl commented Sep 4, 2019

Fixed in #269.

@johananl johananl closed this as completed Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants