KubeConfig stores the cluster address and authentication information required to access a CKS cluster. After obtaining and configuring KubeConfig, you can use kubectl to connect to the cluster from a local terminal or O&M environment.
When KubeConfig Is Required
KubeConfig tells kubectl which cluster to connect to and which identity to use to access the cluster. Common uses include:
- Use kubectl to view and manage cluster resources.
- Provide access credentials for O&M scripts or automated workflows that need to connect to the cluster.
KubeConfig is an access credential. Do not commit it to public repositories or public documents, and do not share it with unauthorized personnel.
Select a Retrieval Method
Before you begin, log in to the GPU Cloud console and go to the Clusters page.
Obtain from the cluster workspace
-
Click the target cluster name to go to the cluster workspace.
-
In the left navigation pane, go to the Permissions page.
-
Switch to the KubeConfig Manage tab.
-
Locate the target user, then generate or view the KubeConfig as needed.
Obtain from cluster details
-
On the Clusters page, locate the target cluster and click Details.
-
Switch to the Connect Info tab.
-
Under Access Method, select Intranet Access or Public Access.
-
Click Copy to copy the KubeConfig content, or click the download icon to download the configuration file.
Before using KubeConfig, install kubectl in the access environment.
Save the KubeConfig content to $HOME/.kube/config, then run the following command to confirm that kubectl can read the cluster nodes:
If the configuration file is saved in another path, use --kubeconfig to specify the file:
Renew KubeConfig
When a KubeConfig is nearing expiration and still needs to be used, you can extend its validity period before it expires to prevent clients, O&M scripts, or automated workflows that rely on the credential from being unable to access the cluster due to credential expiration.
-
On the Permissions page, under the KubeConfig Manage tab, locate the KubeConfig that needs to be renewed.
-
In the Actions column, click Renew.
-
In the dialog box that appears, select the number of renewal days.
-
Click OK.
-
Return to the KubeConfig Manage tab and confirm that the KubeConfig expiration time has been updated.
Stop Using KubeConfig
After the KubeConfig is deleted, clients using it will no longer be able to access the cluster. Before deleting it, confirm that no automated tasks, O&M scripts, or business processes are still using these credentials.
-
On the Permissions page, under the KubeConfig Manage tab, locate the target KubeConfig.
-
Click Delete and confirm as prompted.