Skip to content

Commit

Permalink
docs: update a user-guide
Browse files Browse the repository at this point in the history
  • Loading branch information
itnpeople committed May 9, 2022
1 parent 9f8bf12 commit 7781b40
Show file tree
Hide file tree
Showing 12 changed files with 266 additions and 146 deletions.
217 changes: 148 additions & 69 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,37 @@
# cbctl

* Cloud-Barista MCKS Command Line Interface
* MCKS : Multi Cloud Kubernetes Service
* https://github.com/cloud-barista/cb-mcks
* [MCKS : Multi Cloud Kubernetes Service](https://github.com/cloud-barista/cb-mcks)


## Quick Started

### Installation
* Installation

* MacOS
```
### MacOS
$ curl -LO "https://github.com/itnpeople/cbctl/releases/download/$(curl -s https://api.github.com/repos/itnpeople/cbctl/releases/latest | grep tag_name | sed -E 's/.*"([^"]+)".*/\1/')/cbctl-darwin-amd64"
$ mv cbctl-darwin-amd64 /usr/local/bin/cbctl
$ chmod +x /usr/local/bin/cbctl
$ cbctl version
```
* Linux
```
###Linux
$ curl -LO "https://github.com/itnpeople/cbctl/releases/download/$(curl -s https://api.github.com/repos/itnpeople/cbctl/releases/latest | grep tag_name | sed -E 's/.*"([^"]+)".*/\1/')/cbctl-linux-amd64"
$ mv cbctl-linux-amd64 /usr/local/bin/cbctl
$ chmod +x /usr/local/bin/cbctl
$ cbctl version
```

* Windows
```
### Windows
https://github.com/itnpeople/cbctl/releases/download/v0.0.0/cbctl-windows-amd64.exe
```

### Start-up the MCKS

* start up
* start up the MCKS

```
$ ./examples/lab/startup.sh
```

* Verify running
* verify running
```
$ docker ps
Expand All @@ -51,9 +43,7 @@ CONTAINER ID IMAGE COMMAND CRE
$ docker logs cb-mcks -f
```

### Create a Cluster

* Initialize (cb-spider)
* Initialize cloud connection (cb-spider)

```
$ cbctl create driver --csp aws
Expand All @@ -76,7 +66,6 @@ $ cbctl create cluster \

## User Guide

* Commands
```
$ cbctl create [cluster/node/driver/credential/region/connection]
$ cbctl get [cluster/node/driver/credential/region/connection/mcis]
Expand All @@ -88,8 +77,35 @@ $ cbctl clean [mcis]

### Create

* Create a Cloud Driver.
* Create a Cluster

```
$ cbctl create cluster \
--namespace "acornsoft"\
--name "cb-cluster"\
--control-plane-connection="config-aws-tokyo"\
--control-plane-count="1"\
--control-plane-spec="t2.medium"\
--worker-connection="config-gcp-tokyo"\
--worker-count="1"\
--worker-spec="e2-highcpu-4"
```

* Create Nodes
```
$ cbctl create node \
--namespace "acornsoft"\
--cluster "cb-cluster"\
--worker-connection="config-aws-tokyo"\
--worker-count="1"\
--worker-spec="t2.medium"
```

* Create a cloud driver.
```
$ cbctl create driver --csp [CSP]
# examples
$ cbctl create driver --csp aws
$ cbctl create driver --csp gcp
$ cbctl create driver --csp azure
Expand All @@ -100,7 +116,21 @@ $ cbctl create driver --csp openstack
$ cbctl create driver --csp cloudit
```

* Create a Credential
* Create a Region
```
$ cbctl create region [region name] --csp [CSP] --region [CSP region name] --zone [CSP zone name]
$ cbctl create region [region name] --csp azure --location [location] --resource-group [resource group name] # if azure
# examples
$ cbctl create region region-aws-tokyo --csp aws --region ap-northeast-1 --zone ap-northeast-1a
$ cbctl create region region-gcp-tokyo --csp gcp --region asia-northeast1 --zone asia-northeast1-a
$ cbctl create region region-azure-tokyo --csp azure --location japaneast --resource-group cb-mcks
$ cbctl create region region-alibaba-tokyo --csp alibaba --region ap-northeast-1 --zone ap-northeast-1a
$ cbctl create region region-tencent-tokyo --csp tencent --region ap-tokyo --zone ap-tokyo-2
$ cbctl create region region-ibm-tokyo --csp ibm --region jp-tok --zone jp-tok-1
```

* Create a credential
```
$ source ./examples/credentials.sh \
aws="${HOME}/.aws/credentials" \
Expand All @@ -121,18 +151,12 @@ $ cbctl create credential credential-openstack --csp openstack --endpoint "$OS_A
$ cbctl create credential credential-cloudit --csp cloudit --endpoint "$CLOUDIT_ENDPOINT" --username "$CLOUDIT_USERNAME" --password "$CLOUDIT_PASSWORD" --token "$CLOUDIT_TOKEN" --tenant "$CLOUDIT_TENANT_ID"
```

* Create a Region
```
$ cbctl create region region-aws-tokyo --csp aws --region ap-northeast-1 --zone ap-northeast-1a
$ cbctl create region region-gcp-tokyo --csp gcp --region asia-northeast1 --zone asia-northeast1-a
$ cbctl create region region-azure-tokyo --csp azure --location japaneast --resource-group cb-mcks
$ cbctl create region region-alibaba-tokyo --csp alibaba --region ap-northeast-1 --zone ap-northeast-1a
$ cbctl create region region-tencent-tokyo --csp tencent --region ap-tokyo --zone ap-tokyo-2
$ cbctl create region region-ibm-tokyo --csp ibm --region jp-tok --zone jp-tok-1
```

* Create a Connection Info.
```
$ cbctl create connection [connection name] --csp [CSP] --region [region name] --credential [credential name]
# examples
$ cbctl create connection config-aws-tokyo --csp aws --region region-aws-tokyo --credential credential-aws
$ cbctl create connection config-gcp-tokyo --csp gcp --region region-gcp-tokyo --credential credential-gcp
$ cbctl create connection config-azure-tokyo --csp azure --region region-azure-tokyo --credential credential-azure
Expand All @@ -144,46 +168,11 @@ $ cbctl create connection config-ibm-tokyo --csp ibm --region region-ibm-tokyo -
* Create a cloud-barista namespace

```
$ cbctl create namespace acornsoft
```

* Create a Cluster
$ cbctl create namespace [namespace name]
# example
$ cbctl create namespace acornsoft
```
$ cbctl create cluster \
--namespace "acornsoft"\
--name "cb-cluster"\
--control-plane-connection="config-aws-tokyo"\
--control-plane-count="1"\
--control-plane-spec="t2.medium"\
--worker-connection="config-gcp-tokyo"\
--worker-count="1"\
--worker-spec="e2-highcpu-4"
```

* Create Nodes
```
$ cbctl create node \
--namespace "acornsoft"\
--cluster "cb-cluster"\
--worker-connection="config-aws-tokyo"\
--worker-count="1"\
--worker-spec="t2.medium"
```

* Using Yaml File

```
$ cbctl create cluster -f examples/yaml/create-cluster.yaml
$ cbctl create node --cluster cb-cluster -f - <<EOF
worker:
- connection: config-aws-tokyo
count: 1
spec: t2.medium
EOF
```


### Get

Expand Down Expand Up @@ -311,7 +300,7 @@ $ cbctl delete mcis "cb-cluster"
```


* Delete the MCIRes
* Delete the MCIRs
```
$ cbctl delete driver [driver name]
$ cbctl delete driver --name [driver name]
Expand Down Expand Up @@ -356,6 +345,96 @@ $ chmod 400 output/w-1-j4j8z.pem
$ ssh -i output/w-1-j4j8z.pem cb-user@xxx.xxx.xxx.xxx
```

### Using Yaml File (filename)
```
$ cbctl create [cluster/node/driver/region/credential/connection/namespace] -f [URL]
$ cbctl create [cluster/node/driver/region/credential/connection/namespace] -f [FILENAME]
$ cbctl create [cluster/node/driver/region/credential/connection/namespace] -f [STDIN]
```

* examples - URL, FILENAME
```
$ cbctl create cluster -f examples/yaml/create-cluster.yaml
$ cbctl create cluster -f https://github.com/itnpeople/cbctl/blob/master/examples/yaml/create-cluster.yaml
```


* examples - STDIN
```
# cluster
$ cbctl create cluster -f - <<EOF
name: cb-cluster
label: lab.
description: create a cluster test
controlPlane:
- connection: config-aws-tokyo
count: 1
spec: t2.medium
worker:
- connection: config-gcp-tokyo
count: 1
spec: e2-highcpu-4
config:
kubernetes:
networkCni: calico
podCidr: 10.244.0.0/16
serviceCidr: 10.96.0.0/12
serviceDnsDomain: cluster.local
EOF
# nodes
$ cbctl create node --cluster cb-cluster -f - <<EOF
worker:
- connection: config-aws-tokyo
count: 1
spec: t2.medium
EOF
# driver
$ cbctl create driver -f - <<EOF
DriverName : "aws-driver-v1.0"
ProviderName : "AWS"
DriverLibFileName : "aws-driver-v1.0.so"
EOF
# region
$ cbctl create region -f - <<EOF
RegionName : "region-aws-tokyo"
ProviderName : "AWS"
KeyValueInfoList :
- Key : "Region"
Value : "ap-northeast-1"
- Key : "Zone"
Value : "ap-northeast-1a"
EOF
# credential
$ cbctl create credential -f - <<EOF
CredentialName : "credential-aws"
ProviderName : "AWS"
KeyValueInfoList :
- Key : "ClientId"
Value : "aaaaaaa"
- Key : "ClientSecret"
Value : "bbbbbbbbbbbbbbbbbbbbbbbbb"
EOF
# connection
$ cbctl create connection -f - <<EOF
ConfigName : "config-aws-tokyo"
ProviderName : "AWS"
DriverName : "aws-driver-v1.0"
CredentialName : "credential-aws"
RegionName : "region-aws-tokyo"
EOF
# namespace
$ cbctl create namespace -f - <<EOF
name : "acornsoft"
description : "acornsoft namespace"
EOF
```

### Plugins

```
Expand Down
5 changes: 3 additions & 2 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ func NewRootCommand() *cobra.Command {

// add commands
cmds.AddCommand(&cobra.Command{
Use: "version",
Short: "Print the version number of cbctl",
Use: "version",
Short: "Print the version number of cbctl",
DisableFlagsInUseLine: true,
Run: func(cmd *cobra.Command, args []string) {
o.Println("Version=%s, buildTime=%s", app.BuildVersion, app.BuildTime)
},
Expand Down
Loading

0 comments on commit 7781b40

Please sign in to comment.