Managing clusters
You can refer to the contents of this article to update cluster tokens, oversell ratios, set up territories, manage clusters using the CLI tool, or delete clusters that are no longer used in the platform.
Update the access cluster token
The cluster that you access the platform may affect your normal use of the cluster if any of the following conditions occur, and you are advised to update the token for the cluster:
-
The cluster’s token has expired;
-
The cluster’s token has been leaked and is a security risk.
Note: Updating the token of a Self-built cluster is not supported.
Prerequisites
You have generated new tokens for the clusters to be updated. For assistance, please contact our operations engineers for support.
Procedure of operation
-
In the left navigation bar, click Clusters > Cluster of clusters. 3.
-
Click the Cluster name of the access cluster for which you want to update the token. 3.
-
Click
> Update Token in the upper right corner of the Basic Information area. -
Enter the new token.
-
Click Update.
Update the overbooking ratio
The administrator sets the cluster oversale ratio with reference to the current resource requirements of CPU and memory in the cluster, which helps the administrator to limit the limit values (limit) and request values (request) of CPU and memory of containers set by the user to within a reasonable range and to improve the utilization rate of computing resources.
-
Oversale ratio: the ratio of limit values to request values (limits/requests).
-
Limits (limits): the maximum amount of resources that can be used when the container is running, the container running process, the resource usage can not exceed this value.
-
requests: the amount of resources requested by the container when it is created. when Kubernetes schedules containers, it will make a judgment based on this value, and will schedule the container to run on the node whose resource availability meets the container’s request value; if there is no node that meets the requirements (e.g., if the request value is greater than the resource availability on the node that can be scheduled), the container cannot be started normally. start normally.
Note:
-
The CPU and memory oversales ratios for clusters all default to none.
-
You can set a uniform oversale ratio at the cluster level, which is used by the namespaces in the cluster by default. You can also set different oversale ratios individually for different namespaces in the cluster, or not set an oversale ratio for a particular namespace. When you create an application, the oversale ratio set for the namespace in which it resides will prevail.
-
When you enable the oversale ratio of the cluster, when you create an application, the request value of the container is fixed to specified limit/cluster oversale ratio (or specified limit/namespace oversale ratio), and the user sets the request invalidly via YAML. If no limit value is specified, the limit value is the default value set in the container limit of the namespace.
For example: take CPU resources as an example, suppose the CPU resource oversale ratio of the cluster is set to 4, and the namespace oversale ratio adopts the default value, when the user creates an application, the CPU limit value specified is 4c, then the CPU request value is 4c/4 = 1c; suppose the CPU oversale ratio of the namespace is updated to 2 at this time, then the CPU request value of the application is 4c/2 = 2c. -
In a cluster with over-sale ratio turned on, if the over-sale ratio value is updated, it does not affect the request value of the container running under the created custom application; after the Pod is rebuilt, the request value of the container is recalculated based on the latest over-sale ratio.
-
For clusters with node virtualization turned on, if you need to configure the oversale ratio for a virtual machine, you need to turn off the oversale ratio for the cluster or namespace first.
Prerequisites
-
Clusters that are imported to the platform need to contact the Platform Manager to install the relevant components for the cluster in order to update the oversell ratio. Clusters created in the platform support updating the overselling ratio by default.
-
The cluster status is normal.
Procedure of operation
-
In the left navigation bar, click Clusters > Cluster of clusters。
-
Click Pending Update Oversale Ratio Cluster Name. 3.
-
Click Update Oversale Ratio in the upper right corner of the Basic Information area. 4.
-
Set the cluster oversell ratio for CPU and memory resources, only positive integers greater than 1 can be entered.
By default, the cluster has no oversell ratio, and the switch status is as
; click to turn on the oversale ratio switch and the status is
,Then it means that the overselling ratio can be set. -
Click Update.
Setting the region
Setting the locale on the cluster and the nodes it belongs to allows you to configure policies for cross-domain loads for business traffic. Users can plan and manage the locale based on the planning of their own data centers.
Prerequisites
You have added a locale, please refer to Add Locale for details.
Cautions.
-
global does not support setting a locale.
-
If a cluster has already set a locale, the locale of the cluster and the nodes it belongs to cannot be adjusted again.
Procedure of operation
-
In the left navigation bar, click Clusters > Cluster of clusters.
-
Click Cluster Name in the upper right corner of the Basic Information area.
-
Click Set Locale.
-
Select the Geographic region.
-
Click Setup.
Hint: After you set the region for a cluster, the nodes under it will be synchronized with the
topology.kubernetes.io/region:<region>tag, and the tagged values already stored on the node will be overwritten.
Opening the Kubectl tool
kubectl is a command-line tool for managing Kubernetes clusters. kubectl is a client of the Kubernetes API, which is an HTTP REST API that is the real Kubernetes user interface, and Kubernetes is completely controlled by this API, which means that This means that every Kubernetes operation is exposed as an API endpoint and can be executed by HTTP requests to this endpoint. Therefore, the main job of kubectl is to execute HTTP requests to the Kubernetes API, to manage the cluster, or to install and deploy containerized custom applications on the cluster.
-
For more on Kubectl, see Overview of kubectl .
-
For more information about Kubectl, see Kubectl Common Syntax Description .
-
See kubectl-commands for basic commands to run and manage workloads on a cluster (right-click on the link and select ``Store link as…’’).
Procedure of operation
-
Click Clusters > Cluster of clusters in the left navigation bar.
-
In the CLI tool interface, enter a command line that matches the Kubectl syntax to perform the relevant administrative operations.
Download kubeconfig file
A kubeconfig file is a configuration file that stores information about the connection between a client and a Kubernetes cluster, including the cluster address, authentication information, context information, and so on. See the official Kubernetes documentation Configuring Access to Multiple Clusters . ) for quick access to the Kubeconfig file.
Using kubeconfig files, you can easily manage different Kubernetes clusters and user identities, and interact with clusters on the local client. The platform supports self-built clusters and access to clusters to download kubeconfig files to meet different application scenarios of users.
Procedure of operation
-
In the left navigation bar, click Clusters > Cluster of clusters.
-
Click Cluster name. 4.
-
Click Options > Download kubeconfig file and wait a few moments for the file to download locally from your browser.
Instructions:
-
The kubeconfig file downloaded by the Platform has a default statute of limitations of 10 years.
-
Each time you download a kubeconfig file it will be different, so to invalidate any kubeconfig files you have downloaded before that time, you can run the following command:
Hint: After updating, all kubeconfig files downloaded before this will be invalidated.
`` kubectl delete sa -n cpaas-system kubeconfig
-
If you need to use the kubeconfig file for stricter permissions management, for example, if a user’s role only supports viewing Kubernetes resources, and you want kubeconfig to contain the same permissions as the user, you can configure it as follows:
-
Click Personal Information after clicking Account Information on the right side of the top navigation bar.
-
Click Add API Token, enter a description and adjust the expiration date, click Add and copy the API token.
-
Using the kubeconfig file that you downloaded from the cluster page or a manually generated kubeconfig file as a template, replace the token value in the users field with the saved API token and modify other parameters, such as the cluster server address, as shown in the following kubeconfig file example:
-
kubeconfig file example:
apiVersion: v1 clusters: - cluster: server: https://{platform-access-address}/kubernetes/{cluster-name} # Need to modify {platform-access-address} {cluster-name} insecure-skip-tls-verify: true name: direct-cluster contexts: - context: cluster: direct-cluster user: kubeconfig-user name: direct-connect current-context: direct-connect kind: Config preferences: {} users: - name: kubeconfig-user user: token: {token}Parameter Description clusters Contains configuration information for one or more clusters, each including name, service address, authentication details, etc. users Contains configuration information for one or more users, each including name, authentication details, etc. contexts Contains configuration information for one or more contexts, each including name, associated cluster and user, etc. current-context Contains information about the currently used context.
-
Managing Container Groups
At the cluster level, Platform Management personnel need to regularly manage and maintain Pods across the entire cluster, monitoring the health and status of cluster Pods in real-time:
-
View all Pods in the cluster through the cluster interface, quickly identify any Pods with abnormal statuses, and perform troubleshooting. For example, you can reschedule Pods by deleting them to ensure continuous business operation.
-
Gather statistics on Pods across the entire cluster, analyze resource utilization and usage of Pods, and drive optimization. This helps improve cluster resource utilization and performance, provide better service for businesses, and support exporting a CSV file containing a list of all Pods in the current cluster.
Procedure of Operation
-
In the left navigation bar, click Clusters > Cluster of clusters.
-
Click on the cluster name.
-
Switch to the Pods tab to filter and view Pods.
-
Click
to export a CSV file containing a list of all Pods in the current cluster.
Deleting a Cluster
Remove a Kubernetes cluster that is no longer planned to be used through this Platform Management.
Note: If the cluster is being used by projects, after deleting the cluster, the projects will no longer be able to use it. Project resources under the cluster will be retained.
Procedure of Operation
-
In the left navigation bar, click Clusters > Cluster of clusters.
-
Click on the cluster to be deleted cluster name.
-
Click on the right side of the cluster to be deleted
> Delete. -
Enter the cluster name and click Delete.