Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
127 changes: 5 additions & 122 deletions docs/user_docs/cli/kbcli_cluster_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,133 +5,16 @@ title: kbcli cluster create
Create a cluster.

```
kbcli cluster create [NAME] [flags]
```

### Examples

```
# Create a cluster with cluster definition apecloud-mysql and cluster version ac-mysql-8.0.30
kbcli cluster create mycluster --cluster-definition apecloud-mysql --cluster-version ac-mysql-8.0.30

# --cluster-definition is required, if --cluster-version is not specified, pick the most recently created version
kbcli cluster create mycluster --cluster-definition apecloud-mysql

# Output resource information in YAML format, without creation of resources.
kbcli cluster create mycluster --cluster-definition apecloud-mysql --dry-run -o yaml

# Output resource information in YAML format, the information will be sent to the server
# but the resources will not be actually created.
kbcli cluster create mycluster --cluster-definition apecloud-mysql --dry-run=server -o yaml

# Create a cluster and set termination policy DoNotTerminate that prevents the cluster from being deleted
kbcli cluster create mycluster --cluster-definition apecloud-mysql --termination-policy DoNotTerminate

# Delete resources such as statefulsets, deployments, services, pdb, but keep PVCs
# when deleting the cluster, use termination policy Halt
kbcli cluster create mycluster --cluster-definition apecloud-mysql --termination-policy Halt

# Delete resource such as statefulsets, deployments, services, pdb, and including
# PVCs when deleting the cluster, use termination policy Delete
kbcli cluster create mycluster --cluster-definition apecloud-mysql --termination-policy Delete

# Delete all resources including all snapshots and snapshot data when deleting
# the cluster, use termination policy WipeOut
kbcli cluster create mycluster --cluster-definition apecloud-mysql --termination-policy WipeOut

# Create a cluster and set cpu to 1 core, memory to 1Gi, storage size to 20Gi and replicas to 3
kbcli cluster create mycluster --cluster-definition apecloud-mysql --set cpu=1,memory=1Gi,storage=20Gi,replicas=3

# Create a cluster and set storageClass to csi-hostpath-sc, if storageClass is not specified,
# the default storage class will be used
kbcli cluster create mycluster --cluster-definition apecloud-mysql --set storageClass=csi-hostpath-sc

# Create a cluster with replicationSet workloadType and set switchPolicy to Noop
kbcli cluster create mycluster --cluster-definition postgresql --set switchPolicy=Noop

# Create a cluster with more than one component, use "--set type=component-name" to specify the component,
# if not specified, the main component will be used, run "kbcli cd list-components CLUSTER-DEFINITION-NAME"
# to show the components in the cluster definition
kbcli cluster create mycluster --cluster-definition redis --set type=redis,cpu=1 --set type=redis-sentinel,cpu=200m

# Create a cluster and use a URL to set cluster resource
kbcli cluster create mycluster --cluster-definition apecloud-mysql \
--set-file https://kubeblocks.io/yamls/apecloud-mysql.yaml

# Create a cluster and load cluster resource set from stdin
cat << EOF | kbcli cluster create mycluster --cluster-definition apecloud-mysql --set-file -
- name: my-test ...

# Create a cluster scattered by nodes
kbcli cluster create --cluster-definition apecloud-mysql --topology-keys kubernetes.io/hostname \
--pod-anti-affinity Required

# Create a cluster in specific labels nodes
kbcli cluster create --cluster-definition apecloud-mysql \
--node-labels '"topology.kubernetes.io/zone=us-east-1a","disktype=ssd,essd"'

# Create a Cluster with two tolerations
kbcli cluster create --cluster-definition apecloud-mysql --tolerations \ '"engineType=mongo:NoSchedule","diskType=ssd:NoSchedule"'

# Create a cluster, with each pod runs on their own dedicated node
kbcli cluster create --cluster-definition apecloud-mysql --tenancy=DedicatedNode

# Create a cluster with backup to restore data
kbcli cluster create --backup backup-default-mycluster-20230616190023

# Create a cluster with time to restore from point in time
kbcli cluster create --restore-to-time "Jun 16,2023 18:58:53 UTC+0800" --source-cluster mycluster

# Create a cluster with auto backup
kbcli cluster create --cluster-definition apecloud-mysql --backup-enabled

# Create a cluster with default component having multiple storage volumes
kbcli cluster create --cluster-definition oceanbase --pvc name=data-file,size=50Gi --pvc name=data-log,size=50Gi --pvc name=log,size=20Gi

# Create a cluster with specifying a component having multiple storage volumes
kbcli cluster create --cluster-definition pulsar --pvc type=bookies,name=ledgers,size=20Gi --pvc type=bookies,name=journal,size=20Gi

# Create a cluster with using a service reference to another KubeBlocks cluster
kbcli cluster create --cluster-definition pulsar --service-reference name=pulsarZookeeper,cluster=zookeeper,namespace=default
kbcli cluster create [flags]
```

### Options

