Other Operations
Obtaining KubeConfig
If the KubeConfig file of a third-party cluster cannot be directly exported, perform the following operations to obtain the KubeConfig file that can be used in MCP.
- (Optional) Configure kubectl.
If kubectl can be properly executed in the cluster, skip this step.
which kubectl
Obtain the absolute path of the kubectl file xxx/kubectl, and the path of the KubeConfig file yyy/config.alias kubectl='xxx/kubectl --kubeconfig=yyy/config'
- Create the my-user-sa.yaml, my-user-role.yaml and my-user-role-binding.yaml files. my-user-role.yaml:
apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: my-user-role rules: - apiGroups: - '*' resources: - '*' verbs: - '*' - nonResourceURLs: - '*' verbs: - get
my-user-role-binding.yaml:
apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: my-user-role-binding subjects: - kind: ServiceAccount name: my-user namespace: default roleRef: kind: ClusterRole name: my-user-role apiGroup: rbac.authorization.k8s.iomy-user-sa.yaml:
apiVersion: v1 kind: ServiceAccount metadata: name: my-user
- Run the following commands on the managed cluster:
kubectl apply -f my-user-sa.yaml kubectl apply -f my-user-role.yaml kubectl apply -f my-user-role-binding.yaml
- Run the following command to obtain the token:
kubectl get secret -n default `kubectl get secret -n default | grep my-user | awk '{print $1}'` -oyaml | grep token: | awk '{print $2}' | base64 -d - Configure the KubeConfig file.
In the kubeconfig.json file, replace the value of the server parameter with that in the yyy/config file obtained in 1, and the value of the token parameter with the value obtained in 4.
kubeconfig.json:
kind: Config apiVersion: v1 preferences: {} clusters: - name: internalCluster cluster: server: 'https://119.xxx.xxx.xxx:5443' insecure-skip-tls-verify: true users: - name: user user: token: 'MIIFbAYJKo*****' contexts: - name: internal context: cluster: internalCluster user: user current-context: internal - Use the KubeConfig file configured in 5 to add the cluster. After the cluster is added, you can delete the ClusterRole, ClusterRoleBinding, and ServiceAccount created in 3.
Upgrading MCP
After MCP of a new version is released, you can upgrade the MCP components.
- Log in to the MCP console.
- Move the cursor to MCP and click Upgrade.
You can also upgrade MCP by choosing More > Upgrade MCP in the upper right corner of the Dashboard page.
Renewing MCP
If the billing mode is set to Yearly/Monthly for MCP, you can renew MCP as follows:
- Log in to the MCP console whose billing mode is Yearly/Monthly.
- On the Dashboard page, choose More > Renew MCP.
- On the page displayed, set renewal parameters.
- Renew on the standard renewal date: You can change the date by clicking Modify.
- Select the renewal duration.
If you change the billing mode of MCP from yearly/monthly to pay-per-use before a renewal period takes effect, you can only unsubscribe from the MCP instance but not cancel the renewal.
- Click Pay Now. After the payment is complete, the renewal is successful.
Unsubscribing from MCP
If the billing mode is set to Yearly/Monthly for MCP, you can unsubscribe from MCP.
- Log in to the MCP console.
- On the Dashboard page, choose More > Unsubscribe MCP.
- On the page displayed, select the unsubscription reason and click Unsubscribe.
After a yearly/monthly subscription expires, the resource status changes to Expired or Frozen. You can renew or release the resource.
Changing the Billing Mode
If you want to change the billing mode from pay-per-use to yearly/monthly, perform the following steps:
- Log in to the MCP console whose billing mode is Pay-per-use.
- On the Dashboard page, click Change Billing Mode. Perform operations as prompted.
You can also change the billing mode from yearly/monthly to pay-per-use. For details, see From Yearly/Monthly to Pay-per-Use.
Deleting a Cluster from MCP
This operation only deletes the cluster from MCP, but does not delete the cluster itself and compute resources in the cluster.
- Log in to the MCP console. In the navigation pane, choose Resource Management > Cluster Management.
- In the cluster list, locate the row that contains the target cluster, click Delete in the Operation column, and delete the cluster as prompted.
Deleting an MCP
Deleting an MCP does not delete the clusters under the MCP.
- Log in to the MCP console. In the navigation pane, choose Dashboard.
- Choose More > Delete MCP and delete MCP as prompted.
If the billing mode is Yearly/Monthly, MCP cannot be deleted after being created. To stop using MCP, unsubscribe from it.
Last Article: Accessing MCP by Using kubectl
Next Article: Network Management
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.