Skip to content

Commit

Permalink
docs: adjust en docs command format (#8613)
Browse files Browse the repository at this point in the history
  • Loading branch information
michelle-0808 authored Dec 10, 2024
1 parent 2fc571f commit ab6ce57
Show file tree
Hide file tree
Showing 108 changed files with 6,096 additions and 6,217 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,17 @@ You can connect with the database ClusterIP or domain name.

<Tabs>

<TabItem value="kbcli" label="kbcli" default>
<TabItem value="kubectl" label="kubectl" default>

To check the database endpoint, use `kubectl get service <cluster-name>-<component-name>`.

```bash
kubectl get service mycluster-mysql
```

</TabItem>

<TabItem value="kbcli" label="kbcli">

To check the database endpoint, use `kbcli cluster describe ${cluster-name}`.

Expand Down Expand Up @@ -60,16 +70,6 @@ TIME TYPE REASON OBJECT MESSAGE

</TabItem>

<TabItem value="kubectl" label="kubectl">

To check the database endpoint, use `kubectl get service <cluster-name>-<component-name>`.

```bash
kubectl get service mycluster-mysql
```

</TabItem>

</Tabs>

## Scenario 2. Client outside the Kubernetes cluster but in the same VPC as the Kubernetes cluster
Expand All @@ -84,15 +84,7 @@ The following command creates a LoadBalancer instance for the database instance,

<Tabs>

<TabItem value="kbcli" label="kbcli" default>

```bash
kbcli cluster expose ${cluster-name} --type vpc --enable=true
```

</TabItem>

<TabItem value="kubectl" label="kubectl">
<TabItem value="kubectl" label="kubectl" default>

This example uses a MySQL cluster to demonstrate how to expose a VPC address on Alibaba Cloud.

Expand All @@ -118,6 +110,14 @@ spec:
</TabItem>
<TabItem value="kbcli" label="kbcli">
```bash
kbcli cluster expose ${cluster-name} --type vpc --enable=true
```

</TabItem>

</Tabs>

To disable the LoadBalancer instance, execute the following command.
Expand All @@ -130,15 +130,7 @@ Once disabled, the instance is not accessible.

<Tabs>

<TabItem value="kbcli" label="kbcli" default>
```bash
kbcli cluster expose ${cluster-name} --type vpc --enable=false
```

</TabItem>

<TabItem value="kubectl" label="kubectl">
<TabItem value="kubectl" label="kubectl" default>

```yaml
kubectl apply -f - <<EOF
Expand All @@ -162,6 +154,14 @@ spec:
</TabItem>
<TabItem value="kbcli" label="kbcli">
```bash
kbcli cluster expose ${cluster-name} --type vpc --enable=false
```

</TabItem>

</Tabs>

## Scenario 3. Connect database with clients in other VPCs or public networks
Expand All @@ -176,15 +176,7 @@ The following command creates a LoadBalancer instance for the database instance,

<Tabs>

<TabItem value="kbcli" label="kbcli" default>
```bash
kbcli cluster expose ${cluster-name} --type internet --enable=true
```

</TabItem>

<TabItem value="kubectl" label="kubectl">
<TabItem value="kubectl" label="kubectl" default>

The example uses MySQL to demonstrate how to expose the public address on Alibaba Cloud.

Expand All @@ -210,21 +202,21 @@ spec:
</TabItem>
</Tabs>
To disable the LoadBalancer instance, execute the following command.
<Tabs>
<TabItem value="kbcli" label="kbcli" default>
<TabItem value="kbcli" label="kbcli">
```bash
kbcli cluster expose ${cluster-name} --type internet --enable=false
kbcli cluster expose ${cluster-name} --type internet --enable=true
```

</TabItem>

<TabItem value="kubectl" label="kubectl">
</Tabs>

To disable the LoadBalancer instance, execute the following command.

<Tabs>

<TabItem value="kubectl" label="kubectl" default>

```yaml
kubectl apply -f - <<EOF
Expand All @@ -248,6 +240,14 @@ spec:
</TabItem>
<TabItem value="kbcli" label="kbcli">
```bash
kbcli cluster expose ${cluster-name} --type internet --enable=false
```

</TabItem>

</Tabs>

:::note
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,8 @@ import TabItem from '@theme/TabItem';
# Connect database in testing environment

<Tabs>
<TabItem value="kbcli" label="kbcli" default>

## Option 1. Use kbcli cluster connect command

You can use the `kbcli cluster connect` command and specify the cluster name to be connected.

```bash
kbcli cluster connect ${cluster-name}
```

The lower-level command is actually `kubectl exec`. The command is functional as long as the K8s API server is accessible.

## Option 2. Connect database with CLI or SDK client

Execute the following command to get the network information of the targeted database and connect it with the printed IP address.

```bash
kbcli cluster connect --show-example --show-password ${cluster-name}
```

Information printed includes database addresses, port No., username, password. The figure below is an example of MySQL database network information.

- Address: -h specifies the server address. In the example below it is 127.0.0.1
- Port: -P specifies port No. , In the example below it is 3306.
- User: -u is the user name.
- Password: -p shows the password. In the example below, it is hQBCKZLI.

:::note

The password does not include -p.

:::

![Example](./../../img/connect_database_with_CLI_or_SDK_client.png)

</TabItem>
<TabItem value="kubectl" label="kubectl">
<TabItem value="kubectl" label="kubectl" default>

## Step 1. Retrieve Database Credentials

Expand All @@ -62,7 +27,7 @@ Before connecting to the MySQL database running inside your Kubernetes cluster,
kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.username}' | base64 -d
>
root
```
```

