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

Cluster Secrets

Cluster Gateway has no store of its own. A cluster is a Secret on the hub, in the namespace the gateway reads (--secret-namespace), and a ClusterGateway is that Secret read back through the gateway's API. The Secret's name is the cluster's name.

Installed withSecret namespace
The standalone chartopen-cluster-management-credentials
KubeVelavela-system, written by vela cluster join

What the gateway reads​

FieldKeyWhat it holds
Labelcluster.core.oam.dev/cluster-credential-typeRequired. X509Certificate, ServiceAccountToken or Dynamic. A Secret without it is not a cluster: it's left out of the list, and reads of it return NotFound.
Labelcluster.core.oam.dev/cluster-endpoint-typeConst (the default) or ClusterProxy, for clusters reached through OCM's cluster-proxy.
DataendpointRequired for Const. The member cluster's kube-apiserver URL, as the gateway's pods can reach it.
Dataca.crt (or ca)The CA that signed the member's serving certificate. Leave it out and the gateway skips TLS verification.
Datatls.crt, tls.keyThe client certificate and key, for X509Certificate.
DatatokenThe bearer token, for ServiceAccountToken.
DataexecA kubeconfig exec configuration as JSON, for Dynamic.
Dataproxy-urlAn HTTP or SOCKS5 proxy to reach the member cluster through.
Annotationcluster.core.oam.dev/cluster-gateway-proxy-configurationPer-cluster identity exchange rules, with ClientIdentityPenetration on.
Annotationstatus.cluster.core.oam.dev/healthy, status.cluster.core.oam.dev/healthy-reasonThe health status, with HealthinessCheck on. The gateway shows it; something else writes it.
Annotationcluster.core.oam.dev/cluster-aliasThe alias shown by virtualclusters.

The endpoint is dialled from inside the gateway's pod, so it must be an address the hub's pod network can reach. https://127.0.0.1:6443 from your laptop's kubeconfig is the gateway's own pod.

The Secret's type doesn't matter to the gateway: Opaque is the usual choice.

The three credential types​

TypeThe gateway sendsFits
ServiceAccountTokenAuthorization: Bearer <token>A ServiceAccount on the member with a long-lived token. The most common choice, and what vela cluster join writes for a token kubeconfig.
X509CertificateA client certificateAn admin kubeconfig with client certificate data, such as the one k3d, kind or kubeadm give you.
DynamicWhatever the exec command prints: a token, or a certificate and keyShort-lived credentials from a command, the way kubectl runs a kubeconfig exec plugin. The command runs inside the gateway's container.

How to write each one is in Register Clusters.

When a change takes effect​

With the SecretCache feature gate on, which is the default, the gateway watches the Secret namespace and reads Secrets from that cache, so a new, changed or deleted Secret takes effect as soon as the watch delivers it. With the gate off, it reads the Secret from the hub on every request. Either way there is nothing to restart.

A Dynamic credential is the exception: the gateway caches the credential the command prints until a minute before its expirationTimestamp, and each gateway replica keeps its own cache. A credential with no expirationTimestamp isn't cached: the command runs on every request.

Who can read a cluster's credential​

Anyone who can read the Secret has the cluster's credential, and so does anyone who can get the ClusterGateway: the object carries the endpoint and the credential in spec.access. Treat get and list on clustergateways like get on Secrets in the Secret namespace, and give hub users clustergateways/proxy instead, which uses the credential without showing it.

With OCM​

With --ocm-integration, the gateway takes each cluster's endpoint and CA from the OCM ManagedCluster of the same name, and lists only clusters that have one. The Secret still holds the credential. The OCM Cluster-Gateway Manager addon sets this up for clusters registered with Open Cluster Management.