Skip to content

Commit

Permalink
docs(autok3s): add docs for provider native
Browse files Browse the repository at this point in the history
Signed-off-by: NewGr8Player <273221594@qq.com>
  • Loading branch information
NewGr8Player authored and rancher-sy-bot committed Oct 10, 2020
1 parent 0b97174 commit ba111f7
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ It's also generated a state file `$HOME/.autok3s/.state` to record the clusters'

## Providers
- alibaba
- [native](docs/native/README.md)

## Pre-Requests
The following demo uses the Alibaba Provider, so you need to set the following [RAMs](docs/alibaba/ram.md).
Expand Down Expand Up @@ -53,6 +54,17 @@ autok3s create \
--master 1
```

SSH connection also supports the following options.

| Option Name | Description |
| --- | --- |
| --ssh-user | SSH user for host |
| --ssh-port | SSH port for host |
| --ssh-key-path | SSH private key path |
| --ssh-key-pass | SSH passphrase of private key |
| --ssh-key-cert-path | SSH private key certificate path |
| --ssh-password | SSH login password |

HA(embedded etcd: >= 1.19.1-k3s1) mode need `--master` at least 3 master nodes, e.g.
```bash
autok3s ... \
Expand Down Expand Up @@ -107,6 +119,8 @@ autok3s ... \
```

### Start K3s Cluster
> Provider `native` **DO NOT** support.
If you have ever created a cluster using `autok3s` on your current machine, you can use the simplified command.
```bash
autok3s start \
Expand All @@ -126,6 +140,8 @@ autok3s start \
```

### Stop K3s Cluster
> Provider `native` **DO NOT** support.
If you have ever created a cluster using `autok3s` on your current machine, you can use the simplified command.
```bash
autok3s stop \
Expand Down
90 changes: 90 additions & 0 deletions docs/native/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
## Provider native
### Setup K3s Cluster
```bash
autok3s create \
--provider native \
--name <cluster name> \
--ssh-key-path <ssh-key-path> \
--master-ips <master0-ip>
--worker-ips <worker0-ip,worker1-ip>
```

SSH connection also supports the following options.

| Option Name | Description |
| --- | --- |
| --ssh-user | SSH user for host |
| --ssh-port | SSH port for host |
| --ssh-key-path | SSH private key path |
| --ssh-key-pass | SSH passphrase of private key |
| --ssh-key-cert-path | SSH private key certificate path |
| --ssh-password | SSH login password |


HA(embedded etcd: >= 1.19.1-k3s1) mode need `--master-ips` at least 3 master nodes, e.g.
```bash
autok3s ... \
--master-ips <master0-ip,master1-ip,master2-ip>
```

HA(external database) mode need `--master-ips` greater than 1 node, also need to specify `--datastore`, e.g.
```bash
autok3s ... \
--master-ips <master0-ip,master1-ip> \
--datastore "mysql://<user>:<password>@tcp(<ip>:<port>)/<db>"
```

### Join K3s Nodes
```bash
autok3s join \
--provider native \
--name <cluster name> \
--ssh-key-path <ssh-key-path> \
--worker-ips <worker0-ip,worker1-ip>
```


Join master nodes to (embedded etcd: >= 1.19.1-k3s1) HA cluster e.g.
```bash
autok3s ... \
--master-ips <master0-ip,master1-ip>
```

Join master nodes to (external database) HA cluster, also need to specify `--datastore`, e.g.
```bash
autok3s ... \
--master-ips <master0-ip,master1-ip> \
--datastore "mysql://<user>:<password>@tcp(<ip>:<port>)/<db>"
```

### Delete K3s Cluster
```bash
autok3s delete \
--provider native \
--name <cluster name>
```

### List K3s Clusters
This command will list the clusters that you have created on this machine.
```bash
autok3s list
```

### Access K3s Cluster
After the cluster created, `autok3s` will automatically merge the `kubeconfig` which necessary for us to access the cluster.
```bash
autok3s kubectl <sub-commands> <flags>
```

In the scenario of multiple clusters, the access to different clusters can be completed by switching context.
```bash
autok3s kubectl config get-contexts
autok3s kubectl config use-context <context>
```

### SSH K3s Cluster's Node
```bash
autok3s ssh \
--provider native \
--name <cluster name>
```

0 comments on commit ba111f7

Please # to comment.