跳到主要内容

Kubeconfig

Cloud ZCP provides the functionality to create and manage Service Account Tokens that map the Kubernetes cluster permissions assigned to the user across all projects. This includes the ability to generate and download a kubeconfig file for use with the kubectl CLI tool to interact with Kubernetes clusters.

To start, navigate to the CLI Command in the menu under your User Profile.

The kubectl CLI tool is essential for communicating with the Kubernetes API server to manage resources within your cluster. To use kubectl, you need a kubeconfig file, which contains the necessary credentials and configuration for accessing the cluster.

Figure 1: CLI Command Screen

Step 1: Click the go to link… button to install the kubectl CLI tool on your local machine.

Step 2: You will see a list of all clusters assigned to the projects the logged-in user belongs to. From this list, select the Kubernetes cluster for which you want to download the kubeconfig. You can remove any cluster from the list by clicking the x button next to it.

Step 3: The corresponding kubeconfig content for the selected cluster will be displayed in the editor.

  • To copy the kubeconfig contents to your clipboard, click the Copy button.
  • To download the kubeconfig file to your local desktop, click the Download button.

Step 4: Once you've downloaded the kubeconfig file, you need to set the environment variable for your system:

  • Windows environment:
set KUBECONFIG = {down path}₩{filename.conf}
  • Linux / macOS environment:
$ export KUBECONFIG = {down path}/{filename.conf}

With this configuration set, you are now ready to use kubectl to manage your Kubernetes cluster.