### Configure Tools Setup Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/cluster.md Defines how tools are prepared for dynamic reloads. This example copies a binary from an image to a specified mount path. ```yaml toolsSetup: mountPoint: /kb_tools toolConfigs: - name: kb-tools command: - cp - /bin/ob-tools - /kb_tools/obtools image: docker.io/apecloud/obtools ``` -------------------------------- ### Start MySQL Cluster Source: https://github.com/apecloud/kubeblocks/blob/main/examples/mysql/README.md Apply the start configuration to resume a stopped MySQL cluster. ```bash kubectl apply -f examples/mysql/start.yaml ``` -------------------------------- ### Start Redis Cluster Source: https://github.com/apecloud/kubeblocks/blob/main/examples/redis/README.md Apply the start configuration to bring a stopped Redis cluster online. ```bash kubectl apply -f examples/redis/start.yaml ``` -------------------------------- ### INI Configuration Example Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/parameters.md Example of configuring file format with INI specific settings, including the section name. ```yaml fileFormatConfig: format: ini iniConfig: sectionName: mysqld ``` -------------------------------- ### 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/postgresql/README.md Apply a YAML file to start a previously stopped PostgreSQL cluster. This will recreate the necessary pods to bring the cluster back online. ```bash kubectl apply -f examples/postgresql/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 ``` -------------------------------- ### ConfigConstraint Reload Action Example Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/cluster.md Demonstrates how to configure dynamic reload actions for configuration parameters. This example shows how to specify a script to be triggered for dynamic reloading. ```yaml dynamicReloadAction: tplScriptTrigger: namespace: kb-system scriptConfigMapRef: mysql-reload-script sync: true ``` -------------------------------- ### Cluster Resource (Kafka Example) Source: https://context7.com/apecloud/kubeblocks/llms.txt Defines a multi-component cluster topology, exemplified here with a Kafka setup. ```APIDOC ## Cluster ### Description Defines a multi-component cluster topology, managing the deployment and configuration of various services. ### Kind Cluster ### API Version apps.kubeblocks.io/v1 ### Metadata - **name**: (string) - The name of the cluster. - **namespace**: (string) - The namespace where the cluster resides. ### Spec - **terminationPolicy**: (string) - The policy for terminating the cluster (e.g., 'Delete'). - **clusterDef**: (string) - The definition of the cluster type (e.g., 'kafka'). - **topology**: (string) - The topology type for the cluster (e.g., 'combined_monitor'). - **componentSpecs**: (array) - Specifications for each component within the cluster. - **name**: (string) - The name of the component. - **replicas**: (integer) - The number of replicas for the component. - **env**: (array) - Environment variables for the component. - **name**: (string) - The name of the environment variable. - **value**: (string) - The value of the environment variable. - **resources**: (object) - Resource requirements for the component. - **limits**: (object) - Resource limits (e.g., cpu, memory). - **requests**: (object) - Resource requests (e.g., cpu, memory). - **volumeClaimTemplates**: (array) - Templates for persistent volume claims. - **name**: (string) - The name of the volume claim. - **spec**: (object) - Specification for the volume claim. - **accessModes**: (array) - Access modes for the volume. - **resources**: (object) - Resource requests for storage. - **requests**: (object) - Storage size request. ``` -------------------------------- ### Example Member Join Action Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/cluster.md This example demonstrates how to add a new replica to a replication group using a bash command within a member join action. It shows how to construct an SQL command to add a server to an OceanBase Cluster. ```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'" ``` -------------------------------- ### 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 ``` -------------------------------- ### Example OpsDefinition Precondition Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/operations.md This example demonstrates how to define a precondition for an operation using a Go template expression. The condition checks the status of a component before the operation proceeds. ```yaml preConditions: - rule: expression: '{{ eq .component.status.phase "Running" }}' message: Component is not in Running status. ``` -------------------------------- ### ConfigConstraint Reload Options Example Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/cluster.md This example demonstrates how to configure dynamic reload options for configuration constraints. It specifies a script to be used for hot parameter updates. ```yaml reloadOptions: tplScriptTrigger: namespace: kb-system scriptConfigMapRef: mysql-reload-script sync: true ``` -------------------------------- ### File Format Configuration Example Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/cluster.md Specifies the format of configuration files and associated parameters. Supports various formats like ini, xml, yaml, json, hcl, dotenv, properties, and toml. The example shows how to configure the 'ini' format with a specific section name. ```yaml fileFormatConfig: format: ini iniConfig: sectionName: mysqld ``` -------------------------------- ### 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 ``` -------------------------------- ### Start MongoDB Cluster using OpsRequest Source: https://github.com/apecloud/kubeblocks/blob/main/examples/mongodb/README.md Apply the provided YAML file to start a stopped MongoDB cluster. ```bash kubectl apply -f examples/mongodb/start.yaml ``` -------------------------------- ### 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 ``` -------------------------------- ### ConfigConstraint API Example Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/cluster.md Example of a ConfigConstraint resource defining reload options for dynamic parameter updates. This configuration specifies how to trigger a script for reloading parameters. ```yaml reloadOptions: tplScriptTrigger: namespace: kb-system scriptConfigMapRef: mysql-reload-script sync: true ``` -------------------------------- ### 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. ``` -------------------------------- ### 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 ``` -------------------------------- ### 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 ``` -------------------------------- ### Component ServiceRefs Example Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/cluster.md Illustrates how to define serviceRefs for a Component, enabling connections to external services or services provided by other Clusters. It shows examples for both external and cluster-internal service references. ```yaml serviceRefs: - name: "redis-sentinel" serviceDescriptor: name: "external-redis-sentinel" - name: "postgres-cluster" clusterServiceSelector: cluster: "my-postgres-cluster" service: component: "postgresql" ``` -------------------------------- ### 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. ``` -------------------------------- ### 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. ``` -------------------------------- ### Get Supported Backup Methods Source: https://github.com/apecloud/kubeblocks/blob/main/examples/mongodb/README.md Retrieve the names of supported backup methods from the cluster's BackupPolicy. ```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' ``` -------------------------------- ### 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. ``` -------------------------------- ### 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 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 ``` -------------------------------- ### Get Supported MySQL Versions Source: https://github.com/apecloud/kubeblocks/blob/main/examples/mysql/README.md Use this command to list all available MySQL component versions compatible with KubeBlocks. ```bash kubectl get cmpv mysql ``` -------------------------------- ### 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 ``` -------------------------------- ### 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 ``` -------------------------------- ### 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 ``` -------------------------------- ### Configure ToolsSetup for Dynamic Reload Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/parameters.md This example demonstrates how to set up tools for dynamic reloads using ShellTrigger. It specifies a mount point and configures a tool to copy a binary to that location. ```yaml toolsSetup: mountPoint: /kb_tools toolConfigs: - name: kb-tools command: - cp - /bin/ob-tools - /kb_tools/obtools image: docker.io/apecloud/obtools ``` -------------------------------- ### 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 ``` -------------------------------- ### UpdatedParameters Example Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/operations.md Shows how to specify updated configuration parameters for a cluster. This includes newly added, deleted, and modified configuration files. ```yaml updatedParameters: updatedKeys: my.cnf: '{"mysqld":{"max_connections":"100"}}' ``` -------------------------------- ### 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. ``` -------------------------------- ### 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 ``` -------------------------------- ### Explain PostgreSQL Cluster Configuration Source: https://github.com/apecloud/kubeblocks/blob/main/examples/postgresql/README.md Use the `kbcli` tool to explain the configuration options for a PostgreSQL cluster. This is useful for understanding available parameters and their settings. ```bash kbcli cluster explain-config pg-cluster ``` -------------------------------- ### 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 ``` -------------------------------- ### Start MySQL Cluster Source: https://context7.com/apecloud/kubeblocks/llms.txt Starts a previously stopped MySQL cluster. This operation resumes compute resources and makes the cluster available again. ```yaml # Start the cluster again apiVersion: operations.kubeblocks.io/v1alpha1 kind: OpsRequest metadata: name: mysql-start namespace: demo spec: clusterName: mysql-cluster type: Start ``` -------------------------------- ### Start MySQL Component via Cluster API Source: https://github.com/apecloud/kubeblocks/blob/main/examples/mysql/README.md Set the `spec.componentSpecs.stop` field to `false` (or remove it) in your Cluster YAML to start a stopped component. ```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 ``` -------------------------------- ### Create Datafile Backup Source: https://github.com/apecloud/kubeblocks/blob/main/examples/mongodb/README.md Apply a backup configuration to create a backup of the cluster using the 'datafile' method. Backup details will be recorded in the Backup resource. ```bash kubectl apply -f examples/mongodb/backup.yaml ``` -------------------------------- ### 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)" ``` -------------------------------- ### Create Full MySQL Backup Source: https://github.com/apecloud/kubeblocks/blob/main/examples/mysql/README.md Execute this command to create a full backup of the MySQL cluster using `xtrabackup`. Ensure a `BackupRepo` is configured beforehand. ```bash kubectl apply -f examples/mysql/backup.yaml ``` -------------------------------- ### View Redis Component Startup Orders Source: https://github.com/apecloud/kubeblocks/blob/main/examples/redis/README.md Retrieves and displays the startup order of components for the Redis 'replication' topology from the KubeBlocks ClusterDefinition. ```bash kubectl get cd redis -oyaml | yq '.spec.topologies[] | select(.name=="replication") | .orders' ``` -------------------------------- ### 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 the Cluster API to start a stopped MongoDB component. ```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 ``` -------------------------------- ### Configure File Format and INI Settings Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/cluster.md Specifies the configuration file format and its associated parameters. This example shows how to set the format to 'ini' and define a specific section name. ```yaml fileFormatConfig: format: ini iniConfig: sectionName: mysqld ``` -------------------------------- ### RolloutPromotion Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/cluster.md Configuration for promoting instances during a rollout. ```APIDOC ## RolloutPromotion ### Description Specifies how new instances are promoted during a rollout. ### Fields - **auto** (bool) - Optional - If true, automatically promotes new instances. - **delaySeconds** (int32) - Optional - The delay in seconds before promoting new instances. - **condition** (RolloutPromoteCondition) - Optional - The condition that must be met for promotion. - **scaleDownDelaySeconds** (int32) - Optional - The delay in seconds before scaling down old instances after promotion. ``` -------------------------------- ### 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 ``` -------------------------------- ### Configuration Formats and Parameters Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/parameters.md Details supported configuration file formats and how to specify format-specific parameters, such as the section name for INI files. ```APIDOC ## Configuration Formats Supported formats include `ini`, `xml`, `yaml`, `json`, `hcl`, `dotenv`, `properties`, and `toml`. ### Format-Specific Parameters Each format may have its own set of parameters that can be configured. For instance, when using the `ini` format, you can specify the section name. #### Example (INI Format) ```yaml fileFormatConfig: format: ini iniConfig: sectionName: mysqld ``` ``` -------------------------------- ### 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 ``` -------------------------------- ### Apply Restore Configuration Source: https://github.com/apecloud/kubeblocks/blob/main/examples/mongodb/README.md Apply a restore configuration to create a new cluster from a backup. Ensure placeholder values are updated before applying. ```bash kubectl apply -f examples/mongodb/restore.yaml ``` -------------------------------- ### ReadinessProbeExecAction Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/dataprotection.md Specifies an exec action for a readiness probe, defining the command to execute within the container to check readiness. ```APIDOC ## ReadinessProbeExecAction ### Description Specifies an exec action for a readiness probe, defining the command to execute within the container to check readiness. ### Fields - **image** (string) - Refers to the container image. - **command** ([]string) - Refers to the container command. ``` -------------------------------- ### Configure Redis Cluster with Sharding and NodePort Service Source: https://github.com/apecloud/kubeblocks/blob/main/examples/redis/README.md This example shows how to create a Redis cluster with 3 shards, each having 2 replicas. It also demonstrates overriding the `redis-advertised` service to use `NodePort` for external access. ```yaml apiVersion: apps.kubeblocks.io/v1 kind: Cluster spec: shardings: - name: shard shards: 3 # set the desired number of shards. template: name: redis componentDef: redis-cluster-7 replicas: 2 # set the desired number of replicas for each shard. serviceVersion: 7.2.4 # Component-level services override services defined in # referenced ComponentDefinition and expose # endpoints that can be accessed by clients # This example explicitly override the svc `redis-advertised` to use the NodePort services: - name: redis-advertised # This is a per-pod svc, and will be used to parse advertised endpoints podService: true # - NodePort # - LoadBalancer serviceType: NodePort ... ``` -------------------------------- ### Expose Service using Cluster API (Snippet) Source: https://github.com/apecloud/kubeblocks/blob/main/examples/postgresql/README.md Snippet showing how to expose a PostgreSQL service by updating the Cluster resource's 'services' list. Includes example annotations for Alibaba Cloud. ```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: postgresql name: postgresql-vpc serviceName: postgresql-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 postgresql roleSelector: primary spec: # defines the behavior of a K8s service. ipFamilyPolicy: PreferDualStack ports: - name: tcp-postgresql # port to expose port: 5432 protocol: TCP targetPort: tcp-postgresql type: LoadBalancer ``` -------------------------------- ### Cloud Load Balancer Annotations Example (Alibaba Cloud) Source: https://github.com/apecloud/kubeblocks/blob/main/examples/postgresql/README.md Example of annotations for Alibaba Cloud when exposing a service of type LoadBalancer. Use 'internet' or 'intranet' for address type. ```yaml # alibaba cloud service.beta.kubernetes.io/alibaba-cloud-loadbalancer-address-type: "internet" # or "intranet" ``` -------------------------------- ### RolloutPromoteCondition Source: https://github.com/apecloud/kubeblocks/blob/main/docs/developer_docs/api-reference/cluster.md Defines conditions for promoting new instances during a rollout. ```APIDOC ## RolloutPromoteCondition ### Description Conditions that must be met before promoting new instances. ### Fields - **prev** (Action) - Optional - The condition that must be met before promoting new instances. - **post** (Action) - Optional - The condition that is checked after new instances are successfully promoted. ``` -------------------------------- ### 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 ``` -------------------------------- ### 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 ``` -------------------------------- ### Create a Managed Database Cluster Source: https://context7.com/apecloud/kubeblocks/llms.txt This section details how to create a managed database cluster using the `Cluster` resource. It shows an example of creating a MySQL cluster with specified replicas, resources, and storage. ```APIDOC ## Cluster — Create a managed database cluster The `Cluster` resource (`apps.kubeblocks.io/v1`) is the primary user-facing object. It references a `ClusterDefinition` and topology, or directly references `ComponentDefinition` names in each `componentSpec`. It controls termination policy, replicas, resources, storage, TLS, and service exposure for every component in the cluster. The `status.phase` field tracks the cluster lifecycle: `Creating`, `Running`, `Updating`, `Stopping`, `Stopped`, `Deleting`, `Failed`, `Abnormal`. ### Request Example ```yaml # MySQL 2-replica cluster using a named ComponentDefinition apiVersion: apps.kubeblocks.io/v1 kind: Cluster metadata: name: mysql-cluster namespace: demo spec: terminationPolicy: Delete # DoNotTerminate | Delete | WipeOut componentSpecs: - name: mysql componentDef: "mysql-8.0" # matches any CMPD named with 'mysql-8.0-' serviceVersion: "8.0.35" disableExporter: false replicas: 2 resources: requests: cpu: "0.5" memory: "0.5Gi" limits: cpu: "0.5" memory: "0.5Gi" volumeClaimTemplates: - name: data spec: storageClassName: "" # uses default StorageClass accessModes: [ReadWriteOnce] resources: requests: storage: 20Gi ``` ### Response Example ```yaml # Check cluster status # kubectl get cluster mysql-cluster -n demo # NAME CLUSTER-DEFINITION TERMINATION-POLICY STATUS AGE # mysql-cluster Delete Running 2m ``` ``` -------------------------------- ### Cloud Load Balancer Annotations Example (AWS) Source: https://github.com/apecloud/kubeblocks/blob/main/examples/postgresql/README.md Example of annotations for AWS when exposing a service of type LoadBalancer. Specify 'nlb' for Network Load Balancer and 'true'/'false' for internal access. ```yaml # aws service.beta.kubernetes.io/aws-load-balancer-type: nlb # Use Network Load Balancer service.beta.kubernetes.io/aws-load-balancer-internal: "true" # or "false" for internet ```