0
votes

Ingress example from https://kubernetes.io/docs/concepts/services-networking/ingress/ shows that in order to specify ingress bancked, we have to specify servicePort and serviceName, for example:

backend:
      serviceName: test
      servicePort: 80

I want to create services with random ports and avoid specifying them in the ingress definition. Are there any alternatives to servicePort? Maybe use port name or targetPort that are assigned in the service?

1
Elaborate more on what exactly you want from random ports? Do you know how kube-proxy works? Underneath kubernetes is using random ports for pods which you can expose but you need to specify it.3h4x

1 Answers

0
votes

Kubernetes ingress supports so far (1.8) only specific ports: https://kubernetes.io/docs/api-reference/v1.8/#ingressbackend-v1beta1-extensions

AFAIK usual pattern is to use Ingress with a service type ClusterIP, so you will not be concerned about port collisions.
You may have separate service with same selector for e.g. NodePort if needed, but this will not be concern of Ingress.