Open kuccilim opened 3 years ago
I was successful connect it with kubectl port-forward svc/example-nats 4222:4222, but how to expose it with nginx-ingress?
kubectl port-forward svc/example-nats 4222:4222
apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: kubernetes-ingress annotations: kubernetes.io/ingress.class: nginx spec: rules: - host: client.test-stan.xyz http: paths: - backend: serviceName: example-nats servicePort: 4222
Code:
import nats from "node-nats-streaming"; const stan = nats.connect("example-stan", "abc", { // url: "http://localhost:4222", // successful connected url: "nats://client.test-stan.xyz:4222", // failed }); stan.on("connect", () => { console.log("Publisher connected to NATS"); const data = 'hello world!'; stan.publish("nats:created", data, () => { console.log("Event published"); }); });
I was successful connect it with
kubectl port-forward svc/example-nats 4222:4222
, but how to expose it with nginx-ingress?Code: