### Apply Start Configuration Source: https://github.com/apecloud/kubeblocks/blob/main/examples/redis/README.md Apply a YAML configuration to start a previously stopped Redis cluster. ```bash kubectl apply -f examples/redis/start.yaml ``` -------------------------------- ### Start MySQL Cluster Source: https://github.com/apecloud/kubeblocks/blob/main/examples/mysql/README.md Apply a configuration to start a previously stopped MySQL cluster. ```bash kubectl apply -f examples/mysql/start.yaml ``` -------------------------------- ### Start Delve Debug Server with Arguments Source: https://github.com/apecloud/kubeblocks/blob/main/docs/03 - debug.md Debug a Go package while passing specific command-line arguments to the application. This example passes arguments for creating a cluster. ```shell make run-delve GO_PACKAGE=./cmd/cli/main.go ARGUMENTS='cluster create test-cluster --termination-policy=Halt' ``` -------------------------------- ### Start Qdrant Cluster Source: https://github.com/apecloud/kubeblocks/blob/main/examples/qdrant/README.md Applies a YAML configuration to start a previously stopped Qdrant cluster. ```bash kubectl apply -f examples/qdrant/start.yaml ``` -------------------------------- ### Apply Start Configuration Source: https://github.com/apecloud/kubeblocks/blob/main/examples/mongodb/README.md Apply a YAML file to start a previously stopped MongoDB cluster. This will bring the cluster back online by recreating its pods. ```bash kubectl apply -f examples/mongodb/start.yaml ``` -------------------------------- ### Start Milvus Cluster Source: https://github.com/apecloud/kubeblocks/blob/main/examples/milvus/README.md Apply the start configuration to resume a previously stopped Milvus cluster. ```bash kubectl apply -f examples/milvus/start.yaml ``` -------------------------------- ### Install MySQL Addon using kbcli Source: https://github.com/apecloud/kubeblocks/blob/main/docs/01 - build.md Install and enable the MySQL addon for KubeBlocks using the `kbcli` command-line tool. Ensure you have an addon index and specify the desired version. ```shell # make sure there is an index kbcli addon index list # search supported addon kbcli addon search mysql # install addon kbcli addon install mysql --index kubeblocks --version [YOUR_VERSION] # enable addon kbcli addon enable mysql # list the addons again to check whether it is enabled. kbcli addon list ``` -------------------------------- ### Start Stopped RabbitMQ Cluster Source: https://github.com/apecloud/kubeblocks/blob/main/examples/rabbitmq/README.md Apply the start configuration to resume a previously stopped RabbitMQ cluster. ```bash kubectl apply -f examples/rabbitmq/start.yaml ``` -------------------------------- ### Configure ToolConfig with asContainerImage Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/parameters.md Example configuration for setting up tools using a container image in ToolConfig. ```yaml toolsSetup:: mountPoint: /kb_tools toolConfigs: - name: kb-tools asContainerImage: true image: apecloud/oceanbase:4.2.0.0-100010032023083021 ``` -------------------------------- ### Install build-essential on Linux Source: https://github.com/apecloud/kubeblocks/blob/main/docs/01 - build.md Installs the necessary package for build tools on Debian-based Linux distributions. ```shell sudo apt-get install build-essential ``` -------------------------------- ### AddonInstallSpec Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/add-on.md Defines the installation parameters for an add-on. ```APIDOC ## AddonInstallSpec ### Description Defines the installation parameters for an add-on. ### Fields - **helm** (HelmTypeInstallSpec) - Optional - Specifies Helm-specific installation parameters. ``` -------------------------------- ### Check Delve Installation Source: https://github.com/apecloud/kubeblocks/blob/main/docs/03 - debug.md Verify that Delve has been installed correctly by checking its version. ```shell dlv version ``` -------------------------------- ### Start PostgreSQL Component using Cluster API Source: https://github.com/apecloud/kubeblocks/blob/main/examples/postgresql/README.md Configure a PostgreSQL component to start by setting the `spec.componentSpecs.stop` field to `false` (or removing it) within a Cluster resource. ```yaml apiVersion: apps.kubeblocks.io/v1 kind: Cluster spec: componentSpecs: - name: postgresql stop: false # set to `false` (or remove this field) to start the component replicas: 2 ``` -------------------------------- ### Start Delve Debug Server for a Package Source: https://github.com/apecloud/kubeblocks/blob/main/docs/03 - debug.md Run a Delve debug server for a specific Go package. This command starts the server for the manager executable. ```shell make run-delve GO_PACKAGE=./cmd/manager/main.go ``` -------------------------------- ### ShellTrigger batchParamsFormatterTemplate Example Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/cluster.md A Go template example for formatting batch input data in a ShellTrigger, used when batchReload is set to True. ```yaml batchParamsFormatterTemplate: |- {{- range $pKey, $pValue := $ }} {{ printf "%s:%s" $pKey $pValue }} {{- end }} ``` -------------------------------- ### Create MySQL Cluster with kbcli Source: https://github.com/apecloud/kubeblocks/blob/main/docs/01 - build.md Use `kbcli` to create a MySQL cluster. Ensure `kbcli` is installed and configured. ```bash kbcli cluster create mysql mycluster ``` -------------------------------- ### Start Stopped PostgreSQL Cluster using kubectl Source: https://github.com/apecloud/kubeblocks/blob/main/examples/postgresql/README.md Apply a YAML configuration to start a previously stopped PostgreSQL cluster. ```bash kubectl apply -f examples/postgresql/start.yaml ``` -------------------------------- ### AddonInstallSpec Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/add-on.md Specifies the installation attributes for an add-on, including whether it's enabled and any extra installation configurations. ```APIDOC ## AddonInstallSpec ### Description Specifies the installation attributes for an add-on. ### Fields - **AddonInstallSpecItem** (embedded): Members of AddonInstallSpecItem are embedded into this type. - **enabled** (bool, optional): Can be set to true if there are no specific installation attributes to be set. - **extras** ([]AddonInstallExtraItem, optional): Specifies the installation specifications for extra items. ``` -------------------------------- ### ClusterDefinition API Placeholder Example Source: https://github.com/apecloud/kubeblocks/blob/main/docs/release_notes/template.md Example demonstrating the use of the Headless service FQDN placeholder $(HEADLESS_SVC_FQDN) in ClusterDefinition API's connectionCredential. ```yaml spec.connectionCredential: - name: HEADLESS_SVC_FQDN value: "$(HEADLESS_SVC_FQDN)" ``` -------------------------------- ### InstallableSpec Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/add-on.md Specifies the conditions and behavior for installing add-ons. ```APIDOC ## InstallableSpec ### Description Defines the specification for an installable item, including selection criteria and auto-installation behavior. ### Fields * `selectors` ([]SelectorRequirement) - Optional - A list of requirements that must be met for the add-on to be installed. * `autoInstall` (bool) - Indicates whether the add-on should be installed automatically. ``` -------------------------------- ### Define File Format Configuration Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/parameters.md Example of configuring the file format and specific parameters for a configuration file, such as an INI section. ```yaml fileFormatConfig: format: ini iniConfig: sectionName: mysqld ``` -------------------------------- ### Configure INI format parameters Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/cluster.md Example of specifying a section name when using the INI format for configuration. ```yaml formatterConfig: format: ini iniConfig: sectionName: mysqld ``` -------------------------------- ### HelmTypeInstallSpec Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/add-on.md Defines Helm-specific installation parameters. ```APIDOC ## HelmTypeInstallSpec ### Description Defines Helm-specific installation parameters. ### Fields - **version** (string) - Optional - Specifies the chart version to install. - **chart** (string) - Optional - Specifies the name of the chart to install. - **releaseName** (string) - Optional - Specifies the release name for the Helm chart. - **namespace** (string) - Optional - Specifies the namespace to install the Helm chart into. - **values** (HelmInstallValues) - Optional - Specifies the values for the Helm installation. - **options** (HelmInstallOptions) - Optional - Specifies additional options for the Helm installation. ``` -------------------------------- ### AddonInstallSpecItem Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/add-on.md Defines specific installation attributes for an add-on, such as replicas, persistent volume settings, storage class, tolerations, and resource requirements. ```APIDOC ## AddonInstallSpecItem ### Description Defines specific installation attributes for an add-on. ### Fields - **replicas** (int32, optional): Specifies the number of replicas. - **persistentVolumeEnabled** (bool, optional): Indicates whether the Persistent Volume is enabled or not. - **storageClass** (string, optional): Specifies the name of the storage class. - **tolerations** (string, optional): Specifies the tolerations in a JSON array string format. - **resources** (ResourceRequirements, optional): Specifies the resource requirements. ``` -------------------------------- ### Create Redis with Twemproxy Source: https://github.com/apecloud/kubeblocks/blob/main/examples/redis/README.md Apply this configuration to create a Redis cluster with Twemproxy for load balancing. This example sets up Redis, Sentinel, and Twemproxy components. ```bash kubectl apply -f examples/redis/cluster-twemproxy.yaml ``` ```yaml # snippet of cluster.yaml apiVersion: apps.kubeblocks.io/v1 kind: Cluster spec: terminationPolicy: Delete clusterDef: redis topology: replication-twemproxy # set topology to standalone componentSpecs: - name: redis - name: redis-sentinel - name: redis-twemproxy # add one componet on provisioniing: twemproxy replicas: 3 # set the desired number of replicas for twemproxy resources: ``` -------------------------------- ### Start Stopped Kafka Cluster using kubectl Source: https://github.com/apecloud/kubeblocks/blob/main/examples/kafka/README.md Apply a YAML configuration file to start a previously stopped Kafka cluster. This will recreate the necessary pods to resume cluster operations. ```bash kubectl apply -f examples/kafka/start.yaml ``` -------------------------------- ### Expose Service with Cluster API (YAML) Source: https://github.com/apecloud/kubeblocks/blob/main/examples/redis/README.md Example snippet of a cluster.yaml file demonstrating how to expose a service using Cluster API. This includes defining service annotations, component selector, and service specifications. ```yaml # snippet of cluster.yaml apiVersion: apps.kubeblocks.io/v1 kind: Cluster spec: # append service to the list services: # add annotation for cloud loadbalancer if # services.spec.type is LoadBalancer # here we use annotation for alibaba cloud for example - annotations: service.beta.kubernetes.io/alibaba-cloud-loadbalancer-address-type: internet componentSelector: redis name: redis-vpc serviceName: redis-vpc # optional. it specify defined role as selector for the service. # onece specified, service will select and route traffic to Pods with the label # "kubeblocks.io/role=". # valid options are: [primary, secondary] for MySQL roleSelector: primary spec: # defines the behavior of a K8s service. ipFamilyPolicy: PreferDualStack ports: - name: tcp-redis # port to expose port: 6379 protocol: TCP targetPort: redis # Determines how the Service is exposed. Defaults to 'ClusterIP'. # Valid options are [`ClusterIP`, `NodePort`, and `LoadBalancer`] type: LoadBalancer componentSpecs: - name: redis serviceVersion: "7.2.4" ... ``` -------------------------------- ### HelmInstallOptions Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/add-on.md Alias for map[string]string, used for Helm installation options. ```APIDOC ## HelmInstallOptions ### Description Alias for map[string]string, used for Helm installation options. ``` -------------------------------- ### Start MySQL Component via Cluster API Source: https://github.com/apecloud/kubeblocks/blob/main/examples/mysql/README.md Configure a specific MySQL component to start by setting its 'stop' field to false (or removing it) using the Cluster API. ```yaml apiVersion: apps.kubeblocks.io/v1 kind: Cluster spec: componentSpecs: - name: mysql stop: false # set to `false` (or remove this field) to start the component replicas: 2 ``` -------------------------------- ### Clean up backupPolicyTemplate Resources Source: https://github.com/apecloud/kubeblocks/blob/main/docs/release_notes/template.md Before installing v0.5, ensure backupPolicyTemplate and backuppolicies resources are cleaned up by running these kubectl commands. ```bash kubectl delete backuppolicytemplates.dataprotection.kubeblocks.io --all kubectl delete backuppolicies.dataprotection.kubeblocks.io --all ``` -------------------------------- ### Install Orchestrator Addon Source: https://github.com/apecloud/kubeblocks/blob/main/examples/mysql/README.md Apply the Orchestrator addon configuration to your Kubernetes cluster. ```bash kubectl apply -f examples/mysql/orchestrator.yaml ``` -------------------------------- ### Install Xcode command line tools on macOS Source: https://github.com/apecloud/kubeblocks/blob/main/docs/01 - build.md Ensures that make and other command line developer tools are available on macOS. ```shell xcode-select --install ``` -------------------------------- ### Reconfigure MongoDB Parameters Source: https://github.com/apecloud/kubeblocks/blob/main/examples/mongodb/README.md Apply a reconfiguration to a MongoDB cluster. This example sets system log verbosity and quiet mode. Log into the instance to verify the changes. ```bash kubectl apply -f examples/mongodb/configure.yaml ``` ```javascript const config = db.adminCommand({ getCmdLineOpts: 1 }); print("systemLog.quiet:", config.parsed.systemLog.quiet); print("systemLog.verbosity:", config.parsed.systemLog.verbosity); ``` -------------------------------- ### Apply Redis Reconfiguration Source: https://github.com/apecloud/kubeblocks/blob/main/examples/redis/README.md Apply a reconfiguration to the Redis component using a YAML file. This example specifically targets the `maxclients` parameter and requires a database restart due to it being a static parameter. ```bash kubectl apply -f examples/redis/configure.yaml ``` -------------------------------- ### Get Supported Backup Methods Source: https://github.com/apecloud/kubeblocks/blob/main/examples/mongodb/README.md Retrieve a list of supported backup methods for a MongoDB cluster's backup policy. Ensure a BackupRepo is created before proceeding. ```bash # mongo-cluster-mongodb-backup-policy is the backup policy name kubectl get backuppolicy -n demo mongo-cluster-mongodb-backup-policy -oyaml | yq '.spec.backupMethods[].name' ``` -------------------------------- ### Run KubeBlocks Controller Source: https://github.com/apecloud/kubeblocks/blob/main/docs/01 - build.md Start the KubeBlocks controller locally for development and debugging purposes. This command will output logs to the console. ```makefile make run ``` -------------------------------- ### Define OpsDefinition PreConditions Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/operations.md Example of defining a precondition rule to verify the component status before executing an operation. ```yaml preConditions: - rule: expression: '{{ eq .component.status.phase "Running" }}' message: Component is not in Running status. ``` -------------------------------- ### Start Delve Debug Server for Envtest Source: https://github.com/apecloud/kubeblocks/blob/main/docs/03 - debug.md Initiate a Delve debug server specifically for running envtests. Note that Delve requires a single executable, unlike `go test` which supports multiple packages. ```shell make test-delve TEST_PACKAGES=./controllers/apps/... ``` -------------------------------- ### CliPlugin Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/add-on.md Specifies the CLI plugin installation specifications. ```APIDOC ## CliPlugin ### Description Specifies the CLI plugin installation specifications. ### Fields - **name** (string) - Specifies the name of the plugin. - **indexRepository** (string) - Defines the index repository of the plugin. - **description** (string) - Optional - Provides a brief description of the plugin. ``` -------------------------------- ### Generated Containers for ToolConfig Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/parameters.md Example of the resulting init and sidecar containers generated by the ToolConfig configuration. ```yaml initContainers: - name: install-config-manager-tool image: apecloud/kubeblocks-tools:${version} command: - cp - /bin/config_render - /opt/tools volumemounts: - name: kb-tools mountpath: /opt/tools containers: - name: config-manager image: apecloud/oceanbase:4.2.0.0-100010032023083021 imagePullPolicy: IfNotPresent command: - /opt/tools/reloader - --log-level - info - --operator-update-enable - --tcp - "9901" - --config - /opt/config-manager/config-manager.yaml volumemounts: - name: kb-tools mountpath: /opt/tools ``` -------------------------------- ### Configure ComponentService with podService Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/cluster.md Example configuration for exposing individual pods within a component using a NodePort service type. ```yaml name: my-service serviceName: my-service podService: true disableAutoProvision: true spec: type: NodePort ports: - name: http port: 80 targetPort: 8080 ``` -------------------------------- ### HelmInstallValues Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/add-on.md Defines the set values for Helm release installation. ```APIDOC ## HelmInstallValues ### Description Defines the set values for Helm release installation. ### Fields - **setValues** ([]string) - Optional - Values set during Helm installation. Multiple or separate values can be specified with commas (key1=val1,key2=val2). - **setJSONValues** ([]string) - Optional - JSON values set during Helm installation. Multiple or separate values can be specified with commas (key1=jsonval1,key2=jsonval2). - **DataObjectKeySelector** (DataObjectKeySelector) - Optional - Selects a key from a Secrets item list. The value can be a JSON or YAML string content. Use a key name with “.json”, “.yaml”, or “.yml” extension to specify a content type. ``` -------------------------------- ### Reconfigure PostgreSQL Cluster Parameters Source: https://github.com/apecloud/kubeblocks/blob/main/examples/postgresql/README.md Apply a configuration file to reconfigure PostgreSQL cluster parameters. This example changes `max_connections` dynamically without requiring a database restart. ```bash kubectl apply -f examples/postgresql/configure.yaml ``` -------------------------------- ### Reconfigure Kafka Components using kubectl Source: https://github.com/apecloud/kubeblocks/blob/main/examples/kafka/README.md Apply a YAML configuration file to reconfigure parameters for specified Kafka components. This example updates the `log.flush.interval.ms` parameter for the `kafka-combine` component. ```bash kubectl apply -f examples/kafka/configure.yaml ``` -------------------------------- ### Verify Redis Configuration Source: https://github.com/apecloud/kubeblocks/blob/main/examples/redis/README.md Connect to the Redis pod and use the `CONFIG GET` command to verify that the reconfiguration has been applied successfully. This command retrieves the current value of a specified configuration parameter. ```redis reids> config get maxclients ``` ```text 1)"maxclients" 2)"10001" # where 10001 is the new value set in the reconfiguration ``` -------------------------------- ### Reconfigure MySQL Cluster Parameters Source: https://github.com/apecloud/kubeblocks/blob/main/examples/mysql/README.md Apply a configuration to reconfigure parameters for the MySQL cluster components. This example changes the binlog_expire_logs_seconds. ```bash kubectl apply -f examples/mysql/configure.yaml ``` -------------------------------- ### Generate and Install CRDs Source: https://github.com/apecloud/kubeblocks/blob/main/docs/01 - build.md Generate Custom Resource Definitions (CRDs) for KubeBlocks using `make manifests` and then install them into the cluster with `make install`. ```makefile make manifests ``` ```makefile make install ``` -------------------------------- ### Clean up Cluster and OpsRequest Resources Source: https://github.com/apecloud/kubeblocks/blob/main/docs/release_notes/template.md Before installing v0.5, ensure cluster and opsrequest resources are cleaned up by running these kubectl commands due to redefined phases. ```bash kubectl delete clusters.apps.kubeblocks.io --all kubectl delete opsrequets.apps.kubeblocks.io --all ``` -------------------------------- ### Update Qdrant Component Resources Source: https://github.com/apecloud/kubeblocks/blob/main/examples/qdrant/README.md Example snippet demonstrating how to update CPU and memory requests/limits for a Qdrant component using the Cluster API. ```yaml # snippet of cluster.yaml apiVersion: apps.kubeblocks.io/v1 kind: Cluster spec: componentSpecs: - name: qdrant componentDef: qdrant replicas: 3 resources: requests: cpu: "1" # Update the resources to your need. memory: "2Gi" # Update the resources to your need. limits: cpu: "2" # Update the resources to your need. memory: "4Gi" # Update the resources to your need. ``` -------------------------------- ### Add a new member to an OceanBase cluster Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/cluster.md Example command for the memberJoin action to add an OBServer to an OceanBase cluster in a specific zone. ```yaml command: - bash - -c - | CLIENT="mysql -u $SERVICE_USER -p$SERVICE_PASSWORD -P $SERVICE_PORT -h $SERVICE_HOST -e" $CLIENT "ALTER SYSTEM ADD SERVER '$POD_FQDN:$SERVICE_PORT' ZONE 'zone1'" ``` -------------------------------- ### Start Stopped Elasticsearch Cluster Source: https://github.com/apecloud/kubeblocks/blob/main/examples/elasticsearch/README.md Apply a YAML configuration to start a previously stopped cluster. ```bash kubectl apply -f examples/elasticsearch/start.yaml ``` -------------------------------- ### Explain PostgreSQL Cluster Configuration Source: https://github.com/apecloud/kubeblocks/blob/main/examples/postgresql/README.md Use the `kbcli` command-line tool to explain the configuration of a PostgreSQL cluster. ```bash kbcli cluster explain-config pg-cluster ``` -------------------------------- ### Delve CLI Connection and Debugging Source: https://github.com/apecloud/kubeblocks/blob/main/docs/03 - debug.md Connect to a running Delve debug server using the Delve CLI. This example shows setting breakpoints, continuing execution, and stepping through code. ```shell $ dlv connect 127.0.0.1:2345 Type 'help' for list of commands. (dlv) break cluster_controller.go:303 (dlv) continue (dlv) next (dlv) ...... ``` -------------------------------- ### Remove a member from an OceanBase cluster Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/cluster.md Example command for the memberLeave action to remove an OBServer from an OceanBase cluster in a specific zone. ```yaml command: - bash - -c - | CLIENT="mysql -u $SERVICE_USER -p$SERVICE_PASSWORD -P $SERVICE_PORT -h $SERVICE_HOST -e" $CLIENT "ALTER SYSTEM DELETE SERVER '$POD_FQDN:$SERVICE_PORT' ZONE 'zone1'" ``` -------------------------------- ### Create Kubernetes Namespace Source: https://github.com/apecloud/kubeblocks/blob/main/examples/milvus/README.md Create a Kubernetes namespace named 'demo' to isolate resources created during the tutorial. This helps in managing and cleaning up resources specific to this demonstration. ```bash kubectl create ns demo ``` -------------------------------- ### Define ServiceRefs in Component Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/cluster.md Example configuration for defining service references within a Component, supporting both external services and internal cluster services. ```yaml serviceRefs: - name: "redis-sentinel" serviceDescriptor: name: "external-redis-sentinel" - name: "postgres-cluster" ``` -------------------------------- ### Get Redis Backup Methods Source: https://github.com/apecloud/kubeblocks/blob/main/examples/redis/README.md Retrieve a list of supported backup methods for a Redis cluster. This command helps identify available backup strategies like 'datafile', 'aof', and 'volume-snapshot'. ```bash kubectl get backuppolicy -n demo redis-replication-redis-backup-policy -oyaml | yq '.spec.backupMethods[].name' ``` -------------------------------- ### Create Kubernetes Namespace Source: https://github.com/apecloud/kubeblocks/blob/main/examples/mongodb/README.md Creates a Kubernetes namespace named 'demo' to isolate resources for tutorials and testing. ```bash kubectl create ns demo ``` -------------------------------- ### Create Full MySQL Backup Source: https://github.com/apecloud/kubeblocks/blob/main/examples/mysql/README.md Apply a configuration to create a full backup of the MySQL cluster using the xtrabackup method. Ensure a BackupRepo is pre-configured. ```bash kubectl apply -f examples/mysql/backup.yaml ``` -------------------------------- ### Expose Service using Cluster API Source: https://github.com/apecloud/kubeblocks/blob/main/examples/mysql/README.md Configure service exposure by updating the Cluster API's spec.services. This example shows how to add a service with specific annotations and port configurations for a MySQL component. ```yaml apiVersion: apps.kubeblocks.io/v1 kind: Cluster spec: # append service to the list services: # add annotation for cloud loadbalancer if # services.spec.type is LoadBalancer # here we use annotation for alibaba cloud for example - annotations: service.beta.kubernetes.io/alibaba-cloud-loadbalancer-address-type: internet componentSelector: mysql name: mysql-vpc serviceName: mysql-vpc # optional. it specify defined role as selector for the service. # onece specified, service will select and route traffic to Pods with the label # "kubeblocks.io/role=". # valid options are: [primary, secondary] for MySQL roleSelector: primary spec: # defines the behavior of a K8s service. ipFamilyPolicy: PreferDualStack ports: - name: tcp-mysql # port to expose port: 3306 protocol: TCP targetPort: mysql # Determines how the Service is exposed. Defaults to 'ClusterIP'. # Valid options are [`ClusterIP`, `NodePort`, and `LoadBalancer`] type: LoadBalancer componentSpecs: - name: mysql replicas: 2 ... ``` -------------------------------- ### HelmTypeInstallSpec Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/add-on.md Defines the Helm installation spec for add-ons, including chart location, installation options, values, and image details. ```APIDOC ## HelmTypeInstallSpec ### Description Defines the Helm installation spec for add-ons. ### Fields - **chartLocationURL** (string) - Specifies the URL location of the Helm Chart. - **installOptions** (HelmInstallOptions) - Optional - Defines the options for Helm release installation. - **installValues** (HelmInstallValues) - Optional - Defines the set values for Helm release installation. - **valuesMapping** (HelmValuesMapping) - Optional - Defines the mapping of add-on normalized resources parameters to Helm values’ keys. - **chartsImage** (string) - Optional - Defines the image of Helm charts. - **chartsPathInImage** (string) - Optional - Defines the path of Helm charts in the image. This path is used to copy Helm charts from the image to the shared volume. The default path is “/charts”. ``` -------------------------------- ### Install Delve via Homebrew Source: https://github.com/apecloud/kubeblocks/blob/main/docs/03 - debug.md Use this command to install Delve on macOS using Homebrew. Ensure your GOPATH/bin is in your PATH. ```shell brew install delve ``` -------------------------------- ### Create Qdrant Cluster Backup Source: https://github.com/apecloud/kubeblocks/blob/main/examples/qdrant/README.md Applies a YAML configuration to create a backup for the Qdrant cluster using the snapshot API. ```bash kubectl apply -f examples/qdrant/backup.yaml ``` -------------------------------- ### Create a Full PostgreSQL Base Backup Source: https://github.com/apecloud/kubeblocks/blob/main/examples/postgresql/README.md Apply a YAML file to create a full base backup of a PostgreSQL cluster using the `pg-basebackup` method. After execution, a `Backup` resource will be created and its status should change from `Running` to `Completed`. ```bash kubectl apply -f examples/postgresql/backup-pg-basebasekup.yaml ``` -------------------------------- ### Start Elasticsearch Component using Cluster API Source: https://github.com/apecloud/kubeblocks/blob/main/examples/elasticsearch/README.md Set the `stop` field to `false` (or remove it) for a specific component in the Cluster API specification to start that component. ```yaml spec: terminationPolicy: Delete componentSpecs: - name: master componentDef: elasticsearch-8 serviceVersion: 8.8.2 stop: false # set to `false` (or remove this field) to start the component replicas: 3 ``` -------------------------------- ### Create Full Redis Backup Source: https://github.com/apecloud/kubeblocks/blob/main/examples/redis/README.md Apply a backup configuration to initiate a full backup for the Redis component. This typically uses the `redis-cli BGSAVE` command and creates a `Backup` resource. ```bash kubectl apply -f examples/redis/backup.yaml ``` -------------------------------- ### List Supported PostgreSQL Versions Source: https://github.com/apecloud/kubeblocks/blob/main/examples/postgresql/README.md Use this command to retrieve a list of all supported PostgreSQL versions available for cluster creation. ```bash kubectl get cmpv postgresql ``` -------------------------------- ### Start MongoDB Component using Cluster API Source: https://github.com/apecloud/kubeblocks/blob/main/examples/mongodb/README.md Set the `spec.componentSpecs.stop` field to `false` (or remove the field) in your cluster configuration to start a stopped MongoDB component. This will resume its operation. ```yaml # snippet of cluster.yaml apiVersion: apps.kubeblocks.io/v1 kind: Cluster spec: componentSpecs: - name: mongodb stop: false # set to `false` (or remove this field) to start the component replicas: 3 ``` -------------------------------- ### Conventional Commit Examples for PR Titles Source: https://github.com/apecloud/kubeblocks/blob/main/docs/CONTRIBUTING.md Examples of pull request titles formatted according to the conventional commits specification. This format is mandatory as KubeBlocks squashes commits before merging. ```shell feat(apps): add foo bar baz feature ``` ```shell fix(kbcli): fix foo bar baz bug ``` ```shell chore: tidy up Makefile ``` ```shell docs: fix typos ``` -------------------------------- ### Addon Resource Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/add-on.md Defines the schema for Add-on resources in the extensions.kubeblocks.io/v1alpha1 API group. It includes fields for version, description, type, Helm installation specifics, default installation values, and CLI plugin configurations. ```APIDOC ## Addon ### Description Addon is the Schema for the add-ons API. ### Kind Addon ### API Version extensions.kubeblocks.io/v1alpha1 ### Spec - **description** (string, Optional): Specifies the description of the add-on. - **type** (AddonType): Defines the type of the add-on. The only valid value is ‘helm’. - **version** (string, Optional): Indicates the version of the add-on. - **provider** (string, Optional): Specifies the provider of the add-on. - **helm** (HelmTypeInstallSpec, Optional): Represents the Helm installation specifications. This is only processed when the type is set to ‘helm’. - **defaultInstallValues** ([]AddonDefaultInstallSpecItem): Specifies the default installation parameters. - **install** (AddonInstallSpec, Optional): Defines the installation parameters. - **installable** (InstallableSpec, Optional): Represents the installable specifications of the add-on. This includes the selector and auto-install settings. - **cliPlugins** ([]CliPlugin, Optional): Specifies the CLI plugin installation specifications. ### Status (Status fields not detailed in the source) ``` -------------------------------- ### Start Kafka Component via Cluster API Source: https://github.com/apecloud/kubeblocks/blob/main/examples/kafka/README.md Set the `spec.componentSpecs.stop` field to `false` (or remove the field entirely) in your cluster configuration to start a stopped Kafka component. This will recreate its pods and resume operations. ```yaml apiVersion: apps.kubeblocks.io/v1 kind: Cluster spec: componentSpecs: - name: kafka-combine stop: false # set to `false` (or remove this field) to start the component replicas: 1 ``` -------------------------------- ### Configure Start via Cluster API Source: https://github.com/apecloud/kubeblocks/blob/main/examples/redis/README.md Set the `stop` field to `false` (or remove it) for Redis and Redis Sentinel components within the Cluster API definition to start the cluster. Ensure all necessary fields are included. ```yaml # snippet of cluster.yaml apiVersion: apps.kubeblocks.io/v1 kind: Cluster spec: componentSpecs: - name: redis serviceVersion: "7.2.4" stop: false # set to `false` (or remove this field) to start the component replicas: 2 - name: redis-sentinel stop: false # set stop `true` to stop the component replicas: 3 .... ``` -------------------------------- ### Create MongoDB Backup Source: https://github.com/apecloud/kubeblocks/blob/main/examples/mongodb/README.md Initiate a backup for a MongoDB cluster using the 'datafile' method. Backup details will be recorded in the Backup resource. ```bash kubectl apply -f examples/mongodb/backup.yaml ``` -------------------------------- ### HelmInstallValues Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/add-on.md Specifies values for Helm installations. ```APIDOC ## HelmInstallValues ### Description Specifies values for Helm installations. ### Fields - **urls** ([]string) - Optional - Specifies the URL location of the values file. - **configMapRefs** ([]DataObjectKeySelector) - Optional - Selects a key from a ConfigMap item list. The value can be a JSON or YAML string content. Use a key name with ".json", ".yaml", or ".yml" extension to specify a content type. - **secretRefs** ([]DataObjectKeySelector) - Optional - Selects a key from a Secret item list. The value can be a JSON or YAML string content. Use a key name with ".json", ".yaml", or ".yml" extension to specify a content type. ``` -------------------------------- ### List Clusters with kbcli Source: https://github.com/apecloud/kubeblocks/blob/main/docs/01 - build.md Use `kbcli` to list all created clusters. This command helps in verifying cluster creation and status. ```bash kbcli cluster list ``` -------------------------------- ### List Supported MySQL Versions Source: https://github.com/apecloud/kubeblocks/blob/main/examples/mysql/README.md Retrieve a list of all supported MySQL versions available for deployment in KubeBlocks. ```bash kubectl get cmpv mysql ``` -------------------------------- ### Get PostgreSQL Cluster Backups Source: https://github.com/apecloud/kubeblocks/blob/main/examples/postgresql/README.md Retrieve `Backup` resources for a specific PostgreSQL cluster instance. ```bash kubectl get backup -n demo -l app.kubernetes.io/instance=pg-cluster ``` -------------------------------- ### List Supported MongoDB Versions Source: https://github.com/apecloud/kubeblocks/blob/main/examples/mongodb/README.md Displays the available component versions for MongoDB. Use this to determine valid `serviceVersion` values. ```bash kubectl get cmpv mongodb ``` -------------------------------- ### AddonSpec Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/add-on.md Defines the desired state of an add-on, including its type, version, provider, and Helm-specific installation details. ```APIDOC ## AddonSpec ### Description Defines the desired state of an add-on. ### Fields - **description** (string, optional): Specifies the description of the add-on. - **type** (AddonType): Defines the type of the add-on. The only valid value is ‘helm’. - **version** (string, optional): Indicates the version of the add-on. - **provider** (string, optional): Specifies the provider of the add-on. - **helm** (HelmTypeInstallSpec, optional): Represents the Helm installation specifications. This is only processed when the type is set to ‘helm’. - **defaultInstallValues** ([]AddonDefaultInstallSpecItem, optional): Specifies the default installation values for the add-on. ``` -------------------------------- ### Configure ToolsSetup for dynamic reloads Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/parameters.md Defines the mount point and tool configurations for preparing dynamic reload tools from a container image. ```yaml toolsSetup: mountPoint: /kb_tools toolConfigs: - name: kb-tools command: - cp - /bin/ob-tools - /kb_tools/obtools image: docker.io/apecloud/obtools ```