A machine-readable index of this documentation for AI agents is available at https://kubevela.io/llms.txt. Markdown versions of documentation pages are available by appending .md to their URLs.
Skip to main content
Version: Cluster Gateway Next

Introduction

Cluster Gateway gives a hub cluster a single Kubernetes API for reaching its member clusters. It is an aggregated API server: it registers the cluster.core.oam.dev/v1alpha1 API group with the hub's kube-apiserver, and any request sent to a cluster's proxy subresource is passed on to that cluster's kube-apiserver with the credential the hub holds for it.

It has no etcd and stores nothing. Each cluster is a Secret on the hub, and the gateway builds the ClusterGateway object from that Secret every time it is read. Adding a cluster is creating a Secret; removing it is deleting one.

# Any kubectl command, against the member cluster "prod", with your hub credentials
HUB=$(kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}')
kubectl --server "$HUB/apis/cluster.core.oam.dev/v1alpha1/clustergateways/prod/proxy" get pods -A

Who it's for​

  • KubeVela users. KubeVela installs the gateway as part of vela-core and reaches every managed cluster through it. You rarely touch it directly, but when a cluster won't connect, this is the layer to look at.
  • Platform teams running a hub. On its own, without KubeVela, it puts one hub endpoint in front of several clusters: hub RBAC decides who may reach which cluster, and the member clusters' credentials never leave the hub.
  • Controller authors. A controller on the hub can talk to any member cluster with an ordinary client-go or controller-runtime client, by routing its requests through the gateway: see Go client.

How it relates to KubeVela​

The vela-core chart installs Cluster Gateway beside the controller, with multicluster.enabled on by default. From there:

  • vela cluster join writes the cluster Secret into vela-system, the namespace the gateway reads.
  • The controller sends every request for a managed cluster to the gateway's proxy path. By default it calls the gateway's Service directly instead of going through the hub's kube-apiserver (the chart's multicluster.clusterGateway.direct).
  • vela-core creates and renews the gateway's serving certificate and writes its CA into the APIService.
  • With authentication.enabled, the chart turns on ClientIdentityPenetration, so resources reach managed clusters as the user who owns the Application while authentication.withUser is on (the default), and as authentication.defaultUser when it's off. VelaUX's requests (the kubevela:ux group) are the exception: the gateway exchanges them for the cluster's registered credential.

How to use multiple clusters from KubeVela lives in the KubeVela docs:

These pages describe Cluster Gateway 1.10.0-alpha.1, the version KubeVela 1.12 ships. Versions lists the version each KubeVela release ships and what changed between them.

Where next​

The source is oam-dev/cluster-gateway.