github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/docs/user_docs/cli/kbcli_cluster_create.md (about)

     1  ---
     2  title: kbcli cluster create
     3  ---
     4  
     5  Create a cluster.
     6  
     7  ```
     8  kbcli cluster create [NAME] [flags]
     9  ```
    10  
    11  ### Examples
    12  
    13  ```
    14    # Create a cluster with cluster definition apecloud-mysql and cluster version ac-mysql-8.0.30
    15    kbcli cluster create mycluster --cluster-definition apecloud-mysql --cluster-version ac-mysql-8.0.30
    16    
    17    # --cluster-definition is required, if --cluster-version is not specified, pick the most recently created version
    18    kbcli cluster create mycluster --cluster-definition apecloud-mysql
    19    
    20    # Output resource information in YAML format, without creation of resources.
    21    kbcli cluster create mycluster --cluster-definition apecloud-mysql --dry-run -o yaml
    22    
    23    # Output resource information in YAML format, the information will be sent to the server
    24    # but the resources will not be actually created.
    25    kbcli cluster create mycluster --cluster-definition apecloud-mysql --dry-run=server -o yaml
    26    
    27    # Create a cluster and set termination policy DoNotTerminate that prevents the cluster from being deleted
    28    kbcli cluster create mycluster --cluster-definition apecloud-mysql --termination-policy DoNotTerminate
    29    
    30    # Delete resources such as statefulsets, deployments, services, pdb, but keep PVCs
    31    # when deleting the cluster, use termination policy Halt
    32    kbcli cluster create mycluster --cluster-definition apecloud-mysql --termination-policy Halt
    33    
    34    # Delete resource such as statefulsets, deployments, services, pdb, and including
    35    # PVCs when deleting the cluster, use termination policy Delete
    36    kbcli cluster create mycluster --cluster-definition apecloud-mysql --termination-policy Delete
    37    
    38    # Delete all resources including all snapshots and snapshot data when deleting
    39    # the cluster, use termination policy WipeOut
    40    kbcli cluster create mycluster --cluster-definition apecloud-mysql --termination-policy WipeOut
    41    
    42    # Create a cluster and set cpu to 1 core, memory to 1Gi, storage size to 20Gi and replicas to 3
    43    kbcli cluster create mycluster --cluster-definition apecloud-mysql --set cpu=1,memory=1Gi,storage=20Gi,replicas=3
    44    
    45    # Create a cluster and set storageClass to csi-hostpath-sc, if storageClass is not specified,
    46    # the default storage class will be used
    47    kbcli cluster create mycluster --cluster-definition apecloud-mysql --set storageClass=csi-hostpath-sc
    48    
    49    # Create a cluster with replicationSet workloadType and set switchPolicy to Noop
    50    kbcli cluster create mycluster --cluster-definition postgresql --set switchPolicy=Noop
    51    
    52    # Create a cluster with more than one component, use "--set type=component-name" to specify the component,
    53    # if not specified, the main component will be used, run "kbcli cd list-components CLUSTER-DEFINITION-NAME"
    54    # to show the components in the cluster definition
    55    kbcli cluster create mycluster --cluster-definition redis --set type=redis,cpu=1 --set type=redis-sentinel,cpu=200m
    56    
    57    # Create a cluster and use a URL to set cluster resource
    58    kbcli cluster create mycluster --cluster-definition apecloud-mysql \
    59    --set-file https://kubeblocks.io/yamls/apecloud-mysql.yaml
    60    
    61    # Create a cluster and load cluster resource set from stdin
    62    cat << EOF | kbcli cluster create mycluster --cluster-definition apecloud-mysql --set-file -
    63    - name: my-test ...
    64    
    65    # Create a cluster scattered by nodes
    66    kbcli cluster create --cluster-definition apecloud-mysql --topology-keys kubernetes.io/hostname \
    67    --pod-anti-affinity Required
    68    
    69    # Create a cluster in specific labels nodes
    70    kbcli cluster create --cluster-definition apecloud-mysql \
    71    --node-labels '"topology.kubernetes.io/zone=us-east-1a","disktype=ssd,essd"'
    72    
    73    # Create a Cluster with two tolerations
    74    kbcli cluster create --cluster-definition apecloud-mysql --tolerations \ '"engineType=mongo:NoSchedule","diskType=ssd:NoSchedule"'
    75    
    76    # Create a cluster, with each pod runs on their own dedicated node
    77    kbcli cluster create --cluster-definition apecloud-mysql --tenancy=DedicatedNode
    78    
    79    # Create a cluster with backup to restore data
    80    kbcli cluster create --backup backup-default-mycluster-20230616190023
    81    
    82    # Create a cluster with time to restore from point in time
    83    kbcli cluster create --restore-to-time "Jun 16,2023 18:58:53 UTC+0800" --source-cluster mycluster
    84    
    85    # Create a cluster with auto backup
    86    kbcli cluster create --cluster-definition apecloud-mysql --backup-enabled
    87    
    88    # Create a cluster with default component having multiple storage volumes
    89    kbcli cluster create --cluster-definition oceanbase --pvc name=data-file,size=50Gi --pvc name=data-log,size=50Gi --pvc name=log,size=20Gi
    90    
    91    # Create a cluster with specifying a component having multiple storage volumes
    92    kbcli cluster create --cluster-definition pulsar --pvc type=bookies,name=ledgers,size=20Gi --pvc type=bookies,name=journal,size=20Gi
    93    
    94    # Create a cluster with using a service reference to another KubeBlocks cluster
    95    kbcli cluster create --cluster-definition pulsar --service-reference name=pulsarZookeeper,cluster=zookeeper,namespace=default
    96  ```
    97  
    98  ### Options
    99  
   100  ```
   101        --backup string                          Set a source backup to restore data
   102        --backup-cron-expression string          the cron expression for schedule, the timezone is in UTC. see https://en.wikipedia.org/wiki/Cron.
   103        --backup-enabled                         Specify whether enabled automated backup
   104        --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
   105        --backup-repo-name string                the backup repository name
   106        --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")
   107        --backup-starting-deadline-minutes int   the deadline in minutes for starting the backup job if it misses its scheduled time for any reason
   108        --cluster-definition string              Specify cluster definition, run "kbcli cd list" to show all available cluster definitions
   109        --cluster-version string                 Specify cluster version, run "kbcli cv list" to show all available cluster versions, use the latest version if not specified
   110        --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")
   111        --edit                                   Edit the API resource before creating
   112        --enable-all-logs                        Enable advanced application all log extraction, set to true will ignore enabledLogs of component level, default is false
   113    -h, --help                                   help for create
   114        --monitoring-interval uint8              The monitoring interval of cluster, 0 is disabled, the unit is second, any non-zero value means enabling monitoring.
   115        --node-labels stringToString             Node label selector (default [])
   116    -o, --output format                          Prints the output in the specified format. Allowed values: JSON and YAML (default yaml)
   117        --pitr-enabled                           Specify whether enabled point in time recovery
   118        --pod-anti-affinity string               Pod anti-affinity type, one of: (Preferred, Required) (default "Preferred")
   119        --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)
   120        --rbac-enabled                           Specify whether rbac resources will be created by kbcli, otherwise KubeBlocks server will try to create rbac resources
   121        --restore-to-time string                 Set a time for point in time recovery
   122        --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)
   123        --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)
   124    -f, --set-file string                        Use yaml file, URL, or stdin to set the cluster resource
   125        --tenancy string                         Tenancy options, one of: (SharedNode, DedicatedNode) (default "SharedNode")
   126        --termination-policy string              Termination policy, one of: (DoNotTerminate, Halt, Delete, WipeOut) (default "Delete")
   127        --tolerations strings                    Tolerations for cluster, such as "key=value:effect, key:effect", for example '"engineType=mongo:NoSchedule", "diskType:NoSchedule"'
   128        --topology-keys stringArray              Topology keys for affinity
   129        --volume-restore-policy string           the volume claim restore policy, supported values: [Serial, Parallel] (default "Parallel")
   130  ```
   131  
   132  ### Options inherited from parent commands
   133  
   134  ```
   135        --as string                      Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
   136        --as-group stringArray           Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
   137        --as-uid string                  UID to impersonate for the operation.
   138        --cache-dir string               Default cache directory (default "$HOME/.kube/cache")
   139        --certificate-authority string   Path to a cert file for the certificate authority
   140        --client-certificate string      Path to a client certificate file for TLS
   141        --client-key string              Path to a client key file for TLS
   142        --cluster string                 The name of the kubeconfig cluster to use
   143        --context string                 The name of the kubeconfig context to use
   144        --disable-compression            If true, opt-out of response compression for all requests to the server
   145        --insecure-skip-tls-verify       If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
   146        --kubeconfig string              Path to the kubeconfig file to use for CLI requests.
   147        --match-server-version           Require server version to match client version
   148    -n, --namespace string               If present, the namespace scope for this CLI request
   149        --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")
   150    -s, --server string                  The address and port of the Kubernetes API server
   151        --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
   152        --token string                   Bearer token for authentication to the API server
   153        --user string                    The name of the kubeconfig user to use
   154  ```
   155  
   156  ### SEE ALSO
   157  
   158  * [kbcli cluster](kbcli_cluster.md)	 - Cluster command.
   159  * [kbcli cluster create kafka](kbcli_cluster_create_kafka.md)	 - Create a kafka cluster.
   160  * [kbcli cluster create llm](kbcli_cluster_create_llm.md)	 - Create a llm cluster.
   161  * [kbcli cluster create mongodb](kbcli_cluster_create_mongodb.md)	 - Create a mongodb cluster.
   162  * [kbcli cluster create mysql](kbcli_cluster_create_mysql.md)	 - Create a mysql cluster.
   163  * [kbcli cluster create postgresql](kbcli_cluster_create_postgresql.md)	 - Create a postgresql cluster.
   164  * [kbcli cluster create redis](kbcli_cluster_create_redis.md)	 - Create a redis cluster.
   165  
   166  #### Go Back to [CLI Overview](cli.md) Homepage.
   167