Files
Davanum Srinivas bf25577b9f feat(controller): accept controlPlaneEndpoint on cluster create (#2515)
* refactor(controller): ask one cluster method at each control-plane endpoint gate

Each gate that scales, upgrades or replaces control-plane nodes tested
the control-plane VIP for an empty string by itself. The gates now call
db.Cluster.HasStableControlPlaneEndpoint, which is true when the cluster
has a VIP.

The gates are the count check at create and scale, the upgrade and
rollout checks of the cluster API, the node delete guard, the
control-plane controller (recycling, remediation, rebalance, stuck
pending nodes) and the node pool controller (surge, NodeSet
replacement).

No behavior changes. A later change adds a second kind of stable
endpoint to the method.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* feat(controller): add controlPlaneEndpoint to the cluster API schema

A cluster can name an API server endpoint that NVKE does not manage,
for example a load balancer in front of the API servers. The create
request gets the optional object controlPlaneEndpoint. Its type says
who manages the endpoint, and the block named after the type carries
what that type needs. This change has one type, External, with a host
and an optional port in the external block. The port defaults to 6443.
The cluster response returns the type and the resolved host and port.
The update request has no such property, so the value is fixed at
creation.

The shape is the one of the proposal for a load balancer as the
control plane endpoint, and this change is its first part. The enum
of the type has only External. The other types of the proposal come
later. A new enum value passes the API compatibility check, and a
removed one does not, so the enum lists only what the code does.

The existing descriptions change only where the new field makes them
wrong or incomplete:

- The overview of the Clusters tag and the description of
  controlPlaneVIP say which address is the API server endpoint.
- Seven sentences that say an operation requires controlPlaneVIP now
  name both fields. Each is one changed line.
- The 400 list of the create operation gets the new reasons.
- The desiredNodeCount descriptions of the two node pool requests lose
  their sentence about control-plane pools. The node pool handlers
  refuse each create and each update of a control-plane node pool, so
  no request reaches a rule on that count.

This change is only api/openapi.yaml and the code that make generate
writes from it (models.gen.go, server.gen.go). The handler does not
read the field yet. The next changes store it, check it and use it.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* feat(controller): store controlPlaneEndpoint in the clusters table

The clusters table gets three nullable columns for the API server
endpoint that a cluster was created with: control_plane_endpoint_type,
control_plane_endpoint_host and control_plane_endpoint_port. db.Cluster
gets the fields ControlPlaneEndpointType, ControlPlaneEndpointHost and
ControlPlaneEndpointPort. The type says who manages the endpoint. The
one type is External, an endpoint that NVKE does not manage. The host
and the port are the resolved endpoint.

A cluster without the field stores NULL in the three columns, which is
what each existing row has after the migration. An empty type marks
such a row. control_plane_vip does not change.

No handler writes the fields yet and no workflow reads them. The test
proves that the values come back from a read and stay in the row
through an update of the cluster.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* feat(controller): count controlPlaneEndpoint as a stable endpoint at each gate

db.Cluster.HasStableControlPlaneEndpoint is now true for a cluster with
an endpoint of the type External, as it is for one with a VIP. Each
gate that scales, upgrades or replaces control-plane nodes asks this
method, so the one line opens them all: scale-up, upgrade and rollout
in the cluster API, node delete, recycling, remediation, rebalance,
stuck pending nodes, surge and NodeSet replacement.

The method reads the stored type and not the host. An empty type is a
cluster without the field, and a type that this controller does not
know is no stable endpoint.

The tests run each gate with such a cluster. Recycling, remediation,
rebalance and stuck pending nodes share one check,
controlPlaneReplacementBlocked, which gets its own test.

The 400 messages and the log warnings of the gates keep their text.
Each of them is given only for a cluster with no VIP and no
controlPlaneEndpoint. allowControlPlaneWithoutVIP keeps its meaning
and its default.

No cluster has the field yet, because the create request does not
store it. A later change adds that, with the count check at create.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* feat(controller): check controlPlaneEndpoint on cluster create

The create request is now rejected with 400 when it has both
controlPlaneEndpoint and controlPlaneVIP, when the type is not
External, when the type External has no external block, and when the
host or the port is not valid.

The host is a DNS name or an IPv4 address. A DNS name is lowercase,
has at most 253 characters, no trailing dot and no wildcard. An IPv4
address must be unicast, not loopback and not link-local, and outside
the pod and service CIDRs. The port is a number from 1 to 65535, and
6443 when the request has none.

A host of only digits and dots must be a valid IPv4 address, so that
a mistyped address does not pass as a DNS name and skip the address
rules. A DNS name is not checked against the CIDRs, because NVKE
cannot tell which addresses it resolves to. The host is not trimmed.
NVKE does not resolve or dial the endpoint.

The CIDR rule of controlPlaneVIP moves into a helper that both fields
use. Its messages keep their text, and the checks of controlPlaneVIP
do not change.

The checks come before the change that stores the value, so that no
commit stores a value without them.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* feat(controller): use controlPlaneEndpoint for kubeadm init

kubeadm init now takes its controlPlaneEndpoint from one function,
kubeadmControlPlaneEndpoint. For a cluster with an external endpoint
the value is host:port. Without one it is the kube-vip VIP, then the
IP of the initializing node, as before. The value goes into the
ClusterConfiguration and into the request to the node agent, as
before.

NVKE also names the host of an external endpoint in
apiServer.certSANs of the ClusterConfiguration. kubeadm adds the host
of its controlPlaneEndpoint to the API server certificate by itself.
The explicit entry keeps certificate renewal and control-plane joins
correct if that default changes. A cluster without an external
endpoint gets no certSANs entry, so its configuration does not change.

The step fails for a cluster row with an endpoint type that this
controller does not know, and for an external endpoint with no host
or no port. The address goes into each certificate and each
kubeconfig of the cluster, so the step does not guess.

The kube-vip step needs no change and gets no check for the new field.
It returns with no action for a cluster without a VIP, and a cluster
with a controlPlaneEndpoint has no VIP: the create request refuses the
two fields together, and no other request writes either of them to the
cluster row. One test keeps this true: for such a cluster the step
makes no kube-vip call and runs no script on the node.

Each later step reads the endpoint back from what kubeadm wrote: the
join string, admin.conf and the Cluster API endpoint. They need no
change.

No cluster has the field yet. The next change makes the create request
store it.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* feat(controller): accept controlPlaneEndpoint on cluster create

The create request now stores controlPlaneEndpoint in the cluster row:
the type, the host and the resolved port, which is 6443 when the
request names none. The cluster response returns the type and the
resolved host and port. The response leaves the field out when the
cluster has none.

The count check at create asks HasStableControlPlaneEndpoint of the
fields that the request would store. So a request with an external
endpoint can ask for more than one control-plane node, as one with a
VIP can.

The tests go through the service and through the HTTP handler with the
OpenAPI validator: at each level requests that are accepted and
requests that are refused, then the bounds that only the schema
checks, and a PATCH with the field, which the schema refuses. One test
checks the JSON form of the field in the response. The full table of
refused values is in the test of the check itself.

This change comes after each part that reads the value, so that no
cluster can have the field before kubeadm init uses it.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* docs: describe controlPlaneEndpoint for workload clusters

The pages that state the VIP rule now name controlPlaneEndpoint as the
second way to give a cluster a stable API address: the cluster spec
table and the count rule in the create guide, the API address in the
two access pages, the upgrade rule in the supported platforms, and the
installation plan.

The create guide shows the object with the type External, its host
and its port, and says what the response returns. It says what the
endpoint must do before the request, and that NVKE does not resolve
or call the endpoint when it accepts the request. The access page
says that NVKE does not take a node out of the endpoint before it
restarts the API server or etcd there, so the health check of the
endpoint must do it.

The pages come after the change that stores the value, so that each
sentence is true when it is added.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* fix(controller): reject a DNS label over 63 characters in controlPlaneEndpoint

The host check of an external control plane endpoint used
IsDNS1123Subdomain, which checks the whole length and the form of a DNS
name and not the length of each label. So a name with a label of 64
characters passed the check, and DNS has no such name.

The check now also rejects a label of more than 63 characters. The text
of the field in the spec says so, and the generated code follows it.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* docs: say that an endpoint health check acts after the failure

The access page said that the endpoint must stop traffic to a node
through its own health check. A health check sees a failure only after
it happens, so a call can fail between the restart of the API server or
of etcd and that check. The page says so now.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

---------

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
2026-11-30 20:27:49 -05:00

14 KiB

Access a workload cluster

This page describes how to get the admin kubeconfig for a workload cluster, give the customer access to the cluster, and connect to its Kubernetes API with kubectl. The operator does this after the cluster is provisioned, as described in Create a workload cluster. If you are the customer and you already have a kubeconfig, start at Connect with kubectl.

Before you begin

  • You have completed Create a workload cluster, and nvkectl get clusters <WORKLOAD_CLUSTER> shows the cluster with status Provisioned.
  • The operator has configured nvkectl for the management plane with nvkectl config set-site, as described in Install the management plane. nvkectl get kubeconfig reads a Secret on the management cluster with the kubeconfig given to set-site --kubeconfig, which must allow get on Secrets in the nvke-system namespace. The management cluster's admin kubeconfig, <CLUSTER_NAME>.kubeconfig, allows it. The OIDC kubeconfig from Secure the NVKE API does not, because the bootstrap does not configure the management cluster's Kubernetes API server to accept tokens from your identity provider; with API authentication on, use the kubectl alternative in step 1.
  • The machine where you run kubectl has a network route to the cluster's Kubernetes API address on port 6443, or on the port of controlPlaneEndpoint if the cluster was created with one that names another port. See How clients reach the Kubernetes API.
  • kubectl is installed on that machine.

Get the admin kubeconfig

The operator runs these steps.

  1. Download the admin kubeconfig.

    nvkectl get kubeconfig <WORKLOAD_CLUSTER> --output-file <WORKLOAD_CLUSTER>.kubeconfig
    

    <WORKLOAD_CLUSTER> is the cluster's name as nvkectl get clusters lists it. The command prints kubeconfig written to <WORKLOAD_CLUSTER>.kubeconfig and creates the file readable only by you. Without --output-file, it prints the kubeconfig to standard output.

    nvkectl reads the kubeconfig from the value key of the <WORKLOAD_CLUSTER>-admin-kubeconfig Secret in the nvke-system namespace of the management cluster. NVIDIA Kubernetes Engine (NVKE) publishes that Secret once a control-plane node has joined. If the command reports that the Secret is not found, check the cluster name, or wait for the cluster to finish provisioning. If it reports that it is not allowed to read the Secret, use a management-cluster kubeconfig with get on Secrets in nvke-system.

    If nvkectl uses an OIDC kubeconfig because API authentication is on, read the same Secret with kubectl and the management cluster's admin kubeconfig instead:

    (
      set -euo pipefail
      tmp="$(mktemp <WORKLOAD_CLUSTER>.kubeconfig.XXXXXX)"
      trap 'rm -f "$tmp"' EXIT
      kubectl --kubeconfig <CLUSTER_NAME>.kubeconfig -n nvke-system get secret <WORKLOAD_CLUSTER>-admin-kubeconfig -o jsonpath='{.data.value}' | base64 -d > "$tmp"
      test -s "$tmp"
      chmod 600 "$tmp"
      mv "$tmp" <WORKLOAD_CLUSTER>.kubeconfig
    )
    

    <CLUSTER_NAME> is the management cluster's name. The commands decode the kubeconfig into a temporary file readable only by you, and replace <WORKLOAD_CLUSTER>.kubeconfig only when kubectl and the decode succeed and the result is not empty. On any failure they print the error, delete the temporary file and leave an existing <WORKLOAD_CLUSTER>.kubeconfig unchanged.

  2. Check the API address the kubeconfig uses.

    kubectl --kubeconfig <WORKLOAD_CLUSTER>.kubeconfig config view --minify -o jsonpath='{.clusters[0].cluster.server}'
    

    The output is https://<API_ADDRESS>:6443, where <API_ADDRESS> is the cluster's controlPlaneVIP, or the first control-plane node's IP address if the cluster has no virtual IP address (VIP). For a cluster created with controlPlaneEndpoint, the output names the host of that endpoint and its port, which is 6443 unless external.port names another port.

  3. Confirm that the kubeconfig works.

    kubectl --kubeconfig <WORKLOAD_CLUSTER>.kubeconfig get nodes
    

    The nodes that have joined the cluster are listed. Other nodes can still be joining after the cluster reaches Provisioned. If the command times out, your machine has no route to <API_ADDRESS>; the download in step 1 only proves access to the management cluster.

The kubeconfig is a secret. It holds a client certificate and private key for the user nvke:breakglass:<WORKLOAD_CLUSTER> in the group nvke:breakglass, which is bound to cluster-admin on the workload cluster. Anyone who holds the file and reaches the API address has full control of the cluster. Do not commit it to a repository, paste it into a ticket, or give it to an application.

Give the customer access

NVKE gives one credential for a workload cluster: the admin kubeconfig. The kubeconfig authenticates its holder, but it does not make the private API address reachable. For direct access, send the customer the file through a channel you trust for passwords, and tell them the API address from step 2 so they can arrange a network route to it. If giving the customer that route is not appropriate, the operator can provide an access proxy instead.

You cannot revoke a copy you hand over. It stays valid until its certificate expires, because the cluster's certificate authority is not rotated. Hand it over only to the people who administer the cluster for the customer, and have them create narrower credentials for everyone else, as described in What the customer manages.

enableOidc, described in Create a workload cluster, does not connect the customer's identity provider. It makes the cluster's API server accept OpenID Connect (OIDC) tokens from the single issuer configured for the management plane, which the management plane and the Cluster API controllers use to reach the cluster. The admin kubeconfig is still published with OIDC on, and it is still how the customer gets access. NVKE does not issue per-user credentials to customers; see Preview status and known limitations.

A fleet-wide OIDC provider, described in Configure OIDC for workload clusters, makes the API server of every cluster created afterward accept tokens from an identity provider you choose. It is the same for every such cluster, and NVKE binds no roles to its users and groups: the customer's administrators bind them with the admin kubeconfig.

Connect with kubectl

For direct access, the customer runs these steps with the kubeconfig the operator sent.

  1. Store the kubeconfig where only you can read it.

    chmod 600 <WORKLOAD_CLUSTER>.kubeconfig
    
  2. Check your identity on the cluster.

    kubectl --kubeconfig <WORKLOAD_CLUSTER>.kubeconfig auth whoami
    

    The output shows the username nvke:breakglass:<WORKLOAD_CLUSTER> and the group nvke:breakglass.

  3. List the nodes.

    kubectl --kubeconfig <WORKLOAD_CLUSTER>.kubeconfig get nodes
    

    The nodes that have joined the cluster are listed with status Ready. If the command times out, ask your operator how your network reaches the cluster's API address.

Every NVKE workload cluster's admin kubeconfig uses the cluster name cluster and the context nvke-breakglass. If you hold kubeconfigs for more than one cluster, pass each file with --kubeconfig instead of merging them, or rename the cluster and context entries when you merge.

What the customer manages

The customer owns what runs in the cluster: workloads, their images, namespaces, application secrets, and role-based access control (RBAC) for their own users within the limits the operator sets. The admin kubeconfig has cluster-admin, so NVKE does not enforce those limits inside the cluster; agree them with the customer.

To give their own users and automation access, the customer creates Kubernetes identities, such as ServiceAccounts with tokens from kubectl create token, and binds them to Roles or ClusterRoles that grant only what each needs. NVKE creates no default roles for customer users.

The operator manages the rest through the NVKE API, and the customer asks the operator for changes to it:

  • Nodes: the node count, instance type, labels, taints and Kubernetes version of each node pool. See Manage node pools.
  • The control plane, including the kube-vip static Pod that serves the API address, and the cluster's Container Network Interface (CNI) plugin and network settings.
  • On every workload cluster, the ClusterRoleBinding nvke:breakglass. It binds the group nvke:breakglass to cluster-admin, which is the access the admin kubeconfig uses. NVKE creates the binding when it is absent and does not update an existing one. Deleting it causes the next reconcile to create it again with cluster-admin. Changing its subjects leaves that change in place, so the admin kubeconfig may no longer have cluster-admin. Its roleRef cannot be changed in place; pointing it at another role means replacing the binding.
  • On clusters with OIDC turned on, the RBAC objects NVKE applies for its own access: nvke:cwe and nvke:capi-cluster-admin. Deleting or editing them blocks the management plane from operating the cluster.

How clients reach the Kubernetes API

The kubeconfig that NVKE publishes connects directly to its API address. Neither the management plane nor nvkectl proxies Kubernetes API traffic.

When the cluster has a controlPlaneVIP, every control-plane node runs kube-vip, which advertises the VIP over Border Gateway Protocol (BGP) and withdraws it when that node's API server fails its readiness check. Traffic to the VIP on port 6443 reaches a healthy control-plane node. A cluster created with controlPlaneEndpoint runs no kube-vip: the API address is the host of that endpoint, on port 6443 unless external.port names another port, and whatever you operate behind it decides which control-plane node receives the traffic. NVKE does not take a node out of that endpoint before it restarts the API server or etcd on the node. The endpoint stops sending traffic to that node only when its own health check sees the failure, so a call can fail between the restart and that check. Without a VIP or a controlPlaneEndpoint, the API address is the first control-plane node's IP address, and the API is unavailable whenever that node is.

NVKE does not create a public endpoint or an external load balancer for the API. Your network decides who can reach the API address. The management cluster must also reach it on the same port to operate the cluster.

Access through a proxy

When a customer's workstation cannot route to the private API address, the operator can provide a proxy that connects the customer to it. The proxy must be reachable from the customer's network and must either reach the API address on the port that the kubeconfig names or run a component inside the workload cluster. NVKE does not include, install or manage an access proxy. Choose and operate one that meets your network, identity, authorization and audit requirements.

Example: Teleport

Teleport Kubernetes Access is one proxy option. With this approach, the operator keeps the admin kubeconfig and customers connect with credentials issued through Teleport.

  1. From a machine that can reach the workload cluster API, follow Teleport's enrollment guide to deploy the Teleport Kubernetes Service in the workload cluster. The service must be able to reach your Teleport Proxy Service.

  2. Configure Teleport roles and matching Kubernetes RBAC by following Teleport's Kubernetes access-control guide. Grant each customer only the users, groups and resources they need.

  3. Have the customer connect through Teleport:

    tsh login --proxy=<TELEPORT_PROXY>
    
    tsh kube login <TELEPORT_KUBERNETES_CLUSTER>
    
    kubectl auth whoami
    

    <TELEPORT_PROXY> is the address of your Teleport Proxy Service. <TELEPORT_KUBERNETES_CLUSTER> is the name used when the workload cluster was enrolled. tsh kube login adds and selects a Teleport context in the customer's kubeconfig, so subsequent kubectl commands use Teleport instead of the direct API address.

Keep the kubeconfig current

The client certificate in the admin kubeconfig is valid for one year. The NVKE controller checks it each time it reconciles the cluster, about every 15 minutes. When fewer than scheduledMaintenance.certRenewal.thresholdDays remain (30 by default), the controller submits a certificate signing request named nvke-breakglass and approves it. kube-controller-manager issues the certificate, and the controller replaces the Secret with it. Renewal updates the Secret, not copies already downloaded.

To see when your copy expires, run:

kubectl --kubeconfig <WORKLOAD_CLUSTER>.kubeconfig config view --raw --minify -o jsonpath='{.users[0].user.client-certificate-data}' | base64 -d | openssl x509 -noout -enddate

In the last 30 days before that date, after the controller has reissued the certificate, the operator runs nvkectl get kubeconfig again, runs the same check on the new file to confirm a later date, and sends the customer the new file.

Verify

The customer runs:

kubectl --kubeconfig <WORKLOAD_CLUSTER>.kubeconfig auth can-i '*' '*' --all-namespaces

The output is yes.

Next steps