nats-streaming-operator icon indicating copy to clipboard operation
nats-streaming-operator copied to clipboard

Enable monitoring

Open taddgiles opened this issue 6 years ago • 3 comments

Is there a way to enable http monitoring with the nats-streaming-operator?

/streaming/serverz and such.

I tried adding a container args to the k8s config.

---
apiVersion: streaming.nats.io/v1alpha1
kind: NatsStreamingCluster
metadata:
  name: nats-streaming-cluster
spec:
  size: 3
  natsSvc: nats-cluster
  template:
    spec:
      containers:
        - args: ["--http_port=8222", "--stan_debug=true", "--stan_trace=true"]

But the default operator config doesn't create a service that would work for that.

taddgiles avatar Feb 20 '19 22:02 taddgiles

There is no toggle for the monitoring port right now, but you could enable it via the config file:

echo '
  http = 0.0.0.0:8222
' > streaming.conf

kubectl create secret generic streaming-conf  --from-file=streaming.conf

echo '
---
apiVersion: "streaming.nats.io/v1alpha1"
kind: "NatsStreamingCluster"
metadata:
  name: "example-stan"
spec:
  size: 3
  natsSvc: "example-nats-cluster"
  configFile: "/etc/stan/config/streaming.conf"
  template:
    spec:
      containers:
      - ports:
        - containerPort: 8222
      volumes:
      - name: streaming-conf
        secret:
          secretName: streaming-conf
      containers:
        - name: nats-streaming
          volumeMounts:
          - mountPath: /etc/stan/config
            name: streaming-conf
            readOnly: true    
' | kubectl apply -f -

kubectl port-forward example-stan-1 8222:8222

curl 127.0.0.1:8222/streaming/serverz

wallyqs avatar Feb 20 '19 22:02 wallyqs

That worked great. Big thanks!

taddgiles avatar Feb 21 '19 00:02 taddgiles

np! Will keep this issue open since a simple toggle on the manifest spec could be useful.

wallyqs avatar Feb 21 '19 00:02 wallyqs