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-Pod crashes when deploying nats cluster with super cluster / gateway configuration #279

Closed
Da5-Id opened this issue Aug 12, 2020 · 1 comment · Fixed by #282
Closed

Comments

@Da5-Id
Copy link

Da5-Id commented Aug 12, 2020

I try to deploy one nats cluster with a gateway configuration to build a super cluster.

The yaml looks like this:

apiVersion: nats.io/v1alpha2
kind: NatsCluster
metadata:
  name: nats
  namespace: nats
spec:
  size: 3
  version: "2.1.7"
  noAdvertise: true
  
  pod:
    enableConfigReload: true
    reloaderImage: connecteverything/nats-server-config-reloader
    reloaderImageTag: "0.6.0"
    reloaderImagePullPolicy: "IfNotPresent"

  auth:
    enableServiceAccounts: true    

  gatewayConfig:
	name: "nats-one-gw"
	hostPort: 7522
	rejectUnknown: true

  gateways:
    - name: nats-two-gw
      url: "nats://nats-two:7522"
template:
  spec:
    containers:
     - name: nats

The pod crashes with this error message:

nats-server: error parsing include file 'advertise/gateway_advertise.conf', open /etc/nats-config/advertise/gateway_advertise.conf: no such file or directory

The nats config ( kubernetes secret ) contains an include

include "advertise/gateway_advertise.conf", "gateway": { "name": "nats-one-gw", "port": 7522, "gateways": [ { "name": "nats-two-gw", "url": "nats://nats-two:7522" } ], "reject_unknown": true

While advertising is disabled I wonder why there is an include to advertise/gateway_advertise.config ?
Who is responsible to create the gateway_advertise.config ?

@wallyqs
Copy link
Member

wallyqs commented Aug 12, 2020

Currently it needs these two values to be enabled as well:

  pod:
    enableClientsHostPort: true
    advertiseExternalIP: true

It assumes that the gateways will always have external access via host ports and advertising enabled, which relies on an initializer container to create that file. A check here on whether advertising has been enabled to decide whether to include the file would help avoiding the issue:

Include: filepath.Join(".", constants.BootConfigGatewayFilePath),

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.

2 participants