Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Fix issues found in Queeny's test #507

Merged
merged 24 commits into from
May 24, 2019
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ebaa8ec
docs/dind: add instructions for XFS filesystems
AstroProfundis May 15, 2019
8d07ed2
docs: use `kubectl --watch` instead of `watch kubectl` in tutorials
AstroProfundis May 17, 2019
211012e
docs/aws: add detail instructions for requirements
AstroProfundis May 20, 2019
b4d4ffd
docs/dind: add notes for accessing TiDB cluster with MySQL client
AstroProfundis May 20, 2019
fe67dcd
docs: add sample output of terraform
AstroProfundis May 21, 2019
117dec3
Merge branch 'master' of github.com:pingcap/tidb-operator into fix-qu…
AstroProfundis May 21, 2019
5d2c19d
docs/aws: minor updates of words
AstroProfundis May 21, 2019
5eb0ddd
Update docs/local-dind-tutorial.md
AstroProfundis May 22, 2019
15d7ef2
docs: update instructions for macOS & update argument in sample
AstroProfundis May 22, 2019
471bab5
docs: Apply suggestions from code review
AstroProfundis May 22, 2019
e510d0e
docs/aws: fix synatax of intrucduction
AstroProfundis May 22, 2019
1f48c22
docs/aliyun: update instructions when deploying with terraform
AstroProfundis May 22, 2019
d04d708
docs/aws: adjust instructions to access DB and grafana & cleanup
AstroProfundis May 22, 2019
32fa5e9
Apply suggestions from code review
AstroProfundis May 23, 2019
7b46590
docs/dind: update contents to fix issues found in the test
AstroProfundis May 23, 2019
b7ff879
docs/aws: add an introduction sentense of terraform installation
AstroProfundis May 23, 2019
6bc6e06
docs/dind: pointing out xfs issue only applies to Linux users
AstroProfundis May 23, 2019
19a6b28
docs/dind: make port-forward instruction more clear
AstroProfundis May 23, 2019
3cd9826
Apply suggestions from code review
AstroProfundis May 23, 2019
e004170
docs/dind: make delete instructions more clear
AstroProfundis May 23, 2019
b38188e
docs/aws: update instructions of customizing params
AstroProfundis May 23, 2019
9e41760
docs/dind: clean up
AstroProfundis May 23, 2019
4e0c8e5
docs/aws: add examples and adjust order of sections
AstroProfundis May 24, 2019
faab010
Merge branch 'master' into fix-queeny-test-issues
tennix May 24, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions deploy/aliyun/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ $ terraform apply

`terraform apply` will take 5 to 10 minutes to create the whole stack, once complete, basic cluster information will be printed:

> **Note:** You can use the `terraform output` command to get this information again.
> **Note:** You can use the `terraform output` command to get the output again.

