Giorgos Ntymenos
Giorgos Ntymenos

Reputation: 411

How to expose nats(bitnami) using Ingress

I have an Nginx ingress controller in my Kubernetes cluster and I use bitnami/nats.

The services produced are the following:

NAME                TYPE        CLUSTER-IP    EXTERNAL-IP   PORT(S)             AGE
nats-client         ClusterIP   10.72.13.82   <none>        4222/TCP            36m
nats-cluster        ClusterIP   10.72.8.67    <none>        6222/TCP            36m
nats-headless       ClusterIP   None          <none>        4222/TCP,6222/TCP   36m
nats-monitoring     ClusterIP   10.72.2.102   <none>        8222/TCP            36m

When I kubefwd the port(4222) I can connect to it, but using the below ingress it doesn't work.

Here's my ingress.yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-controller
  annotations:
    kubernetes.io/ingress.class: "nginx"
    kubernetes.io/tls-acme: "true"
    cert-manager.io/cluster-issuer: "letsencrypt-cluster-issuer"
spec:
  tls: 
  - hosts: 
    - NATS_DOMAIN
    secretName: secret
  rules:
  - host: NATS_DOMAIN
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service: 
            name: nats-client
            port:
              number: 4222

Any help would be highly appreciated!

Upvotes: 2

Views: 1021

Answers (2)

Giorgos Ntymenos
Giorgos Ntymenos

Reputation: 411

This is a bit late, but NATS is not an http based protocol so this cannot be done with an http based ingress component. Instead it can bee done using load balancers.

Upvotes: 2

Rafael Rios Saavedra
Rafael Rios Saavedra

Reputation: 76

Do you mind opening an issue here? That way we could ask for more information and provide a better help. Once it is solved we can come back here a post the findings so other users can get it too. Please, when opening issue provide all the information that could help debugging it. As commands executed, images used, charts used, logs, etc.

Upvotes: 2

Related Questions