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

[Feature]: Enable milvus containers to run as a non-root user #25565

Closed
1 task done
jarradtp opened this issue Jul 13, 2023 · 7 comments · Fixed by #30775
Closed
1 task done

[Feature]: Enable milvus containers to run as a non-root user #25565

jarradtp opened this issue Jul 13, 2023 · 7 comments · Fixed by #30775
Assignees
Labels
good first issue Good for newcomers kind/feature Issues related to feature request from users

Comments

@jarradtp
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe.

Referencing this: #22516 (comment)

Running containers as root can pose a security risk and is generally not recommended, in certain environment running of container as root is strictly prohibited and prevents milvus from being deployed.

In addition, certain flavors of Kubernetes e.g openshift by default, runs containers with a non-root user (for security reasons) which causes milvus container pods to fail with "write failed: open /milvus/configs/milvus.yaml: permission denied error

Describe the solution you'd like.

Enable milvus containers to be able to run as a non-root user.

Describe an alternate solution.

No response

Anything else? (Additional Context)

No response

@jarradtp jarradtp added the kind/feature Issues related to feature request from users label Jul 13, 2023
@jiaoew1991 jiaoew1991 added the good first issue Good for newcomers label Oct 11, 2023
@tmechineni12
Copy link

Hi,

Looks like I am having a same issue. Can you please tell what is the status of this. I opened a new issue. See this. zilliztech/milvus-helm#43

@xiaofan-luan
Copy link
Contributor

/assign @LoveEachDay
is there a specific reason for running milvus as root?

@koflerm
Copy link

koflerm commented Jan 10, 2024

+1 for this feature. It seems the only reason it is running as root are wrong file permissions, which can be easily fixed with a proper Dockerfile.

@jarradtp
Copy link
Author

Coming back to check if there are any updates or plan to fix this.

@guimou
Copy link
Contributor

guimou commented Feb 20, 2024

Has anyone started working on this? Otherwise I'll take a stab at it to enrich the ecosystem around OpenShift AI.

@koflerm
Copy link

koflerm commented Feb 20, 2024

I can just explain the procedure how to fix it. It seems it is a simple file/folder permission issue which means should be straight forward to fix it by modifying the Dockerfile of the images of problematic components to include chmod g+rwx and chgrp root on the affected folders. OpenShift requires the root group to have the necessary permissions as all containers by default start with a random UID but each user is in the root group. Hope this helps

@guimou
Copy link
Contributor

guimou commented Feb 20, 2024

Yeah, this is what I may do on the short term, this is quite standard procedure to fix ownership/permissions on those types of container.
On the longer term, we may want to contribute a proper UBI-based image.

sre-ci-robot pushed a commit that referenced this issue Feb 28, 2024
OpenShift runs Pods with a random uid and gid 0.
As Milvus needs to write into the /milvus directory, this fix modifies
the group permissions to allow the root group (gid 0) to write into it.
This is a simple solution that allows to run Milvus on OpenShift without
adding security constraints, use special ServiceAccounts or whatever.
This should also not impact any other kubernetes platform as it's a
simple group permission change, nothing regarding the userid.

Note: Other actions are necessary to properly deploy the full stack
(Minio, Pulsar,...) on OpenShift. I will document them in the helm chart
project.

Fixes #25565

Signed-off-by: Guillaume Moutier <guillaume.moutier@gmail.com>
haorenfsa pushed a commit to haorenfsa/milvus that referenced this issue Feb 29, 2024
…o#30775)

OpenShift runs Pods with a random uid and gid 0.
As Milvus needs to write into the /milvus directory, this fix modifies
the group permissions to allow the root group (gid 0) to write into it.
This is a simple solution that allows to run Milvus on OpenShift without
adding security constraints, use special ServiceAccounts or whatever.
This should also not impact any other kubernetes platform as it's a
simple group permission change, nothing regarding the userid.

Note: Other actions are necessary to properly deploy the full stack
(Minio, Pulsar,...) on OpenShift. I will document them in the helm chart
project.

Fixes milvus-io#25565

Signed-off-by: Guillaume Moutier <guillaume.moutier@gmail.com>
haorenfsa pushed a commit to haorenfsa/milvus that referenced this issue Feb 29, 2024
…o#30775)

OpenShift runs Pods with a random uid and gid 0.
As Milvus needs to write into the /milvus directory, this fix modifies
the group permissions to allow the root group (gid 0) to write into it.
This is a simple solution that allows to run Milvus on OpenShift without
adding security constraints, use special ServiceAccounts or whatever.
This should also not impact any other kubernetes platform as it's a
simple group permission change, nothing regarding the userid.

Note: Other actions are necessary to properly deploy the full stack
(Minio, Pulsar,...) on OpenShift. I will document them in the helm chart
project.

Fixes milvus-io#25565

Signed-off-by: Guillaume Moutier <guillaume.moutier@gmail.com>
haorenfsa pushed a commit to haorenfsa/milvus that referenced this issue Mar 4, 2024
…o#30775)

OpenShift runs Pods with a random uid and gid 0.
As Milvus needs to write into the /milvus directory, this fix modifies
the group permissions to allow the root group (gid 0) to write into it.
This is a simple solution that allows to run Milvus on OpenShift without
adding security constraints, use special ServiceAccounts or whatever.
This should also not impact any other kubernetes platform as it's a
simple group permission change, nothing regarding the userid.

Note: Other actions are necessary to properly deploy the full stack
(Minio, Pulsar,...) on OpenShift. I will document them in the helm chart
project.

Fixes milvus-io#25565

Signed-off-by: Guillaume Moutier <guillaume.moutier@gmail.com>
Signed-off-by: shaoyue.chen <shaoyue.chen@zilliz.com>
haorenfsa pushed a commit to haorenfsa/milvus that referenced this issue Mar 4, 2024
…o#30775)

OpenShift runs Pods with a random uid and gid 0.
As Milvus needs to write into the /milvus directory, this fix modifies
the group permissions to allow the root group (gid 0) to write into it.
This is a simple solution that allows to run Milvus on OpenShift without
adding security constraints, use special ServiceAccounts or whatever.
This should also not impact any other kubernetes platform as it's a
simple group permission change, nothing regarding the userid.

Note: Other actions are necessary to properly deploy the full stack
(Minio, Pulsar,...) on OpenShift. I will document them in the helm chart
project.

Fixes milvus-io#25565

Signed-off-by: Guillaume Moutier <guillaume.moutier@gmail.com>
Signed-off-by: shaoyue.chen <shaoyue.chen@zilliz.com>
sre-ci-robot pushed a commit that referenced this issue Mar 4, 2024
Fixes #25565
Cherry-pick 
pr: #30775

Signed-off-by: Guillaume Moutier <guillaume.moutier@gmail.com>
Signed-off-by: shaoyue.chen <shaoyue.chen@zilliz.com>
Co-authored-by: Guillaume Moutier <guimou@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers kind/feature Issues related to feature request from users
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants