After research for a few days, I assume this is the most valuable answer for now, and I was tried to find my way out from that idea, just forward tcp protocol from the port to the corresponding service. But I have no luck so far.
Any suggestions are appreciated.
Environment:
ingress-nginx
rabbitmq
After using port-forwarding to check whether we're able to connect to 5672
# Allow 5672/tcp port accessible from everywhere
ufw allow 5672/tcp
# port forwarding
kubectl port-forward rabbitmq-0 5672:5672
# Checking connection success from local
telnet localhost 5672
# Checking connection failed from any other machine
telnet <my-vps-ip> 5672
I'm sure there's no other firewall, as I only use ufw command to expose other ports, they all work fine.
Any idea ?
--tcp-services-configmap
flag within ingress-nginx-controller
deployments being added
Config map with port 5672 added.
Checking port 5672 was also patched within ingress-nginx-controller
deployment, using command kubectl get deploy ingress-nginx-controller -n ingress-nginx -o yaml
Checking port 5672 was also patched within ingress-nginx-controller
service, using command kubectl get svc ingress-nginx-controller -n ingress-nginx -o yaml
But now, even testing locally failed by command telnet localhost 5672
, which previously success using port forward.
Is that I missed something ?
I end up using a load balancer service for it. Here's how it does
apiVersion: v1
kind: Service
metadata:
name: amqp-expose
namespace: rabbitmq
spec:
ports:
- name: amqp
protocol: TCP
port: 5672
targetPort: 5672
selector:
app.kubernetes.io/name: rabbitmq
app.kubernetes.io/instance: rabbitmq
type: LoadBalancer
sessionAffinity: None
externalTrafficPolicy: Cluster