```
Apply complete! Resources: 3 added, 0 changed, 1 destroyed.
Expand Down Expand Up @@ -82,7 +82,7 @@ $ helm ls

## Access the DB

You can connect the TiDB cluster via the bastion instance, all necessary information are in the output printed after installation is finished:
You can connect the TiDB cluster via the bastion instance, all necessary information are in the output printed after installation is finished (replace the `<>` parts with values from the output):

```shell
$ ssh -i credentials/<cluster_name>-bastion-key.pem root@<bastion_ip>
Expand All @@ -106,7 +106,7 @@ To upgrade TiDB cluster, modify `tidb_version` variable to a higher version in `
This may take a while to complete, watch the process using command:

```
watch kubectl get pods --namespace tidb -o wide
kubectl get pods --namespace tidb -o wide --watch
```

## Scale TiDB cluster
Expand Down
66 changes: 52 additions & 14 deletions deploy/aws/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
# Deploy TiDB Operator and TiDB cluster on AWS EKS

AstroProfundis marked this conversation as resolved.
Show resolved Hide resolved
## Requirements:
AstroProfundis marked this conversation as resolved.
Show resolved Hide resolved
* [awscli](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html) >= 1.16.73
* [awscli](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html) >= 1.16.73, to control AWS resources

The `awscli` must be [configured](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html) before it can interact with AWS. The fastest way to set up is using the `aws configure` command:
AstroProfundis marked this conversation as resolved.
Show resolved Hide resolved

``` shell
# Replace AWS Access Key ID and AWS Secret Access Key with your own keys
$ aws configure
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-west-2
Default output format [None]: json
```
> **Note:** The access key must have at least permissions to: create VPC, create EBS, create EC2 and create role
* [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl) >= 1.11
* [helm](https://github.com/helm/helm/blob/master/docs/install.md#installing-the-helm-client) >= 2.9.0
* [jq](https://stedolan.github.io/jq/download/)
* [aws-iam-authenticator](https://github.com/kubernetes-sigs/aws-iam-authenticator) installed in `PATH`
* [aws-iam-authenticator](https://docs.aws.amazon.com/eks/latest/userguide/install-aws-iam-authenticator.html) installed in `PATH`, to authenticate with AWS

## Configure awscli
The easist way to install `aws-iam-authenticator` is to download the prebuilt binary:
AstroProfundis marked this conversation as resolved.
Show resolved Hide resolved

https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
``` shell
curl -o aws-iam-authenticator https://amazon-eks.s3-us-west-2.amazonaws.com/1.12.7/2019-03-27/bin/linux/amd64/aws-iam-authenticator
AstroProfundis marked this conversation as resolved.
Show resolved Hide resolved
chmod +x ./aws-iam-authenticator
sudo mv ./aws-iam-authenticator /usr/local/bin/aws-iam-authenticator
```

## Setup
AstroProfundis marked this conversation as resolved.
Show resolved Hide resolved

Expand All @@ -20,27 +36,47 @@ The default setup will create a new VPC and a t2.micro instance as bastion machi
* 2 c4.4xlarge instances for TiDB
* 1 c5.xlarge instance for monitor

You can change default values in `variables.tf` (like the cluster name and versions) as needed. The default value of `cluster_name` is `my-cluster`.

``` shell
AstroProfundis marked this conversation as resolved.
Show resolved Hide resolved
# Get the code
$ git clone --depth=1 https://github.com/pingcap/tidb-operator
$ cd tidb-operator/deploy/aws

# Apply the configs, note that you must answer "yes" to `terraform apply` to continue
$ terraform init
$ terraform apply
```

It might take 10 minutes or more for the process to finish. After `terraform apply` is executed successfully, some basic information is printed to the console. You can access the `monitor_endpoint` using your web browser.
It might take 10 minutes or more for the process to finish. After `terraform apply` is executed successfully, some useful information is printed to the console. You can access the `monitor_endpoint` address (printed in output) using your web browser to view monitoring metrics.
AstroProfundis marked this conversation as resolved.
Show resolved Hide resolved

A successful deploy will print output like:
AstroProfundis marked this conversation as resolved.
Show resolved Hide resolved

```
Apply complete! Resources: 67 added, 0 changed, 0 destroyed.

Outputs:

bastion_ip = [
52.14.50.145
]
eks_endpoint = https://E10A1D0368FFD6E1E32E11573E5CE619.sk1.us-east-2.eks.amazonaws.com
eks_version = 1.12
monitor_endpoint = http://abd299cc47af411e98aae02938da0762-1989524000.us-east-2.elb.amazonaws.com:3000
region = us-east-2
tidb_dns = abd2e3f7c7af411e98aae02938da0762-17499b76b312be02.elb.us-east-2.amazonaws.com
tidb_port = 4000
tidb_version = v3.0.0-rc.1
```

> **Note:** You can use the `terraform output` command to get that information again.
> **Note:** You can use the `terraform output` command to get the output again.

To access TiDB cluster, use the following command to first ssh into the bastion machine, and then connect it via MySQL client:
To access TiDB cluster, use the following command to first ssh into the bastion machine, and then connect it via MySQL client (replace the `<>` parts with values from the output):
AstroProfundis marked this conversation as resolved.
Show resolved Hide resolved

``` shell
ssh -i credentials/k8s-prod-<cluster_name>.pem ec2-user@<bastion_ip>
mysql -h <tidb_dns> -P <tidb_port> -u root
```

If the DNS name is not resolvable, be patient and wait a few minutes.
The default value of `cluster_name` is `my-cluster`. If the DNS name is not resolvable, be patient and wait a few minutes.

You can interact with the EKS cluster using `kubectl` and `helm` with the kubeconfig file `credentials/kubeconfig_<cluster_name>`.
AstroProfundis marked this conversation as resolved.
Show resolved Hide resolved

Expand All @@ -55,11 +91,11 @@ kubectl get po -n tidb
helm ls
```

