How to manually create an Istio Gateway and VirtualService for the Ingress to a vFunction Server in a Kubernetes Cluster



Overview

vFunction supports integrating with an Istio Gateway beginning in apiVersion v1beta1 and later. For organizations whose Istio version is older, such as apiVersion v1alpha3 for example, can manually create the VirtualService and Gateway to use Istio with a vFunction Server.


Create a VirtualService using Istio

Take the following steps to create an Istio VirtualService for an Ingress to the vFunction Server in a Kubernetes Cluster:

  1. Create a vf-virtualservice.yaml Manifest for the Istio VirtualService using the details below as a guide:
### Replace $VFUNCTION_SERVER with the FQDN for the vFunction Server
### Replace $SERVICE_ID_FOR_VFUNCTION_NGINX with the name returned by "kubectl get svc | grep vfunction-nginx"
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: vfunction-virtualservice
  labels:
    app: vfunction-server
    app.kubernetes.io/instance: vfunction-virtualservice-vfunction-server
    app.kubernetes.io/name: vfunction-virtualservice
spec:
  hosts:
    - $VFUNCTION_SERVER
  gateways:
    ### If manually creating the Gateway, this Gateway name will also need to be modified
    - istio-gateways/istio-gateway
  http:
    - match:
        - uri:
            prefix: /
      route:
        - destination:
            host: $SERVICE_ID_FOR_VFUNCTION_NGINX
            port:
              number: 80
          weight: 100
  1. Apply the Manifest for the VirtualService
kubectl apply -f vf-virtualservice.yaml

Create a Gateway using Istio

  1. Create a vf-gateway.yaml Manifest for the Istio Gateway using the details below as a guide:
### Replace $VFUNCTION_SERVER with the FQDN for the vFunction Server
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  labels:
    app: vfunction-server
    app.kubernetes.io/instance: vfunction-gateway-vfunction-server
    app.kubernetes.io/name: vfunction-gateway
    tier: infra
  name: vfunction-gateway
  namespace: $NAMESPACE
spec:
  selector:
    istio: ingressgateway
  servers:
    - port:
        number: 80
        name: http
        protocol: HTTP
      hosts:
        - $VFUNCTION_SERVER
  1. Apply the Manifest for the Ingress
kubectl apply -f vf-gateway.yaml