```
--annotation stringArray Set annotations for cluster
--backup string Set a source backup to restore data
--backup-cron-expression string the cron expression for schedule, the timezone is in UTC. see https://en.wikipedia.org/wiki/Cron.
--backup-enabled Specify whether enabled automated backup
--backup-method string the backup method, view it by "kbcli cd describe <cluster-definition>", if not specified, the default backup method will be to take snapshots of the volume
--backup-repo-name string the backup repository name
--backup-retention-period string a time string ending with the 'd'|'D'|'h'|'H' character to describe how long the Backup should be retained (default "1d")
--backup-starting-deadline-minutes int the deadline in minutes for starting the backup job if it misses its scheduled time for any reason
--cluster-definition string Specify cluster definition, run "kbcli cd list" to show all available cluster definitions
--cluster-version string Specify cluster version, run "kbcli cv list" to show all available cluster versions, use the latest version if not specified
--cpu-oversell-ratio float Set oversell ratio of CPU, set to 10 means 10 times oversell (default 1)
--create-only-set Create components exclusively configured in 'set'
--disable-exporter Enable or disable monitoring (default true)
--dry-run string[="unchanged"] Must be "client", or "server". If with client strategy, only print the object that would be sent, and no data is actually sent. If with server strategy, submit the server-side request, but no data is persistent. (default "none")
--edit Edit the API resource before creating
--enable-all-logs Enable advanced application all log extraction, set to true will ignore enabledLogs of component level, default is false
-h, --help help for create
--label stringArray Set labels for cluster resources
--memory-oversell-ratio float Set oversell ratio of memory, set to 10 means 10 times oversell (default 1)
--node-labels stringToString Node label selector (default [])
-o, --output format Prints the output in the specified format. Allowed values: JSON and YAML (default yaml)
--pitr-enabled Specify whether enabled point in time recovery
--pod-anti-affinity string Pod anti-affinity type, one of: (Preferred, Required) (default "Preferred")
--pvc stringArray Set the cluster detail persistent volume claim, each '--pvc' corresponds to a component, and will override the simple configurations about storage by --set (e.g. --pvc type=mysql,name=data,mode=ReadWriteOnce,size=20Gi --pvc type=mysql,name=log,mode=ReadWriteOnce,size=1Gi)
--rbac-enabled Specify whether rbac resources will be created by kbcli, otherwise KubeBlocks server will try to create rbac resources
--restore-to-time string Set a time for point in time recovery
--service-reference stringArray Set the other KubeBlocks cluster dependencies, each '--service-reference' corresponds to a cluster service. (e.g --service-reference name=pulsarZookeeper,cluster=zookeeper,namespace=default)
--set stringArray Set the cluster resource including cpu, memory, replicas and storage, each set corresponds to a component.(e.g. --set cpu=1,memory=1Gi,replicas=3,storage=20Gi)
-f, --set-file string Use yaml file, URL, or stdin to set the cluster resource
--tenancy string Tenancy options, one of: (SharedNode, DedicatedNode) (default "SharedNode")
--termination-policy string Termination policy, one of: (DoNotTerminate, Halt, Delete, WipeOut) (default "Delete")
--tolerations strings Tolerations for cluster, such as "key=value:effect, key:effect", for example '"engineType=mongo:NoSchedule", "diskType:NoSchedule"'
--topology-keys stringArray Topology keys for affinity
--volume-restore-policy string the volume claim restore policy, supported values: [Serial, Parallel] (default "Parallel")
--dry-run string[="unchanged"] Must be "client", or "server". If with client strategy, only print the object that would be sent, and no data is actually sent. If with server strategy, submit the server-side request, but no data is persistent. (default "none")
--edit Edit the API resource before creating
-h, --help help for create
-o, --output format Prints the output in the specified format. Allowed values: JSON and YAML (default yaml)
```

### Options inherited from parent commands
Expand Down
15 changes: 7 additions & 8 deletions docs/user_docs/cli/kbcli_playground_init.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,13 @@ kbcli playground init [flags]
### Options

```
--auto-approve Skip interactive approval during the initialization of playground
--cloud-provider string Cloud provider type, one of [local aws gcp alicloud tencentcloud] (default "local")
--cluster-definition string Specify the cluster definition, run "kbcli cd list" to get the available cluster definitions (default "apecloud-mysql")
--cluster-version string Specify the cluster version, run "kbcli cv list" to get the available cluster versions
-h, --help help for init
--region string The region to create kubernetes cluster
--timeout duration Time to wait for init playground, such as --timeout=10m (default 10m0s)
--version string KubeBlocks version
--auto-approve Skip interactive approval during the initialization of playground
--cloud-provider string Cloud provider type, one of [local aws gcp alicloud tencentcloud] (default "local")
--cluster-type string Specify the cluster type to create. (default "apecloud-mysql")
-h, --help help for init
--region string The region to create kubernetes cluster
--timeout duration Time to wait for init playground, such as --timeout=10m (default 10m0s)
--version string KubeBlocks version
```

### Options inherited from parent commands
Expand Down
Loading