# Destory
# Destroy
AstroProfundis marked this conversation as resolved.
Show resolved Hide resolved

It may take some while to finish destroying the cluster.

```shell
``` shell
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lilin90 Is this space necessary?

$ terraform destroy
```

Expand All @@ -69,16 +105,18 @@ $ terraform destroy

To upgrade TiDB cluster, modify `tidb_version` variable to a higher version in variables.tf and run `terraform apply`.
AstroProfundis marked this conversation as resolved.
Show resolved Hide resolved

> *Note*: The upgrading doesn't finish immediately. You can watch the upgrading process by `watch kubectl --kubeconfig credentials/kubeconfig_<cluster_name> get po -n tidb`
> *Note*: The upgrading doesn't finish immediately. You can watch the upgrading process by `kubectl --kubeconfig credentials/kubeconfig_<cluster_name> get po -n tidb --watch`.

## Scale TiDB cluster
AstroProfundis marked this conversation as resolved.
Show resolved Hide resolved

To scale TiDB cluster, modify `tikv_count` or `tidb_count` to your desired count, and then run `terraform apply`.
AstroProfundis marked this conversation as resolved.
Show resolved Hide resolved

> *Note*: Currently, scaling in is not supported since we cannot determine which node to scale. Scaling out needs a few minutes to complete, you can watch the scaling out by `watch kubectl --kubeconfig credentials/kubeconfig_<cluster_name> get po -n tidb`
> *Note*: Currently, scaling in is not supported since we cannot determine which node to scale. Scaling out needs a few minutes to complete, you can watch the scaling out by `kubectl --kubeconfig credentials/kubeconfig_<cluster_name> get po -n tidb --watch`.

## Customize

You can change default values in `variables.tf` (like the cluster name and image versions) as needed.
AstroProfundis marked this conversation as resolved.
Show resolved Hide resolved

### Customize AWS related resources

By default, the terraform script will create a new VPC. You can use an existing VPC by setting `create_vpc` to `false` and specify your existing VPC id and subnet ids to `vpc_id` and `subnets` variables.
Expand Down
2 changes: 1 addition & 1 deletion docs/aws-eks-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ We can now point a browser to `localhost:3000` and view the dashboards.

To scale out TiDB cluster, modify `tikv_count` or `tidb_count` in `aws-tutorial.tfvars` to your desired count, and then run `terraform apply -var-file=aws-tutorial.tfvars`.

> *Note*: Currently, scaling in is not supported since we cannot determine which node to scale. Scaling out needs a few minutes to complete, you can watch the scaling out by `watch kubectl --kubeconfig credentials/kubeconfig_aws_tutorial get po -n tidb`
> *Note*: Currently, scaling in is not supported since we cannot determine which node to scale. Scaling out needs a few minutes to complete, you can watch the scaling out by `kubectl --kubeconfig credentials/kubeconfig_aws_tutorial get po -n tidb --watch`.

> *Note*: There are taints and tolerations in place such that only a single pod will be scheduled per node. The count is also passed onto helm via terraform. For this reason attempting to scale out pods via helm or `kubectl scale` will not work as expected.
---
Expand Down
38 changes: 36 additions & 2 deletions docs/local-dind-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,38 @@ Before deploying a TiDB cluster to Kubernetes, make sure the following requireme

- `root` access or permissions to operate with the Docker daemon.

- Supported filesystem

If the host machine uses an XFS filesystem (default in CentOS 7), it must be formatted with `ftype=1` to enable `d_type` support, see [Docker's documentation](https://docs.docker.com/storage/storagedriver/overlayfs-driver/) for details.

You can check if your filesystem supports `d_type` using commaind `xfs_info / | grep ftype`, where `/` is the data directory of you installed Docker daemon.
AstroProfundis marked this conversation as resolved.
Show resolved Hide resolved

If your root directory `/` uses XFS without `d_type` support, but there is another partition does, or is using another filesystem, it is also possible to change the data directory of Docker to use that partition.

Assume a supported filesystem is mounted at path `/data`, use the following instructions to let Docker use it:

```sh
# Create a new directory for docker data storage
mkdir -p /data/docker

