Skip to content

unable to run on rootless kubernetess  #7210

Closed as not planned
Closed as not planned

Description

@grzegorz-moto

Trying to deploy to (generic) kubernetes cluster and following the documentation: http://pulsar.apache.org/docs/v1.22.0-incubating/deployment/Kubernetes/ to deploy zookeepe first I'm getting an error because my cluster is configured to only allow images without root user

Error: container has runAsNonRoot and image will run as root

I tried to modify deployment zookeeper.yaml with

                securityContext:
                  runAsUser: 1000

building new Docker image using this simple Dockerfile:

FROM apachepulsar/pulsar-all:latest
USER 1000:1000

but it only leads to:

[conf/pulsar_env.sh] Applying config PULSAR_GC = " -XX:+UseG1GC -XX:MaxGCPauseMillis=10"
[conf/pulsar_env.sh] Applying config PULSAR_MEM = " -Xms100m -Xmx256m "
Traceback (most recent call last):
File "bin/apply-config-from-env.py", line 73, in
f = open(conf_filename, 'w')
IOError: [Errno 13] Permission denied: 'conf/pulsar_env.sh'

Looking into https://github.com/apache/pulsar/blob/master/docker/pulsar/Dockerfile#L65 it makes it difficult to modify /pulsar/conf in derived images

Activity

  1. added
    type/bug
    on Jun 8, 2020
  2. sijie commented on Jun 10, 2020

    @sijie
    Member

    @grzegorz-moto you were reading a pretty old version of Pulsar. Pulsar has already evolved to 2.5.2 release. Can you please check the latest documentation http://pulsar.apache.org/docs/en/kubernetes-helm/?

    @jiazhai At the same time, we should look into redirecting the old versions of documentation to the newer version.

  3. added
    deprecated/question
    and removed
    type/bug
    on Jun 10, 2020
  4. sijie commented on Jun 10, 2020

    @sijie
    Member

    @jiazhai

    2df0e23
    e8aec22

    I think I made the changes back in 2018. Not sure why they were overwritten. You can use these two commits as references to fix the issue.

  5. grzegorz-moto commented on Jun 10, 2020

    @grzegorz-moto
    Author

    Documentation is not a main issue here - the pulsar-all(and others) docker image, created as is, won't be able to deploy to work in rootless environment.
    As I stated before: the most trouble-making thing is the VOLUME statement (https://github.com/apache/pulsar/blob/master/docker/pulsar/Dockerfile#L65) which makes /pulsar/conf and /pulsar/data access permissions impossible to modify later on.
    Removing that line (or better replacing with RUN chmod -R a+w /pulsar/{conf,data}) and rebuilding docker images made it possible to run services as a non-root user (id:1000)

  6. sijie commented on Jun 10, 2020

    @sijie
    Member

    @grzegorz-moto I see. Are you interested in contributing a bugfix to this issue?

  7. grzegorz-moto commented on Jun 15, 2020

    @grzegorz-moto
    Author

    Sure I can file a PR with the pulsar docker change however it is just the first step to make it possible to deploy pulsar in cluster user space. For example pulsar_manager and other monitoring services seems to rely on container root user and cluster admin privileges

  8. tisonkun commented on Nov 14, 2022

    @tisonkun
    Member

    Closed as stale. Please open a new issue if it's still relevant in maintained versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    deprecated/questionlifecycle/stale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions