is there a way to access a Kubernetes service (externally) using just a name instead of node_name:port?

9/4/2019

I'm running Jenkins on my K8s cluster, and it's currently accessible externally by node_name:port. Some of my users are bothered by accessing the service using a port name, is there a way I could just assign the service a name? for instance: jenkins.mydomain

Thank you.

-- Gaby
jenkins
kubernetes

3 Answers

9/10/2019

Thank you so much for your suggestions, I forgot to mention that my k8s is running on bare-metal so, a solution like ingress on its own won't work.

I ended up using metallb for this.

https://metallb.universe.tf/

Thanks again :)

-- Gaby
Source: StackOverflow

9/4/2019

Have a look at Kubernetes Ingress. You can define rules that point internally to the Kubernetes Service in front of Jenkins.

https://kubernetes.io/docs/concepts/services-networking/ingress/

-- Christiaan Vermeulen
Source: StackOverflow

9/4/2019

You could use an Ingress or a Service of type LoadBalancer that listens on port 80 and forwards to the Jenkins Pods with the custom port. Then you could just create a DNS, for example for jenkins.mydomain.com, record pointing to the IP address of the Service.

-- weibeld
Source: StackOverflow