# Stop docker daemon
systemctl stop docker.service

# Make sure the systemd directory exist
mkdir -p /etc/systemd/system/docker.service.d/

# Overrite config
cat << EOF > /etc/systemd/system/docker.service.d/docker-storage.conf
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -g /data/docker -H fd:// --containerd=/run/containerd/containerd.sock
AstroProfundis marked this conversation as resolved.
Show resolved Hide resolved
EOF

# Restart docker daemon
systemctl daemon-reload
systemctl start docker.service
```

## Step 1: Deploy a Kubernetes cluster using DinD

There is a script in our repository that can help you install and set up a Kubernetes cluster (version 1.12) using DinD for TiDB Operator.
Expand Down Expand Up @@ -68,7 +100,7 @@ tidb-scheduler-56757c896c-clzdg 2/2 Running 0 1m

```sh
$ helm install charts/tidb-cluster --name=demo --namespace=tidb
$ watch kubectl get pods --namespace tidb -l app.kubernetes.io/instance=demo -o wide
$ kubectl get pods --namespace tidb -l app.kubernetes.io/instance=demo -o wide --watch
$ # wait a few minutes to get all TiDB components get created and ready

$ kubectl get tidbcluster -n tidb
Expand Down Expand Up @@ -120,13 +152,15 @@ To access the TiDB cluster, use `kubectl port-forward` to expose services to the

- Access TiDB using the MySQL client

Before you start testing your TiDB cluster, make sure you have installed a MySQL client.

1. Use `kubectl` to forward the host machine port to the TiDB service port:

```sh
$ kubectl port-forward svc/demo-tidb 4000:4000 --namespace=tidb
```

2. To connect to TiDB using the MySQL client, open a new terminal tab or window and run the following command:
2. Then, to connect to TiDB using the MySQL client, open a new terminal tab or window and run the following command:

```sh
$ mysql -h 127.0.0.1 -P 4000 -u root
Expand Down
6 changes: 3 additions & 3 deletions docs/minikube-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ helm install charts/tidb-operator --name tidb-operator --namespace tidb-admin
Now, we can watch the operator come up with:

```
watch kubectl get pods --namespace tidb-admin -o wide
kubectl get pods --namespace tidb-admin -o wide --watch
```
> **Note:**
>
Expand Down Expand Up @@ -161,7 +161,7 @@ helm install charts/tidb-cluster --name demo --set \
You can watch the cluster up and running using:

```
watch kubectl get pods --namespace default -l app.kubernetes.io/instance=demo -o wide
kubectl get pods --namespace default -l app.kubernetes.io/instance=demo -o wide --watch
```

Use Ctrl+C to quit the watch mode.
Expand All @@ -172,7 +172,7 @@ Before you start testing your TiDB cluster, make sure you have installed a MySQL
is available. You can watch the list of available services with:

```
watch kubectl get svc
kubectl get svc --watch
```

When you see `demo-tidb` appear, it's ready to connect to TiDB server.
Expand Down