nats-io / nats-streaming-operator

NATS Streaming Operator
Apache License 2.0
174 stars 44 forks source link

Enable monitoring #31

Open taddgiles opened 5 years ago

taddgiles commented 5 years ago

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.

wallyqs commented 5 years ago

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
taddgiles commented 5 years ago

That worked great. Big thanks!

wallyqs commented 5 years ago

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