- Replace "mycluster" with the actual name of your database cluster.
- Replace "demo" with the actual namespace of your database cluster.
Expand Down Expand Up @@ -149,5 +114,42 @@ Here is an example of using CLI to connect to the cluster on the local host.
```

</TabItem>
</Tabs>

<TabItem value="kbcli" label="kbcli">

## Option 1. Use kbcli cluster connect command

You can use the `kbcli cluster connect` command and specify the cluster name to be connected.

```bash
kbcli cluster connect ${cluster-name}
```

The lower-level command is actually `kubectl exec`. The command is functional as long as the K8s API server is accessible.

## Option 2. Connect database with CLI or SDK client

Execute the following command to get the network information of the targeted database and connect it with the printed IP address.

```bash
kbcli cluster connect --show-example --show-password ${cluster-name}
```

Information printed includes database addresses, port No., username, password. The figure below is an example of MySQL database network information.

- Address: -h specifies the server address. In the example below it is 127.0.0.1
- Port: -P specifies port No. , In the example below it is 3306.
- User: -u is the user name.
- Password: -p shows the password. In the example below, it is `hQBCKZLI`.

:::note

The password does not include -p.

:::

![Example](./../../img/connect_database_with_CLI_or_SDK_client.png)

</TabItem>

</Tabs>
16 changes: 8 additions & 8 deletions docs/user_docs/handle-an-exception/handle-a-cluster-exception.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ When an exception occurs during your operation, you can perform the following st

<Tabs>

<TabItem value="kbcli" label="kbcli" default>
<TabItem value="kubectl" label="kubectl" default>

```bash
kbcli cluster list mycluster
```
```bash
kubectl describe cluster mycluster
```

</TabItem>

<TabItem value="kubectl" label="kubectl">
<TabItem value="kbcli" label="kbcli">

```bash
kubectl describe cluster mycluster
```
```bash
kbcli cluster list mycluster
```

</TabItem>

Expand Down
2 changes: 1 addition & 1 deletion docs/user_docs/installation/install-addons.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ For example, you can install an Addon v0.9.0 with KubeBlocks v0.9.2, but using m
helm list -A
>
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
......
...
kb-addon-es kb-system 1 2024-11-27 10:04:59.730127 +0800 CST deployed elasticsearch-0.9.0 8.8.2
```

Expand Down
Loading

0 comments on commit ab6ce57

Please sign in to comment.