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

[nats helm 1.x] nats-server pid location changes based on configuration #759

Closed
mprimi opened this issue Jul 7, 2023 · 3 comments · Fixed by #782
Closed

[nats helm 1.x] nats-server pid location changes based on configuration #759

mprimi opened this issue Jul 7, 2023 · 3 comments · Fixed by #782
Assignees

Comments

@mprimi
Copy link

mprimi commented Jul 7, 2023

Using Helm chart nats-1.0.0-beta6

With:

  reloader:
    enabled: false

The nats-server pid file is found at: /var/run/nats.pid

With:

  reloader:
    enabled: true

The nats-server pid file is found at a different location: /var/run/nats/nats.pid

@caleblloyd
Copy link
Contributor

This is by design. When the reloaded is enabled, the PID file needs to be accessible by both the nats and reloader containers.

When the reloader is enabled, an emptyDir volume is created at /var/run/nats and mounted to both containers, and the PID file is written inside of that volume

When the reloader is disabled, this volume does not exit, and the /var/run/nats directory does not exist, so the pidfile goes in /var/run instead.

0.x may have always been making this volume. But it is not necessary to make when the reloader is not enabled so 1.x changes to only make the volume if it is needed.

@MikaelElkiaer
Copy link

@caleblloyd Sorry to piggyback on this issue.
But I suspect that I am facing a similar issue - related to config and resulting pid set-up.

I have reloader disabled, but am running all containers as non-root.
This caused an error when starting the server - stating the server did not have permissions to write to /var/run/nats.pid.

As a temporary fix, I added to my config:

container:
  patch:
    - op: add
      path: /volumeMounts/-
      value:
        mountPath: /var/run
        name: var-run
podTemplate:
  patch:
      - op: add
        path: /spec/volumes/-
        value:
          emptyDir: {}
          name: var-run

@caleblloyd
Copy link
Contributor

Ah, I had not considered the unprivileged use case. Seems that it is best to always make the emptyDir then - #782

@caleblloyd caleblloyd self-assigned this Aug 17, 2023
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

Successfully merging a pull request may close this issue.

3 participants