Skip to main content

Replicate networking services

With open source vCluster, you need to replicate services between the host cluster and virtual cluster.

Host cluster to virtual cluster​

In this example, you map a service my-host-service in the namespace my-host-namespace to the virtual cluster service my-virtual-service in the virtual cluster namespace my-virtual-namespace.

replicateServices:
fromHost:
- from: my-host-namespace/my-host-service
to: my-virtual-namespace/my-virtual-service

vCluster replicates the service in the virtual cluster, with the virtual cluster service pointing to the service running in the host cluster. Pods inside the virtual cluster can access the host service using my-virtual-service.my-virtual-namespace syntax. For example, if you use cURL, the command is curl http://my-virtual-service.my-virtual-namespace.

Virtual cluster to host cluster​

You can also map a virtual cluster service to a host cluster service. This is especially useful if you want to expose an application that runs inside the virtual cluster to other workloads running in the host cluster, which makes it easier to share services across vCluster instances.

In this example, you map the virtual service my-virtual-service in the namespace my-virtual-namespace to the host namespace service my-host-service

replicateServices:
toHost:
- from: my-virtual-namespace/my-virtual-service
to: my-host-service

With this configuration, vCluster manages a service called my-host-service inside the namespace where the vCluster workloads are synced, which points to the virtual service my-virtual-service in namespace my-virtual-namespace inside the virtual cluster. Pods in the host cluster are able to access the virtual service by calling the host service. If you use cURL, the command based on the preceding example is curl http://my-host-service.

Config reference​

replicateServices required object pro​

ReplicateServices allows replicating services from the host within the virtual cluster or the other way around.

toHost required object[] pro​

ToHost defines the services that should get synced from virtual cluster to the host cluster. If services are synced to a different namespace than the virtual cluster is in, additional permissions for the other namespace are required.

from required string pro​

From is the service that should get synced. Can be either in the form name or namespace/name.

to required string pro​

To is the target service that it should get synced to. Can be either in the form name or namespace/name.

fromHost required object[] pro​

FromHost defines the services that should get synced from the host to the virtual cluster.

from required string pro​

From is the service that should get synced. Can be either in the form name or namespace/name.

to required string pro​

To is the target service that it should get synced to. Can be either in the form name or namespace/name.