Kubernetes and Istio dynamic port mapping

12/10/2018

It there a way to use some kind of dynamic port mapping in the following scenario
(Istio > Kubernetes service):

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: my-virtualservice
spec:
  hosts:
    # my-service.default.svc.cluster.local ?
  - "*"
  gateways: 
  - my-gateway
  http:
  - match:
    - uri:
        prefix: /somepath/
    route:
    - destination:
        host: my-service

And when using Istio, the end user do not need to know the port, and therefore is possible to create and use a dynamic free port?

Defining a service:
# K8s - Service
apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  ports:
  - name: my-port
    port: #***  Dynamic port? ***#
    targetPort: 80
-- Chris G.
istio
kubernetes

0 Answers