Project: KubeBlocks by ApeCloud (App Definition and Development / Database)
File: kbcli_cluster_create.md

title: kbcli cluster create Create a cluster. ``` kbcli cluster create [NAME] [flags] ``` ``` kbcli cluster create mycluster --cluster-definition apecloud-mysql --cluster-version ac-mysql-8.0.30 kbcli cluster create mycluster --cluster-definition apecloud-mysql kbcli cluster create mycluster --cluster-definition apecloud-mysql --dry-run -o yaml kbcli cluster create mycluster --cluster-definition apecloud-mysql --dry-run=server -o yaml kbcli cluster create mycluster --cluster-definition apecloud-mysql --termination-policy DoNotTerminate kbcli cluster create mycluster --cluster-definition apecloud-mysql --termination-policy Halt kbcli cluster create mycluster --cluster-definition apecloud-mysql --termination-policy Delete kbcli cluster create mycluster --cluster-definition apecloud-mysql --termination-policy WipeOut kbcli cluster create mycluster --cluster-definition apecloud-mysql --set cpu=1,memory=1Gi,storage=20Gi,replicas=3 kbcli cluster create mycluster --cluster-definition apecloud-mysql --set storageClass=csi-hostpath-sc kbcli cluster create mycluster --cluster-definition postgresql --set switchPolicy=Noop kbcli cluster create mycluster --cluster-definition redis --set type=redis,cpu=1 --set type=redis-sentinel,cpu=200m kbcli cluster create mycluster --cluster-definition apecloud-mysql \ --set-file https://kubeblocks.io/yamls/apecloud-mysql.yaml cat << EOF | kbcli cluster create mycluster --cluster-definition apecloud-mysql --set-file - name: my-test ... kbcli cluster create --cluster-definition apecloud-mysql --topology-keys kubernetes.io/hostname \ --pod-anti-affinity Required kbcli cluster create --cluster-definition apecloud-mysql \ --node-labels '"topology.kubernetes.io/zone=us-east-1a","disktype=ssd,essd"' kbcli cluster create --cluster-definition apecloud-mysql --tolerations \ '"engineType=mongo:NoSchedule","diskType=ssd:NoSchedule"' kbcli cluster create --cluster-definition apecloud-mysql --tenancy=DedicatedNode kbcli cluster create --backup backup-default-mycluster-20230616190023 kbcli cluster create --restore-to-time "Jun 16,2023 18:58:53 UTC+0800" --source-cluster mycluster kbcli cluster create --cluster-definition apecloud-mysql --backup-enabled kbcli cluster create --cluster-definition oceanbase --pvc name=data-file,size=50Gi --pvc name=data-log,size=50Gi --pvc name=log,size=20Gi kbcli cluster create --cluster-definition pulsar --pvc type=bookies,name=ledgers,size=20Gi --pvc type=bookies,name=journal,size=20Gi kbcli cluster create --cluster-definition pulsar --service-reference name=pulsarZookeeper,cluster=zookeeper,namespace=default ``` ``` --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 --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 --monitoring-interval uint8 The monitoring interval of cluster, 0 is disabled, the unit is second, any non-zero value means enabling monitoring. --node-labels stringToString Node label selector (default []) -o, --output format Prints the output in the specified

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 or --set class=general-1c1g) -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") ``` ``` --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. --as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups. --as-uid string UID to impersonate for the operation. --cache-dir string Default cache directory (default "$HOME/.kube/cache") --certificate-authority string Path to a cert file for the certificate authority --client-certificate string Path to a client certificate file for TLS --client-key string Path to a client key file for TLS --cluster string The name of the kubeconfig cluster to use --context string The name of the kubeconfig context to use --disable-compression If true, opt-out of response compression for all requests to the server --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure --kubeconfig string Path to the kubeconfig file to use for CLI requests. --match-server-version Require server version to match client version -n, --namespace string If present, the namespace scope for this CLI request --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") -s, --server string The address and port of the Kubernetes API server --tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used --token string Bearer token for authentication to the API server --user string The name of the kubeconfig user to use ``` - Cluster command. - Create a kafka cluster. - Create a llm cluster. - Create a mongodb cluster. - Create a mysql cluster. - Create a postgresql cluster. - Create a redis cluster. - Create a xinference cluster.