Skip to content

Commit

Permalink
docs: check and update part of 0.9 docs (#7507)
Browse files Browse the repository at this point in the history
  • Loading branch information
michelle-0808 authored Jun 7, 2024
1 parent 67beb9b commit 77ec530
Show file tree
Hide file tree
Showing 13 changed files with 400 additions and 389 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ sidebar_position: 2
sidebar_label: Testing environment
---

# Connect database in testing environment
# Connect database in the testing environment

## Procedure 1. Use kbcli cluster connect command
## Procedure 1. Use kubectl exec command

If the database address is not required, run the command below to connect to the cluster via the default address.

1. Get the `username` and `password` for the cluster.

Expand All @@ -22,18 +24,40 @@ sidebar_label: Testing environment
2gvztbvz
```

2. Run the `kubectl exec` command and specify the cluster name to be connected.
2. Run the `kubectl exec` command and specify the pod to be connected.

```bash
kubectl exec -ti -n demo mycluster-mysql-0 -- bash
```

The `kubectl exec` command is functional as long as the K8s API server is accessible.
3. Connect to the cluster.

```bash
mysql -u root -p2gvztbvz
```

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

You can use `kubectl exec` to connet to this cluster by following the steps in Procedure 1, and then connect to the cluster with the client you prefer.
For a pod without a client, you can follow the steps below to connect to the cluster. You can also connect to the cluster by other options, like CLI, SDK client, go connection, java connection, etc.

Below is an example of using CLI to connect to the cluster on the local host.

```bash
kubectl exec -ti -n demo mycluster-mysql-0 -- bash
```
1. Get the `username` and `password` for the cluster.

```bash
kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.\username}' | base64 -d
>
root

kubectl get secrets -n demo mycluster-conn-credential -o jsonpath='{.data.\password}' | base64 -d
>
2gvztbvz
```

2. Run the command below to connect to the cluster.

```bash
kubectl port-forward svc/mycluster-mysql 3306:3306 -n demo

mysql -h 127.0.0.1 -P 3306 -u root -p2gvztbvz
```
29 changes: 16 additions & 13 deletions docs/api_docs/installation/install-kubeblocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@ sidebar_position: 3
sidebar_label: Install KubeBlocks
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Install KubeBlocks

KubeBlocks is kubernetes-native, you can use Helm or kubectl with yaml file to install it.
KubeBlocks is Kubernetes-native, you can use Helm or kubectl with a YAML file to install it.

:::note

If you install KubeBlocks with Helm, to uninstall it, you have to use Helm too.

Make sure you have [kubectl](https://kubernetes.io/docs/tasks/tools/) and [Helm](https://helm.sh/docs/intro/install/) installed.
:::


## Environment preparation

<table>
Expand Down Expand Up @@ -49,24 +52,26 @@ Make sure you have [kubectl](https://kubernetes.io/docs/tasks/tools/) and [Helm]
## Installation steps

<Tabs>
<TabItem value="Helm" label="Install with Helm" default>

### Install with Helm
<TabItem value="Helm" label="Install with Helm" default>

Use Helm and follow the steps below to install KubeBlocks.

1. Create dependent CRDs.
1. Create dependent CRDs. Specify the version you want to install.

```bash
kubectl create -f https://github.com/apecloud/kubeblocks/releases/download/vx.x.x/kubeblocks_crds.yaml
```

2. Add Helm repo.
2. Add the KubeBlocks Helm repo.

```bash
helm repo add kubeblocks https://apecloud.github.io/helm-charts
helm repo update
```

3. Install KubeBlocks.

```bash
helm install kubeblocks kubeblocks/kubeblocks --namespace kb-system --create-namespace
```
Expand All @@ -81,7 +86,7 @@ Use Helm and follow the steps below to install KubeBlocks.

If you want to install KubeBlocks with a specified version, follow the steps below.

1. View the available versions in [KubeBlocks Release](https://github.com/apecloud/kubeblocks/releases/).
1. View the available versions in the [KubeBlocks Release](https://github.com/apecloud/kubeblocks/releases/).
2. Specify a version with `--version` and run the command below.

```bash
Expand All @@ -95,22 +100,20 @@ Use Helm and follow the steps below to install KubeBlocks.
:::

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

### Install with `kubectl`
<TabItem value="kubectl" label="Install with kubectl">

KubeBlocks can be installed like any other resource in Kubernetes, through a YAML manifest applied via `kubectl`.


Run the following command to install the latest operator manifest for this minor release:

```bash
kubectl create -f \address.yaml
```
kubectl create -f \address.yaml
```

</TabItem>
</Tabs>

</Tabs>

## Verify KubeBlocks installation

Expand Down
128 changes: 0 additions & 128 deletions docs/api_docs/installation/uninstall-kbcli-and-kubeblocks.md

This file was deleted.

54 changes: 54 additions & 0 deletions docs/api_docs/installation/uninstall-kubeblocks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
title: Uninstall KubeBlocks
description: Handle exception and uninstall KubeBlocks
keywords: [kubeblocks, exception, uninstall]
sidebar_position: 5
sidebar_label: Uninstall KubeBlocks
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Uninstall KubeBlocks

Uninstallation order:

1. Delete your cluster if you have created a cluster.

```bash
kbcli cluster delete <name>
```

2. Uninstall KubeBlocks.

## Uninstall KubeBlocks

<Tabs>

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

Delete all the clusters and resources created before performing the following command, otherwise the uninstallation may not be successful.

```bash
helm uninstall kubeblocks --namespace kb-system
```

Helm does not delete CRD objects. You can delete the ones KubeBlocks created with the following commands:

```bash
kubectl get crd -o name | grep kubeblocks.io | xargs kubectl delete
```

</TabItem>

<TabItem value="YAML" label="YAML">

You can generate YAMLs from the KubeBlocks chart and uninstall using `kubectl`.

```bash
helm template kubeblocks kubeblocks/kubeblocks --namespace kb-system | kubectl delete -f -
```

</TabItem>

</Tabs>
Loading

0 comments on commit 77ec530

Please sign in to comment.