Try to create a delegate virtual service but got error: "configuration invalid: virtual service must have at least one host"

I updated my istio from 1.5.4 to 1.6.2. Then I try to create the example delegate virtual service as in the istio 1.6 documentation. According to the documentation. for a delegate virtual service the hosts field must be empty. But I get the error:

“Error from server: error when creating “test_delegate_vs.yml”: admission webhook “
denied the request: configuration is invalid: virtual service must have at least one host”

The yaml I used to create the delegate virtual service is from the delegate virtual service section of the official istio 1.6 documentation: here

See below for the yaml I use to create the DELEGATE VIRTUAL SERVICE:

kind: VirtualService
  name: reviews
  - route:
    - destination:
        host: reviews.svc.cluster.local

How should I solve this problem?

Thank you!

you have to add namspace tag also

Hi mudit,

Thank you for your reply. Even after I add namespace to the yaml, It still gives me the same error:
“virtual service must have at least one host”. From the error message, it seems that the error is because istio requires the vs to have at least one host. But according to the istio 1.6 offical documentation, delegate virtual service should have no hosts. So how should I solve the problem?

Hi @GaryYangZheng

You need to enable vitualservice delegation by enabling or set the env variable
you can edit the deployment file of istiod in istio-system. by running
kubectl edit deployment istiod -n istio-system and then add this env variable in spec.template.spec.container.env

may be this will help you!

1 Like

@Shubham Thank you!
My colleague solved this problem the same way. It works!
I think this should be added to the official documentation for Delegate Virtual Service