loft-sh / vcluster

vCluster - Create fully functional virtual Kubernetes clusters - Each vcluster runs inside a namespace of the underlying k8s cluster. It's cheaper than creating separate full-blown clusters and it offers better multi-tenancy and isolation than regular namespaces.
https://www.vcluster.com
Apache License 2.0
6.32k stars 403 forks source link

Allow accessing host services in vcluster without cluster role #951

Open sandangel opened 1 year ago

sandangel commented 1 year ago

Is your feature request related to a problem?

Which solution do you suggest?

Which alternative solutions exist?

Additional context

pods in vcluster can not access istio mesh on host

neogopher commented 1 year ago

Hi @sandangel , Thanks for creating the issue!! Will check this and let you know shortly.

neogopher commented 1 year ago

Hi @sandangel ,

mapServices provides the capability to create a mapping between a service residing in any namespace on the host cluster to a given service and namespace in the vcluster. For this usecase, a cluster role is employed, though as you said a role would suffice if the service resides in the vcluster namespace. However, the clusterrole contains access rules for some other resources as required like nodes, pods etc, so the cluster role is going to be created for that purpose.

Also, with the alternate solution i.e forwarding the DNS queries to the host dns, do you mean that first the vcluster coredns be queried and if its not found there the request is to be sent to the host dns server?

sandangel commented 1 year ago

Also, with the alternate solution i.e forwarding the DNS queries to the host dns, do you mean that first the vcluster coredns be queried and if its not found there the request is to be sent to the host dns server?

that is correct.

sandangel commented 1 year ago

Finally I was able to connect to host istio service mesh using the static host nameserver IP in dnsConfig. I think the use case is valid because we start increasing adoption in the company from a few namespaces. The workloads from that namespace still need to connect to other workloads in other team's namespaces inside the host service mesh.

Vcluster can already do that but user need to find the static ip of cluster nameserver and explicitly set it to specific pod. We can just make it more convenient to user by using an annotation to a pod that user want to use host dns. WDYT?