Binding a Custom Kubernetes Cluster
Before creating a component based on a container in the Kubernetes or VM + Kubernetes environment, bind a cluster to the environment.
The VM + Kubernetes environment and Kubernetes non-HA environment support custom Kubernetes clusters.
Prerequisites
- You have created an environment. For details, see:
- You have created a kubeconfig file in YAML format to bind a custom Kubernetes cluster. For details, see kubeconfig File Description.
Procedure
- Log in to ServiceStage.
- Choose Environment Management. The Environment Management page is displayed.
- Click the target environment. The Overview page is displayed.
- Choose Clusters from Compute.
- Click Bind now.
- Select Custom Kubernetes cluster for Cluster Source.
- Enter a cluster name.
Enter 2 to 64 case-sensitive characters. Start with a letter and end with a letter or digit. Only use letters, digits, underscores (_), and hyphens (-).
- Click Import YAML File to import the kubeconfig file in YAML format.
- Click OK.
Follow-up Operations
- On the Overview page, you can edit the custom Kubernetes cluster bound to a Kubernetes non-HA environment or a VM+Kubernetes environment by referring to Editing a Bound Custom Kubernetes Cluster.
- If the cluster bound to the environment is no longer used, unbind the cluster by referring to Unbinding a Cluster.
kubeconfig File Description
Only use the kubeconfig file from reliable sources to prevent malicious code execution or file exposure.
It is a common way to manage a native Kubernetes cluster using the kubeconfig file. The kubeconfig file contains the configuration information required for the client to communicate with the Kubernetes cluster, including the cluster information, user authentication information, and context information.
Example kubeconfig file structure:
apiVersion: v1 kind: Config preferences: {} current-context: dev-context clusters: - name: my-cluster cluster: server: https://api.example.com:6443 certificate-authority-data: LS0tLS1CRUd... # Base64-encoded CA certificate users: - name: admin-user user: client-certificate-data: LS0tLS1CRUd... # Base64-encoded client certificate client-key-data: LS0tLS1CRUd... # Base64-encoded client private key contexts: - name: dev-context context: cluster: my-cluster user: admin-user namespace: default
For details, see Table 1.
Parameter |
Mandatory |
Type |
Description |
Example Value |
---|---|---|---|---|
apiVersion |
Yes |
String |
API version of the kubeconfig file. |
v1 |
kind |
Yes |
String |
Resource type of the kubeconfig file. The value is fixed at Config. |
Config |
preferences |
No |
Object |
User preference settings (such as the output format and color). |
{} |
current-context |
No |
String |
Name of the current context. |
dev-context |
clusters |
Yes |
Array of objects |
Cluster list, which defines the cluster address and authentication information. For details, see Table 2. |
- |
users |
Yes |
Array of objects |
User list, which defines the user authentication mode (such as certificate, token, username and password, and plug-in). For details, see Table 4. |
- |
contexts |
Yes |
Array |
Context list, which associates clusters, users, and default namespaces. For details, see Table 6. |
- |
Parameter |
Mandatory |
Type |
Detail |
Example Value |
---|---|---|---|---|
name |
Yes |
String |
Unique cluster name. |
my-cluster |
cluster |
Yes |
Array |
Cluster connection information. For details, see Table 3. |
- |
Parameter |
Mandatory |
Type |
Detail |
Example Value |
---|---|---|---|---|
server |
Yes |
String |
API server address of the cluster, which must contain the protocol and port number and can be accessed from the public network. |
https://api.example.com:6443 |
certificate-authority |
No |
String |
Path of the CA certificate file. Either this parameter or certificate-authority-data must be specified. |
etc/kubernetes/pki/ca.crt |
certificate-authority-data |
No |
String |
Base64-encoded CA certificate data. Either this parameter or certificate-authority must be specified. |
LS0tLS1CRUd... |
insecure-skip-tls-verify |
No |
Boolean |
Whether to skip TLS verification. This parameter is used only in the test environment. |
false |
Parameter |
Mandatory |
Type |
Detail |
Example Value |
---|---|---|---|---|
name |
Yes |
String |
Unique user name (customized). |
admin-user |
user |
No |
Array of objects |
Defines the credential and mode for user identity authentication. Multiple authentication mechanisms (such as certificates, tokens, and dynamic plug-ins) are supported. For details, see Table 5. |
- |
Parameter |
Mandatory |
Type |
Detail |
Example Value |
---|---|---|---|---|
client-certificate |
No |
String |
Path of the client certificate file. Either this parameter or client-certificate-data must be specified. |
/path/to/client.crt |
client-certificate-data |
No |
String |
Base64-encoded client certificate data. Either this parameter or client-certificate must be specified. |
LS0tLS1CRUd... |
client-key |
No |
String |
Path of the client private key file. Either this parameter or client-key-data must be specified. |
/path/to/client.key |
client-key-data |
No |
String |
Base64-encoded client private key data. Either this parameter or client-key must be specified. |
LS0tLS1CRUd... |
token |
No |
String |
Static token (bearer token authentication) |
eyJhbGciOiJSUzI1NiIsIm... |
username |
No |
String |
Basic authentication username. |
admin |
password |
No |
String |
Basic authentication password. |
secret |
Parameter |
Mandatory |
Type |
Detail |
Example Value |
---|---|---|---|---|
name |
Yes |
String |
Unique name of the context (customized). |
dev-context |
context |
Yes |
Array |
Binds a cluster, user, and namespace to define a specific operating environment. You can switch between different contexts to quickly switch between different clusters, users, or namespaces. For details, see Table 7. |
- |
Parameter |
Mandatory |
Type |
Detail |
Example Value |
---|---|---|---|---|
cluster |
Yes |
String |
Name of the associated cluster. The value must be the same as name in Table 2. |
my-cluster |
user |
Yes |
String |
Name of the associated user. The value must be the same as name in Table 4. |
admin-user |
namespace |
No |
String |
Default namespace. If this parameter is not specified, default is used. |
default |
Editing a Bound Custom Kubernetes Cluster
- Log in to ServiceStage.
- Choose Environment Management. The Environment Management page is displayed.
- Click the target environment. The Overview page is displayed.
- Choose Clusters from Compute.
- Click Edit Cluster.
- Change the Cluster Name.
Enter 2 to 64 case-sensitive characters. Start with a letter and end with a letter or digit. Only use letters, digits, underscores (_), and hyphens (-).
- Click Import YAML File to import the kubeconfig file in YAML format.
- Click OK.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot