Routing to a Rancher ExternalIP


#1

G’Day,

I was wondering if anyone had recommendations on how to set up for routing to/from an externalIP on a rancher-2-created kube cluster.

This is a three-node cluster running on top of CentOS 7 on bare metal. I’ve had quite a few issues that have turned out to be little gotchas. The latest has been selinux having an effect on the kube/rancher/docker config even after it’s been turned off.

I’m now keen to expose an externalIP for a service so that I can use SSH into a container (for example, but there are various other examples of non-http traffic). I’ve tried using kubectl expose, but even on the bare node itself it doesn’t seem to connect through. I can get to the NodePort just fine.

I don’t need it to be HA, but I’d like to use a separate IP so I can use port 22 for SSH (for example), and so that the IP can float between the nodes (I can add routes to each of the nodes and use OSPF or similar to ensure liveness of those routes).

Any thoughts on where I should go next?

Cheers,

Dave.


#2

Interestingly, after configuring the firewall to forward anything, I can route to the internal pods, but not the external IP or service IPs.


#3

Hello Dave, I dont know if this is your case but when I needed to expose a redis container port externally I used kubectl like that:

kubectl expose rs redis-v002 --type=‘NodePort’ --port=6379 --target-port=6379 --name=redis --external-ip=‘192.168.0.2’

I’ve choosen the external-ip option to the node running the redis’s pod

I hope this can help.