diff --git a/examples/apecloud-mysql/README.md b/examples/apecloud-mysql/README.md index 72329770b6d..9caab620fd2 100644 --- a/examples/apecloud-mysql/README.md +++ b/examples/apecloud-mysql/README.md @@ -6,13 +6,8 @@ ApeCloud MySQL is a database that is compatible with MySQL syntax and achieves h This example assumes that you have a Kubernetes cluster installed and running, and that you have installed the kubectl command line tool and helm somewhere in your path. Please see the [getting started](https://kubernetes.io/docs/setup/) and [Installing Helm](https://helm.sh/docs/intro/install/) for installation instructions for your platform. -Also, this example requires kubeblocks installed and running. Here is the steps to install kubeblocks, please replace "0.9.0" with the version you want to use. +Also, this example requires kubeblocks installed and running. Here is the steps to install kubeblocks, please replace "`$kb_version`" with the version you want to use. ```bash -# Create dependent CRDs -kubectl create -f https://github.com/apecloud/kubeblocks/releases/download/v0.9.0/kubeblocks_crds.yaml -# If github is not accessible or very slow for you, please use following command instead -kubectl create -f https://jihulab.com/api/v4/projects/98723/packages/generic/kubeblocks/v0.9.0/kubeblocks_crds.yaml - # Add Helm repo helm repo add kubeblocks https://apecloud.github.io/helm-charts # If github is not accessible or very slow for you, please use following repo instead @@ -21,8 +16,18 @@ helm repo add kubeblocks https://jihulab.com/api/v4/projects/85949/packages/helm # Update helm repo helm repo update +# Get the versions of KubeBlocks and select the one you want to use +helm search repo kubeblocks/kubeblocks --versions +# If you want to obtain the development versions of KubeBlocks, Please add the '--devel' parameter as the following command +helm search repo kubeblocks/kubeblocks --versions --devel + +# Create dependent CRDs +kubectl create -f https://github.com/apecloud/kubeblocks/releases/download/v$kb_version/kubeblocks_crds.yaml +# If github is not accessible or very slow for you, please use following command instead +kubectl create -f https://jihulab.com/api/v4/projects/98723/packages/generic/kubeblocks/v$kb_version/kubeblocks_crds.yaml + # Install KubeBlocks -helm install kubeblocks kubeblocks/kubeblocks --namespace kb-system --create-namespace --version="0.9.0" +helm install kubeblocks kubeblocks/kubeblocks --namespace kb-system --create-namespace --version="$kb_version" ``` diff --git a/examples/apecloud-mysql/cluster-cmpd.yaml b/examples/apecloud-mysql/cluster-cmpd.yaml index b1a7dc3c1b6..87f3766a8d3 100644 --- a/examples/apecloud-mysql/cluster-cmpd.yaml +++ b/examples/apecloud-mysql/cluster-cmpd.yaml @@ -3,6 +3,8 @@ kind: Cluster metadata: name: acmysql-cluster namespace: default + labels: + auditLogEnabled: "false" spec: # Specifies the behavior when a Cluster is deleted. # - `DoNotTerminate`: Prevents deletion of the Cluster. This policy ensures that all resources remain intact. @@ -16,18 +18,6 @@ spec: - name: mysql # References the name of a ComponentDefinition. The ComponentDefinition specifies the behavior and characteristics of the Component. If both `componentDefRef` and `componentDef` are provided, the `componentDef` will take precedence over `componentDefRef`. componentDef: apecloud-mysql - # Specifies a group of affinity scheduling rules for the Component. It allows users to control how the Component's Pods are scheduled onto nodes in the cluster. - affinity: - podAntiAffinity: Preferred - topologyKeys: - - kubernetes.io/hostname - tenancy: SharedNode - # Allows the Component to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule # Specifies which types of logs should be collected for the Cluster. enabledLogs: - error diff --git a/examples/apecloud-mysql/cluster-proxy.yaml b/examples/apecloud-mysql/cluster-proxy.yaml index 2d9ab13eeec..3211de558f7 100644 --- a/examples/apecloud-mysql/cluster-proxy.yaml +++ b/examples/apecloud-mysql/cluster-proxy.yaml @@ -3,41 +3,23 @@ kind: Cluster metadata: name: acmysql-cluster namespace: default + annotations: + kubeblocks.io/extra-env: '{"KB_PROXY_ENABLED":"on","ETCDCTL_API": "3"}' + labels: + auditLogEnabled: "false" spec: - # Specifies the name of the ClusterDefinition to use when creating a Cluster. - clusterDefinitionRef: apecloud-mysql - # Refers to the ClusterVersion name. Deprecated since v0.9, use ComponentVersion instead. This field is maintained for backward compatibility and its use is discouraged. Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases. - clusterVersionRef: ac-mysql-8.0.30 # Specifies the behavior when a Cluster is deleted. # - `DoNotTerminate`: Prevents deletion of the Cluster. This policy ensures that all resources remain intact. # - `Halt`: Deletes Cluster resources like Pods and Services but retains Persistent Volume Claims (PVCs), allowing for data preservation while stopping other operations. # - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data. # - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss. terminationPolicy: Delete - # Defines a set of node affinity scheduling rules for the Cluster's Pods. This field helps control the placement of Pods on nodes within the cluster. - affinity: - # Specifies the anti-affinity level of Pods within a Component. It determines how pods should be spread across nodes to improve availability and performance. - podAntiAffinity: Preferred - # Represents the key of node labels used to define the topology domain for Pod anti-affinity and Pod spread constraints. - topologyKeys: - - kubernetes.io/hostname - # Determines the level of resource isolation between Pods. It can have the following values: `SharedNode` and `DedicatedNode`. - # - SharedNode: Allow that multiple Pods may share the same node, which is the default behavior of K8s. - # - DedicatedNode: Each Pod runs on a dedicated node, ensuring that no two Pods share the same node. - tenancy: SharedNode - # An array that specifies tolerations attached to the Cluster's Pods, allowing them to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: "true" - effect: NoSchedule # Specifies a list of ClusterComponentSpec objects used to define the individual components that make up a Cluster. This field allows for detailed configuration of each component within the Cluster. Note: `shardingSpecs` and `componentSpecs` cannot both be empty; at least one must be defined to configure a cluster. ClusterComponentSpec defines the specifications for a Component in a Cluster. componentSpecs: - name: mysql - componentDefRef: mysql + componentDef: apecloud-mysql enabledLogs: - error - - general - slow disableExporter: true replicas: 3 @@ -57,13 +39,25 @@ spec: resources: requests: storage: 20Gi - - componentDefRef: vtcontroller - enabledLogs: - - error - - warning - - info + - componentDef: etcd + disableExporter: true + name: etcd + replicas: 3 + resources: + limits: + cpu: '0.5' + memory: 0.5Gi + volumeClaimTemplates: + - name: data + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 20Gi + - componentDef: wescale-ctrl disableExporter: true - name: vtcontroller + name: wescale-ctrl replicas: 1 resources: limits: @@ -77,14 +71,14 @@ spec: resources: requests: storage: 20Gi - - componentDefRef: vtgate + - componentDef: wescale enabledLogs: - error - warning - info - queryLog disableExporter: true - name: vtgate + name: wescale replicas: 1 resources: limits: diff --git a/examples/apecloud-mysql/cluster.yaml b/examples/apecloud-mysql/cluster.yaml index ecd197dfa20..1d35d91a228 100644 --- a/examples/apecloud-mysql/cluster.yaml +++ b/examples/apecloud-mysql/cluster.yaml @@ -3,40 +3,21 @@ kind: Cluster metadata: name: acmysql-cluster namespace: default + labels: + auditLogEnabled: "false" spec: - # Specifies the name of the ClusterDefinition to use when creating a Cluster. - clusterDefinitionRef: apecloud-mysql - # Refers to the ClusterVersion name. Deprecated since v0.9, use ComponentVersion instead. This field is maintained for backward compatibility and its use is discouraged. Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases. - clusterVersionRef: ac-mysql-8.0.30 # Specifies the behavior when a Cluster is deleted. # - `DoNotTerminate`: Prevents deletion of the Cluster. This policy ensures that all resources remain intact. # - `Halt`: Deletes Cluster resources like Pods and Services but retains Persistent Volume Claims (PVCs), allowing for data preservation while stopping other operations. # - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data. # - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss. terminationPolicy: Delete - # Defines a set of node affinity scheduling rules for the Cluster's Pods. This field helps control the placement of Pods on nodes within the cluster. - affinity: - # Specifies the anti-affinity level of Pods within a Component. It determines how pods should be spread across nodes to improve availability and performance. - podAntiAffinity: Preferred - # Represents the key of node labels used to define the topology domain for Pod anti-affinity and Pod spread constraints. - topologyKeys: - - kubernetes.io/hostname - # Determines the level of resource isolation between Pods. It can have the following values: `SharedNode` and `DedicatedNode`. - # - SharedNode: Allow that multiple Pods may share the same node, which is the default behavior of K8s. - # - DedicatedNode: Each Pod runs on a dedicated node, ensuring that no two Pods share the same node. - tenancy: SharedNode - # An array that specifies tolerations attached to the Cluster's Pods, allowing them to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule # Specifies a list of ClusterComponentSpec objects used to define the individual components that make up a Cluster. This field allows for detailed configuration of each component within the Cluster. # Note: `shardingSpecs` and `componentSpecs` cannot both be empty; at least one must be defined to configure a cluster. # ClusterComponentSpec defines the specifications for a Component in a Cluster. componentSpecs: - name: mysql - componentDefRef: mysql + componentDef: apecloud-mysql enabledLogs: - error - general diff --git a/examples/apecloud-mysql/configure-vtgate.yaml b/examples/apecloud-mysql/configure-vtgate.yaml index b2c69de9609..362aa7860b2 100644 --- a/examples/apecloud-mysql/configure-vtgate.yaml +++ b/examples/apecloud-mysql/configure-vtgate.yaml @@ -11,7 +11,7 @@ spec: # Specifies a component and its configuration updates. This field is deprecated and replaced by `reconfigures`. reconfigure: # Specifies the name of the Component. - componentName: vtgate + componentName: wescale # Contains a list of ConfigurationItem objects, specifying the Component's configuration template name, upgrade policy, and parameter key-value pairs to be updated. configurations: # Sets the parameters to be updated. It should contain at least one item. diff --git a/examples/apecloud-mysql/restore-cmpd.yaml b/examples/apecloud-mysql/restore-cmpd.yaml index 0a7bdd2d985..70f5a64c3e5 100644 --- a/examples/apecloud-mysql/restore-cmpd.yaml +++ b/examples/apecloud-mysql/restore-cmpd.yaml @@ -3,6 +3,8 @@ kind: Cluster metadata: name: acmysql-cluster-restore namespace: default + labels: + auditLogEnabled: "false" annotations: kubeblocks.io/restore-from-backup: '{"mysql":{"connectionPassword":"","name":"acmysql-cluster-backup","namespace":"default","volumeRestorePolicy":"Parallel"}}' spec: @@ -18,18 +20,6 @@ spec: - name: mysql # References the name of a ComponentDefinition. The ComponentDefinition specifies the behavior and characteristics of the Component. If both `componentDefRef` and `componentDef` are provided, the `componentDef` will take precedence over `componentDefRef`. componentDef: apecloud-mysql - # Specifies a group of affinity scheduling rules for the Component. It allows users to control how the Component's Pods are scheduled onto nodes in the cluster. - affinity: - podAntiAffinity: Preferred - topologyKeys: - - kubernetes.io/hostname - tenancy: SharedNode - # Allows the Component to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule # Specifies which types of logs should be collected for the Cluster. enabledLogs: - error diff --git a/examples/apecloud-mysql/restore.yaml b/examples/apecloud-mysql/restore.yaml index 61279f4094a..71685c2fb26 100644 --- a/examples/apecloud-mysql/restore.yaml +++ b/examples/apecloud-mysql/restore.yaml @@ -3,42 +3,23 @@ kind: Cluster metadata: name: acmysql-cluster-restore namespace: default + labels: + auditLogEnabled: "false" annotations: kubeblocks.io/restore-from-backup: '{"mysql":{"connectionPassword":"","name":"acmysql-cluster-backup","namespace":"default","volumeRestorePolicy":"Parallel"}}' spec: - # Specifies the name of the ClusterDefinition to use when creating a Cluster. - clusterDefinitionRef: apecloud-mysql - # Refers to the ClusterVersion name. Deprecated since v0.9, use ComponentVersion instead. This field is maintained for backward compatibility and its use is discouraged. Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases. - clusterVersionRef: ac-mysql-8.0.30 # Specifies the behavior when a Cluster is deleted. # - `DoNotTerminate`: Prevents deletion of the Cluster. This policy ensures that all resources remain intact. # - `Halt`: Deletes Cluster resources like Pods and Services but retains Persistent Volume Claims (PVCs), allowing for data preservation while stopping other operations. # - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data. # - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss. terminationPolicy: Delete - # Defines a set of node affinity scheduling rules for the Cluster's Pods. This field helps control the placement of Pods on nodes within the cluster. - affinity: - # Specifies the anti-affinity level of Pods within a Component. It determines how pods should be spread across nodes to improve availability and performance. - podAntiAffinity: Preferred - # Represents the key of node labels used to define the topology domain for Pod anti-affinity and Pod spread constraints. - topologyKeys: - - kubernetes.io/hostname - # Determines the level of resource isolation between Pods. It can have the following values: `SharedNode` and `DedicatedNode`. - # - SharedNode: Allow that multiple Pods may share the same node, which is the default behavior of K8s. - # - DedicatedNode: Each Pod runs on a dedicated node, ensuring that no two Pods share the same node. - tenancy: SharedNode - # An array that specifies tolerations attached to the Cluster's Pods, allowing them to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule # Specifies a list of ClusterComponentSpec objects used to define the individual components that make up a Cluster. This field allows for detailed configuration of each component within the Cluster. # Note: `shardingSpecs` and `componentSpecs` cannot both be empty; at least one must be defined to configure a cluster. # ClusterComponentSpec defines the specifications for a Component in a Cluster. componentSpecs: - name: mysql - componentDefRef: mysql + componentDef: apecloud-mysql enabledLogs: - error - general diff --git a/examples/kafka/README.md b/examples/kafka/README.md index 8df15045847..1a5eb5848a3 100644 --- a/examples/kafka/README.md +++ b/examples/kafka/README.md @@ -6,13 +6,8 @@ Apache Kafka is a distributed streaming platform designed to build real-time pip This example assumes that you have a Kubernetes cluster installed and running, and that you have installed the kubectl command line tool and helm somewhere in your path. Please see the [getting started](https://kubernetes.io/docs/setup/) and [Installing Helm](https://helm.sh/docs/intro/install/) for installation instructions for your platform. -Also, this example requires kubeblocks installed and running. Here is the steps to install kubeblocks, please replace "0.9.0" with the version you want to use. +Also, this example requires kubeblocks installed and running. Here is the steps to install kubeblocks, please replace "`$kb_version`" with the version you want to use. ```bash -# Create dependent CRDs -kubectl create -f https://github.com/apecloud/kubeblocks/releases/download/v0.9.0/kubeblocks_crds.yaml -# If github is not accessible or very slow for you, please use following command instead -kubectl create -f https://jihulab.com/api/v4/projects/98723/packages/generic/kubeblocks/v0.9.0/kubeblocks_crds.yaml - # Add Helm repo helm repo add kubeblocks https://apecloud.github.io/helm-charts # If github is not accessible or very slow for you, please use following repo instead @@ -21,8 +16,18 @@ helm repo add kubeblocks https://jihulab.com/api/v4/projects/85949/packages/helm # Update helm repo helm repo update +# Get the versions of KubeBlocks and select the one you want to use +helm search repo kubeblocks/kubeblocks --versions +# If you want to obtain the development versions of KubeBlocks, Please add the '--devel' parameter as the following command +helm search repo kubeblocks/kubeblocks --versions --devel + +# Create dependent CRDs +kubectl create -f https://github.com/apecloud/kubeblocks/releases/download/v$kb_version/kubeblocks_crds.yaml +# If github is not accessible or very slow for you, please use following command instead +kubectl create -f https://jihulab.com/api/v4/projects/98723/packages/generic/kubeblocks/v$kb_version/kubeblocks_crds.yaml + # Install KubeBlocks -helm install kubeblocks kubeblocks/kubeblocks --namespace kb-system --create-namespace --version="0.9.0" +helm install kubeblocks kubeblocks/kubeblocks --namespace kb-system --create-namespace --version="$kb_version" ``` diff --git a/examples/kafka/cluster-cmpd.yaml b/examples/kafka/cluster-cmpd.yaml index aeb02f9e15e..2c6751fc54c 100644 --- a/examples/kafka/cluster-cmpd.yaml +++ b/examples/kafka/cluster-cmpd.yaml @@ -41,16 +41,6 @@ spec: componentDef: kafka-combine tls: false replicas: 1 - affinity: - podAntiAffinity: Preferred - topologyKeys: - - kubernetes.io/hostname - tenancy: SharedNode - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule serviceAccountName: kb-kafka-cluster resources: limits: diff --git a/examples/kafka/cluster-combined-cmpd.yaml b/examples/kafka/cluster-combined-cmpd.yaml index aeb02f9e15e..59bb7e4ece6 100644 --- a/examples/kafka/cluster-combined-cmpd.yaml +++ b/examples/kafka/cluster-combined-cmpd.yaml @@ -5,12 +5,7 @@ metadata: namespace: default annotations: # kafka broker's jvm heap setting - "kubeblocks.io/extra-env": '{"KB_KAFKA_ENABLE_SASL":"false","KB_KAFKA_BROKER_HEAP":"-XshowSettings:vm -XX:MaxRAMPercentage=100 -Ddepth=64","KB_KAFKA_CONTROLLER_HEAP":"-XshowSettings:vm -XX:MaxRAMPercentage=100 -Ddepth=64","KB_KAFKA_PUBLIC_ACCESS":"false", "KB_KAFKA_BROKER_NODEPORT": "false"}' - # Define kafka cluster annotation keys for nodeport feature gate. - kubeblocks.io/enabled-pod-ordinal-svc: broker - # enable NodePort - # kubeblocks.io/enabled-node-port-svc: broker - # kubeblocks.io/disabled-cluster-ip-svc: broker + "kubeblocks.io/extra-env": '{"KB_KAFKA_ENABLE_SASL":"false","KB_KAFKA_BROKER_HEAP":"-XshowSettings:vm -XX:MaxRAMPercentage=100 -Ddepth=64","KB_KAFKA_CONTROLLER_HEAP":"-XshowSettings:vm -XX:MaxRAMPercentage=100 -Ddepth=64","KB_KAFKA_PUBLIC_ACCESS":"false"}' spec: # Specifies the behavior when a Cluster is deleted. # - `DoNotTerminate`: Prevents deletion of the Cluster. This policy ensures that all resources remain intact. @@ -18,39 +13,18 @@ spec: # - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data. # - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss. terminationPolicy: Delete - # Defines the list of services that are exposed by a Cluster. This field allows selected components, either from `componentSpecs` or `shardingSpecs`, to be exposed as cluster-level services. Services defined here can be referenced by other clusters using the ServiceRefClusterSelector. - services: - # Defines the list of services that are exposed by a Cluster. This field allows selected components, either from `componentSpecs` or `shardingSpecs`, to be exposed as cluster-level services. Services defined here can be referenced by other clusters using the ServiceRefClusterSelector. - - name: bootstrap - # Defines the list of services that are exposed by a Cluster. This field allows selected components, either from `componentSpecs` or `shardingSpecs`, to be exposed as cluster-level services. Services defined here can be referenced by other clusters using the ServiceRefClusterSelector. - serviceName: bootstrap - # Defines the list of services that are exposed by a Cluster. This field allows selected components, either from `componentSpecs` or `shardingSpecs`, to be exposed as cluster-level services. Services defined here can be referenced by other clusters using the ServiceRefClusterSelector. - componentSelector: broker - # Defines the list of services that are exposed by a Cluster. This field allows selected components, either from `componentSpecs` or `shardingSpecs`, to be exposed as cluster-level services. Services defined here can be referenced by other clusters using the ServiceRefClusterSelector. - spec: - # - ClusterIP - # - NodePort - type: ClusterIP - ports: - - name: kafka-client - targetPort: 9092 - port: 9092 # Specifies a list of ClusterComponentSpec objects used to define the individual components that make up a Cluster. This field allows for detailed configuration of each component within the Cluster. Note: `shardingSpecs` and `componentSpecs` cannot both be empty; at least one must be defined to configure a cluster. ClusterComponentSpec defines the specifications for a Component in a Cluster. componentSpecs: - name: broker componentDef: kafka-combine tls: false replicas: 1 - affinity: - podAntiAffinity: Preferred - topologyKeys: - - kubernetes.io/hostname - tenancy: SharedNode - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule + serviceVersion: 3.3.2 + services: +# If enable client protocol in NodePort network type +# - name: advertised-listener +# podService: true +# serviceType: NodePort serviceAccountName: kb-kafka-cluster resources: limits: diff --git a/examples/kafka/cluster-separated-cmpd.yaml b/examples/kafka/cluster-separated-cmpd.yaml index 034d376c9db..fcaadb82895 100644 --- a/examples/kafka/cluster-separated-cmpd.yaml +++ b/examples/kafka/cluster-separated-cmpd.yaml @@ -5,12 +5,7 @@ metadata: namespace: default annotations: # kafka broker's jvm heap setting - "kubeblocks.io/extra-env": '{"KB_KAFKA_ENABLE_SASL":"false","KB_KAFKA_BROKER_HEAP":"-XshowSettings:vm -XX:MaxRAMPercentage=100 -Ddepth=64","KB_KAFKA_CONTROLLER_HEAP":"-XshowSettings:vm -XX:MaxRAMPercentage=100 -Ddepth=64","KB_KAFKA_PUBLIC_ACCESS":"false", "KB_KAFKA_BROKER_NODEPORT": "false"}' - # Define kafka cluster annotation keys for nodeport feature gate. - kubeblocks.io/enabled-pod-ordinal-svc: broker - # enable NodePort - # kubeblocks.io/enabled-node-port-svc: broker - # kubeblocks.io/disabled-cluster-ip-svc: broker + "kubeblocks.io/extra-env": '{"KB_KAFKA_ENABLE_SASL":"false","KB_KAFKA_BROKER_HEAP":"-XshowSettings:vm -XX:MaxRAMPercentage=100 -Ddepth=64","KB_KAFKA_CONTROLLER_HEAP":"-XshowSettings:vm -XX:MaxRAMPercentage=100 -Ddepth=64","KB_KAFKA_PUBLIC_ACCESS":"false"}' spec: # Specifies the behavior when a Cluster is deleted. # - `DoNotTerminate`: Prevents deletion of the Cluster. This policy ensures that all resources remain intact. @@ -18,36 +13,17 @@ spec: # - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data. # - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss. terminationPolicy: Delete - # Defines the list of services that are exposed by a Cluster. This field allows selected components, either from `componentSpecs` or `shardingSpecs`, to be exposed as cluster-level services. Services defined here can be referenced by other clusters using the ServiceRefClusterSelector. - services: - # Defines the list of services that are exposed by a Cluster. This field allows selected components, either from `componentSpecs` or `shardingSpecs`, to be exposed as cluster-level services. Services defined here can be referenced by other clusters using the ServiceRefClusterSelector. - - name: bootstrap - serviceName: bootstrap - componentSelector: broker - spec: - # - ClusterIP - # - NodePort - type: ClusterIP - ports: - - name: kafka-client - targetPort: 9092 - port: 9092 # Specifies a list of ClusterComponentSpec objects used to define the individual components that make up a Cluster. This field allows for detailed configuration of each component within the Cluster. Note: `shardingSpecs` and `componentSpecs` cannot both be empty; at least one must be defined to configure a cluster. ClusterComponentSpec defines the specifications for a Component in a Cluster. componentSpecs: - name: broker componentDef: kafka-broker tls: false replicas: 1 - affinity: - podAntiAffinity: Preferred - topologyKeys: - - kubernetes.io/hostname - tenancy: SharedNode - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule +# If enable client protocol in NodePort network type +# services: +# - name: advertised-listener +# podService: true +# serviceType: NodePort serviceAccountName: kb-kafka-cluster resources: limits: diff --git a/examples/kafka/cluster-separated.yaml b/examples/kafka/cluster-separated.yaml index db0fb24f898..4848a31532c 100644 --- a/examples/kafka/cluster-separated.yaml +++ b/examples/kafka/cluster-separated.yaml @@ -22,23 +22,6 @@ spec: # - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data. # - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss. terminationPolicy: Delete - # Defines a set of node affinity scheduling rules for the Cluster's Pods. This field helps control the placement of Pods on nodes within the cluster. - affinity: - # Specifies the anti-affinity level of Pods within a Component. It determines how pods should be spread across nodes to improve availability and performance. - podAntiAffinity: Preferred - # Represents the key of node labels used to define the topology domain for Pod anti-affinity and Pod spread constraints. - topologyKeys: - - kubernetes.io/hostname - # Determines the level of resource isolation between Pods. It can have the following values: `SharedNode` and `DedicatedNode`. - # - SharedNode: Allow that multiple Pods may share the same node, which is the default behavior of K8s. - # - DedicatedNode: Each Pod runs on a dedicated node, ensuring that no two Pods share the same node. - tenancy: SharedNode - # An array that specifies tolerations attached to the Cluster's Pods, allowing them to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: "true" - effect: NoSchedule # Defines the services to access a cluster. services: - name: bootstrap diff --git a/examples/kafka/cluster.yaml b/examples/kafka/cluster.yaml index e56c436c153..fed7b97de5f 100644 --- a/examples/kafka/cluster.yaml +++ b/examples/kafka/cluster.yaml @@ -22,23 +22,6 @@ spec: # - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data. # - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss. terminationPolicy: Delete - # Defines a set of node affinity scheduling rules for the Cluster's Pods. This field helps control the placement of Pods on nodes within the cluster. - affinity: - # Specifies the anti-affinity level of Pods within a Component. It determines how pods should be spread across nodes to improve availability and performance. - podAntiAffinity: Preferred - # Represents the key of node labels used to define the topology domain for Pod anti-affinity and Pod spread constraints. - topologyKeys: - - kubernetes.io/hostname - # Determines the level of resource isolation between Pods. It can have the following values: `SharedNode` and `DedicatedNode`. - # - SharedNode: Allow that multiple Pods may share the same node, which is the default behavior of K8s. - # - DedicatedNode: Each Pod runs on a dedicated node, ensuring that no two Pods share the same node. - tenancy: SharedNode - # An array that specifies tolerations attached to the Cluster's Pods, allowing them to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: "true" - effect: NoSchedule services: - name: bootstrap serviceName: bootstrap diff --git a/examples/llm/README.md b/examples/llm/README.md index 8c4b43263f1..c0ff1a07f91 100644 --- a/examples/llm/README.md +++ b/examples/llm/README.md @@ -6,13 +6,8 @@ LLM is a fast and easy-to-use library for LLM inference and serving This example assumes that you have a Kubernetes cluster installed and running, and that you have installed the kubectl command line tool and helm somewhere in your path. Please see the [getting started](https://kubernetes.io/docs/setup/) and [Installing Helm](https://helm.sh/docs/intro/install/) for installation instructions for your platform. -Also, this example requires kubeblocks installed and running. Here is the steps to install kubeblocks, please replace "0.9.0" with the version you want to use. +Also, this example requires kubeblocks installed and running. Here is the steps to install kubeblocks, please replace "`$kb_version`" with the version you want to use. ```bash -# Create dependent CRDs -kubectl create -f https://github.com/apecloud/kubeblocks/releases/download/v0.9.0/kubeblocks_crds.yaml -# If github is not accessible or very slow for you, please use following command instead -kubectl create -f https://jihulab.com/api/v4/projects/98723/packages/generic/kubeblocks/v0.9.0/kubeblocks_crds.yaml - # Add Helm repo helm repo add kubeblocks https://apecloud.github.io/helm-charts # If github is not accessible or very slow for you, please use following repo instead @@ -21,8 +16,18 @@ helm repo add kubeblocks https://jihulab.com/api/v4/projects/85949/packages/helm # Update helm repo helm repo update +# Get the versions of KubeBlocks and select the one you want to use +helm search repo kubeblocks/kubeblocks --versions +# If you want to obtain the development versions of KubeBlocks, Please add the '--devel' parameter as the following command +helm search repo kubeblocks/kubeblocks --versions --devel + +# Create dependent CRDs +kubectl create -f https://github.com/apecloud/kubeblocks/releases/download/v$kb_version/kubeblocks_crds.yaml +# If github is not accessible or very slow for you, please use following command instead +kubectl create -f https://jihulab.com/api/v4/projects/98723/packages/generic/kubeblocks/v$kb_version/kubeblocks_crds.yaml + # Install KubeBlocks -helm install kubeblocks kubeblocks/kubeblocks --namespace kb-system --create-namespace --version="0.9.0" +helm install kubeblocks kubeblocks/kubeblocks --namespace kb-system --create-namespace --version="$kb_version" ``` Enable llm ```bash @@ -34,7 +39,7 @@ helm repo add kubeblocks-addons https://jihulab.com/api/v4/projects/150246/packa helm repo update # Enable llm -helm upgrade -i kb-addon-llm kubeblocks-addons/llm --version 0.9.0 -n kb-system +helm upgrade -i kb-addon-llm kubeblocks-addons/llm --version $kb_version -n kb-system ``` ## Examples diff --git a/examples/llm/cluster.yaml b/examples/llm/cluster.yaml index 4e133d49a2d..c64caaa9d65 100644 --- a/examples/llm/cluster.yaml +++ b/examples/llm/cluster.yaml @@ -6,31 +6,12 @@ metadata: spec: # Specifies the name of the ClusterDefinition to use when creating a Cluster. clusterDefinitionRef: vllm - # Refers to the ClusterVersion name. Deprecated since v0.9, use ComponentVersion instead. This field is maintained for backward compatibility and its use is discouraged. Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases. - clusterVersionRef: vllm-latest # Specifies the behavior when a Cluster is deleted. # - `DoNotTerminate`: Prevents deletion of the Cluster. This policy ensures that all resources remain intact. # - `Halt`: Deletes Cluster resources like Pods and Services but retains Persistent Volume Claims (PVCs), allowing for data preservation while stopping other operations. # - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data. # - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss. terminationPolicy: Delete - # Defines a set of node affinity scheduling rules for the Cluster's Pods. This field helps control the placement of Pods on nodes within the cluster. - affinity: - # Specifies the anti-affinity level of Pods within a Component. It determines how pods should be spread across nodes to improve availability and performance. - podAntiAffinity: Preferred - # Represents the key of node labels used to define the topology domain for Pod anti-affinity and Pod spread constraints. - topologyKeys: - - kubernetes.io/hostname - # Determines the level of resource isolation between Pods. It can have the following values: `SharedNode` and `DedicatedNode`. - # - SharedNode: Allow that multiple Pods may share the same node, which is the default behavior of K8s. - # - DedicatedNode: Each Pod runs on a dedicated node, ensuring that no two Pods share the same node. - tenancy: SharedNode - # An array that specifies tolerations attached to the Cluster's Pods, allowing them to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule # Specifies a list of ClusterComponentSpec objects used to define the individual components that make up a Cluster. This field allows for detailed configuration of each component within the Cluster. # Note: `shardingSpecs` and `componentSpecs` cannot both be empty; at least one must be defined to configure a cluster. # ClusterComponentSpec defines the specifications for a Component in a Cluster. diff --git a/examples/mongodb/README.md b/examples/mongodb/README.md index 3bd0ccfa0a4..390d04fa8fe 100644 --- a/examples/mongodb/README.md +++ b/examples/mongodb/README.md @@ -5,13 +5,8 @@ MongoDB is a document database designed for ease of application development and This example assumes that you have a Kubernetes cluster installed and running, and that you have installed the kubectl command line tool and helm somewhere in your path. Please see the [getting started](https://kubernetes.io/docs/setup/) and [Installing Helm](https://helm.sh/docs/intro/install/) for installation instructions for your platform. -Also, this example requires kubeblocks installed and running. Here is the steps to install kubeblocks, please replace "0.9.0" with the version you want to use. +Also, this example requires kubeblocks installed and running. Here is the steps to install kubeblocks, please replace "`$kb_version`" with the version you want to use. ```bash -# Create dependent CRDs -kubectl create -f https://github.com/apecloud/kubeblocks/releases/download/v0.9.0/kubeblocks_crds.yaml -# If github is not accessible or very slow for you, please use following command instead -kubectl create -f https://jihulab.com/api/v4/projects/98723/packages/generic/kubeblocks/v0.9.0/kubeblocks_crds.yaml - # Add Helm repo helm repo add kubeblocks https://apecloud.github.io/helm-charts # If github is not accessible or very slow for you, please use following repo instead @@ -20,8 +15,18 @@ helm repo add kubeblocks https://jihulab.com/api/v4/projects/85949/packages/helm # Update helm repo helm repo update +# Get the versions of KubeBlocks and select the one you want to use +helm search repo kubeblocks/kubeblocks --versions +# If you want to obtain the development versions of KubeBlocks, Please add the '--devel' parameter as the following command +helm search repo kubeblocks/kubeblocks --versions --devel + +# Create dependent CRDs +kubectl create -f https://github.com/apecloud/kubeblocks/releases/download/v$kb_version/kubeblocks_crds.yaml +# If github is not accessible or very slow for you, please use following command instead +kubectl create -f https://jihulab.com/api/v4/projects/98723/packages/generic/kubeblocks/v$kb_version/kubeblocks_crds.yaml + # Install KubeBlocks -helm install kubeblocks kubeblocks/kubeblocks --namespace kb-system --create-namespace --version="0.9.0" +helm install kubeblocks kubeblocks/kubeblocks --namespace kb-system --create-namespace --version="$kb_version" ``` If you want to access mongodb from external Kubernetes cluster, you need to enable hostnetwork, create mongodb cluster and then access by host ip and mongodb service port ```bash diff --git a/examples/mongodb/cluster.yaml b/examples/mongodb/cluster.yaml index d8d82c9de07..51ceb995f19 100644 --- a/examples/mongodb/cluster.yaml +++ b/examples/mongodb/cluster.yaml @@ -4,39 +4,18 @@ metadata: name: mongo-cluster namespace: default spec: - # Specifies the name of the ClusterDefinition to use when creating a Cluster. - clusterDefinitionRef: mongodb - # Refers to the ClusterVersion name. Deprecated since v0.9, use ComponentVersion instead. This field is maintained for backward compatibility and its use is discouraged. Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases. - clusterVersionRef: mongodb-6.0 # Specifies the behavior when a Cluster is deleted. # - `DoNotTerminate`: Prevents deletion of the Cluster. This policy ensures that all resources remain intact. # - `Halt`: Deletes Cluster resources like Pods and Services but retains Persistent Volume Claims (PVCs), allowing for data preservation while stopping other operations. # - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data. # - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss. terminationPolicy: Delete - # Defines a set of node affinity scheduling rules for the Cluster's Pods. This field helps control the placement of Pods on nodes within the cluster. - affinity: - # Specifies the anti-affinity level of Pods within a Component. It determines how pods should be spread across nodes to improve availability and performance. - podAntiAffinity: Preferred - # Represents the key of node labels used to define the topology domain for Pod anti-affinity and Pod spread constraints. - topologyKeys: - - kubernetes.io/hostname - # Determines the level of resource isolation between Pods. It can have the following values: `SharedNode` and `DedicatedNode`. - # - SharedNode: Allow that multiple Pods may share the same node, which is the default behavior of K8s. - # - DedicatedNode: Each Pod runs on a dedicated node, ensuring that no two Pods share the same node. - tenancy: SharedNode - # An array that specifies tolerations attached to the Cluster's Pods, allowing them to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule # Specifies a list of ClusterComponentSpec objects used to define the individual components that make up a Cluster. This field allows for detailed configuration of each component within the Cluster. # Note: `shardingSpecs` and `componentSpecs` cannot both be empty; at least one must be defined to configure a cluster. # ClusterComponentSpec defines the specifications for a Component in a Cluster. componentSpecs: - name: mongodb - componentDefRef: mongodb + componentDef: mongodb enabledLogs: - running disableExporter: true diff --git a/examples/mongodb/restore.yaml b/examples/mongodb/restore.yaml index c975d0dd3ea..180c18cff4b 100644 --- a/examples/mongodb/restore.yaml +++ b/examples/mongodb/restore.yaml @@ -6,39 +6,18 @@ metadata: annotations: kubeblocks.io/restore-from-backup: '{"mongodb":{"connectionPassword":"","name":"mongo-cluster-backup","namespace":"default","volumeRestorePolicy":"Parallel"}}' spec: - # Specifies the name of the ClusterDefinition to use when creating a Cluster. - clusterDefinitionRef: mongodb - # Refers to the ClusterVersion name. Deprecated since v0.9, use ComponentVersion instead. This field is maintained for backward compatibility and its use is discouraged. Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases. - clusterVersionRef: mongodb-6.0 # Specifies the behavior when a Cluster is deleted. # - `DoNotTerminate`: Prevents deletion of the Cluster. This policy ensures that all resources remain intact. # - `Halt`: Deletes Cluster resources like Pods and Services but retains Persistent Volume Claims (PVCs), allowing for data preservation while stopping other operations. # - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data. # - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss. terminationPolicy: Delete - # Defines a set of node affinity scheduling rules for the Cluster's Pods. This field helps control the placement of Pods on nodes within the cluster. - affinity: - # Specifies the anti-affinity level of Pods within a Component. It determines how pods should be spread across nodes to improve availability and performance. - podAntiAffinity: Preferred - # Represents the key of node labels used to define the topology domain for Pod anti-affinity and Pod spread constraints. - topologyKeys: - - kubernetes.io/hostname - # Determines the level of resource isolation between Pods. It can have the following values: `SharedNode` and `DedicatedNode`. - # - SharedNode: Allow that multiple Pods may share the same node, which is the default behavior of K8s. - # - DedicatedNode: Each Pod runs on a dedicated node, ensuring that no two Pods share the same node. - tenancy: SharedNode - # An array that specifies tolerations attached to the Cluster's Pods, allowing them to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule # Specifies a list of ClusterComponentSpec objects used to define the individual components that make up a Cluster. This field allows for detailed configuration of each component within the Cluster. # Note: `shardingSpecs` and `componentSpecs` cannot both be empty; at least one must be defined to configure a cluster. # ClusterComponentSpec defines the specifications for a Component in a Cluster. componentSpecs: - name: mongodb - componentDefRef: mongodb + componentDef: mongodb enabledLogs: - running disableExporter: true diff --git a/examples/mysql/README.md b/examples/mysql/README.md index fbdc35a47e5..2ebfa4ce14e 100644 --- a/examples/mysql/README.md +++ b/examples/mysql/README.md @@ -6,13 +6,8 @@ MySQL is a widely used, open-source relational database management system (RDBMS This example assumes that you have a Kubernetes cluster installed and running, and that you have installed the kubectl command line tool and helm somewhere in your path. Please see the [getting started](https://kubernetes.io/docs/setup/) and [Installing Helm](https://helm.sh/docs/intro/install/) for installation instructions for your platform. -Also, this example requires kubeblocks installed and running. Here is the steps to install kubeblocks, please replace "0.9.0" with the version you want to use. +Also, this example requires kubeblocks installed and running. Here is the steps to install kubeblocks, please replace "`$kb_version`" with the version you want to use. ```bash -# Create dependent CRDs -kubectl create -f https://github.com/apecloud/kubeblocks/releases/download/v0.9.0/kubeblocks_crds.yaml -# If github is not accessible or very slow for you, please use following command instead -kubectl create -f https://jihulab.com/api/v4/projects/98723/packages/generic/kubeblocks/v0.9.0/kubeblocks_crds.yaml - # Add Helm repo helm repo add kubeblocks https://apecloud.github.io/helm-charts # If github is not accessible or very slow for you, please use following repo instead @@ -21,8 +16,18 @@ helm repo add kubeblocks https://jihulab.com/api/v4/projects/85949/packages/helm # Update helm repo helm repo update +# Get the versions of KubeBlocks and select the one you want to use +helm search repo kubeblocks/kubeblocks --versions +# If you want to obtain the development versions of KubeBlocks, Please add the '--devel' parameter as the following command +helm search repo kubeblocks/kubeblocks --versions --devel + +# Create dependent CRDs +kubectl create -f https://github.com/apecloud/kubeblocks/releases/download/v$kb_version/kubeblocks_crds.yaml +# If github is not accessible or very slow for you, please use following command instead +kubectl create -f https://jihulab.com/api/v4/projects/98723/packages/generic/kubeblocks/v$kb_version/kubeblocks_crds.yaml + # Install KubeBlocks -helm install kubeblocks kubeblocks/kubeblocks --namespace kb-system --create-namespace --version="0.9.0" +helm install kubeblocks kubeblocks/kubeblocks --namespace kb-system --create-namespace --version="$kb_version" ``` Enable mysql @@ -36,16 +41,20 @@ helm repo add kubeblocks-addons https://jihulab.com/api/v4/projects/150246/packa helm repo update # Enable mysql -helm upgrade -i kb-addon-mysql kubeblocks-addons/mysql --version 0.9.1 -n kb-system +helm upgrade -i kb-addon-mysql kubeblocks-addons/mysql --version $kb_version -n kb-system ``` ## Examples ### [Create](cluster.yaml) -Create an mysql cluster with specified cluster definition +Create a MySQL cluster that uses the built-in HA manager ```bash kubectl apply -f examples/mysql/cluster.yaml ``` +Create a MySQL cluster that uses the Orchestrator HA manager +```bash +kubectl apply -f examples/mysql/cluster-orc.yaml +``` ### [Horizontal scaling](horizontalscale.yaml) Horizontal scaling out or in specified components replicas in the cluster diff --git a/examples/mysql/cluster-orc.yaml b/examples/mysql/cluster-orc.yaml new file mode 100644 index 00000000000..7f20e1ac11c --- /dev/null +++ b/examples/mysql/cluster-orc.yaml @@ -0,0 +1,75 @@ +apiVersion: apps.kubeblocks.io/v1alpha1 +kind: Cluster +metadata: + name: mysql-cluster + namespace: default +spec: + # Specifies the behavior when a Cluster is deleted. + # - `DoNotTerminate`: Prevents deletion of the Cluster. This policy ensures that all resources remain intact. + # - `Halt`: Deletes Cluster resources like Pods and Services but retains Persistent Volume Claims (PVCs), allowing for data preservation while stopping other operations. + # - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data. + # - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss. + terminationPolicy: Delete + # Specifies a list of ClusterComponentSpec objects used to define the individual components that make up a Cluster. This field allows for detailed configuration of each component within the Cluster. + # Note: `shardingSpecs` and `componentSpecs` cannot both be empty; at least one must be defined to configure a cluster. + # ClusterComponentSpec defines the specifications for a Component in a Cluster. + componentSpecs: + - name: mysql + componentDef: mysql-8.0.33-orc + disableExporter: true + replicas: 1 + serviceAccountName: kb-mysql-cluster + resources: + limits: + cpu: '0.5' + memory: 0.5Gi + requests: + cpu: '0.5' + memory: 0.5Gi + volumeClaimTemplates: + - name: data + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 20Gi + serviceRefs: + - name: orchestrator + namespace: default + clusterServiceSelector: + cluster: orchestratorm-cluster + service: + component: orchestrator + service: orchestrator + port: http +--- +apiVersion: apps.kubeblocks.io/v1alpha1 +kind: Cluster +metadata: + name: orchestratorm-cluster + namespace: default + annotations: + "kubeblocks.io/extra-env": '{"ORC_TOPOLOGY_PASSWORD":"orchestrator","ORC_META_PASSWORD":"orchestrator","ORC_META_DATABASE":"orchestrator"}' +spec: + terminationPolicy: Delete + componentSpecs: + - name: orchestrator + componentDef: orchestrator-raft + disableExporter: true + replicas: 3 + resources: + requests: + cpu: '0.5' + memory: 0.5Gi + limits: + cpu: '0.5' + memory: 0.5Gi + volumeClaimTemplates: + - name: data + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 20Gi \ No newline at end of file diff --git a/examples/mysql/cluster.yaml b/examples/mysql/cluster.yaml index 003d8c2fac1..c9b6d6082b3 100644 --- a/examples/mysql/cluster.yaml +++ b/examples/mysql/cluster.yaml @@ -4,42 +4,18 @@ metadata: name: mysql-cluster namespace: default spec: - # Specifies the name of the ClusterDefinition to use when creating a Cluster. - clusterDefinitionRef: mysql - # Refers to the ClusterVersion name. Deprecated since v0.9, use ComponentVersion instead. This field is maintained for backward compatibility and its use is discouraged. Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases. - clusterVersionRef: mysql-8.0.33 # Specifies the behavior when a Cluster is deleted. # - `DoNotTerminate`: Prevents deletion of the Cluster. This policy ensures that all resources remain intact. # - `Halt`: Deletes Cluster resources like Pods and Services but retains Persistent Volume Claims (PVCs), allowing for data preservation while stopping other operations. # - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data. # - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss. terminationPolicy: Delete - # Defines a set of node affinity scheduling rules for the Cluster's Pods. This field helps control the placement of Pods on nodes within the cluster. - affinity: - # Specifies the anti-affinity level of Pods within a Component. It determines how pods should be spread across nodes to improve availability and performance. - podAntiAffinity: Preferred - # Represents the key of node labels used to define the topology domain for Pod anti-affinity and Pod spread constraints. - topologyKeys: - - kubernetes.io/hostname - # Determines the level of resource isolation between Pods. It can have the following values: `SharedNode` and `DedicatedNode`. - # - SharedNode: Allow that multiple Pods may share the same node, which is the default behavior of K8s. - # - DedicatedNode: Each Pod runs on a dedicated node, ensuring that no two Pods share the same node. - tenancy: SharedNode - # An array that specifies tolerations attached to the Cluster's Pods, allowing them to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule # Specifies a list of ClusterComponentSpec objects used to define the individual components that make up a Cluster. This field allows for detailed configuration of each component within the Cluster. # Note: `shardingSpecs` and `componentSpecs` cannot both be empty; at least one must be defined to configure a cluster. # ClusterComponentSpec defines the specifications for a Component in a Cluster. componentSpecs: - name: mysql - componentDefRef: mysql - enabledLogs: - - error - - slow + componentDef: mysql-8.0.33 disableExporter: true replicas: 1 serviceAccountName: kb-mysql-cluster diff --git a/examples/mysql/restore.yaml b/examples/mysql/restore.yaml index e9451ac56a0..a3fb89595cc 100644 --- a/examples/mysql/restore.yaml +++ b/examples/mysql/restore.yaml @@ -6,39 +6,18 @@ metadata: annotations: kubeblocks.io/restore-from-backup: '{"mysql":{"connectionPassword":"","name":"mysql-cluster-backup","namespace":"default","volumeRestorePolicy":"Parallel"}}' spec: - # Specifies the name of the ClusterDefinition to use when creating a Cluster. - clusterDefinitionRef: mysql - # Refers to the ClusterVersion name. Deprecated since v0.9, use ComponentVersion instead. This field is maintained for backward compatibility and its use is discouraged. Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases. - clusterVersionRef: mysql-8.0.33 # Specifies the behavior when a Cluster is deleted. # - `DoNotTerminate`: Prevents deletion of the Cluster. This policy ensures that all resources remain intact. # - `Halt`: Deletes Cluster resources like Pods and Services but retains Persistent Volume Claims (PVCs), allowing for data preservation while stopping other operations. # - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data. # - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss. terminationPolicy: Delete - # Defines a set of node affinity scheduling rules for the Cluster's Pods. This field helps control the placement of Pods on nodes within the cluster. - affinity: - # Specifies the anti-affinity level of Pods within a Component. It determines how pods should be spread across nodes to improve availability and performance. - podAntiAffinity: Preferred - # Represents the key of node labels used to define the topology domain for Pod anti-affinity and Pod spread constraints. - topologyKeys: - - kubernetes.io/hostname - # Determines the level of resource isolation between Pods. It can have the following values: `SharedNode` and `DedicatedNode`. - # - SharedNode: Allow that multiple Pods may share the same node, which is the default behavior of K8s. - # - DedicatedNode: Each Pod runs on a dedicated node, ensuring that no two Pods share the same node. - tenancy: SharedNode - # An array that specifies tolerations attached to the Cluster's Pods, allowing them to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule # Specifies a list of ClusterComponentSpec objects used to define the individual components that make up a Cluster. This field allows for detailed configuration of each component within the Cluster. # Note: `shardingSpecs` and `componentSpecs` cannot both be empty; at least one must be defined to configure a cluster. # ClusterComponentSpec defines the specifications for a Component in a Cluster. componentSpecs: - name: mysql - componentDefRef: mysql + componentDef: mysql-8.0.33 enabledLogs: - error - slow diff --git a/examples/mysql/switchover.yaml b/examples/mysql/switchover.yaml index 45525e7b5bc..0710bb4d54f 100644 --- a/examples/mysql/switchover.yaml +++ b/examples/mysql/switchover.yaml @@ -5,12 +5,13 @@ metadata: spec: # Specifies the name of the Cluster resource that this operation is targeting. clusterName: mysql-cluster - type: Switchover + type: Custom # Lists Switchover objects, each specifying a Component to perform the switchover operation. - switchover: - # Specifies the name of the Component. - - componentName: mysql - # Specifies the instance to become the primary or leader during a switchover operation. The value of `instanceName` can be either: - # - "*" (wildcard value): - Indicates no specific instance is designated as the primary or leader. - # - A valid instance name (pod name) - instanceName: '*' + custom: + components: + - componentName: mysql + parameters: + - name: candidate + value: mysql-cluster-mysql-mysql-1 + opsDefinitionName: mysql-orc-switchover + diff --git a/examples/postgresql/README.md b/examples/postgresql/README.md index ee6b799ef50..d7da9e653fb 100644 --- a/examples/postgresql/README.md +++ b/examples/postgresql/README.md @@ -6,13 +6,8 @@ PostgreSQL (Postgres) is an open source object-relational database known for rel This example assumes that you have a Kubernetes cluster installed and running, and that you have installed the kubectl command line tool and helm somewhere in your path. Please see the [getting started](https://kubernetes.io/docs/setup/) and [Installing Helm](https://helm.sh/docs/intro/install/) for installation instructions for your platform. -Also, this example requires kubeblocks installed and running. Here is the steps to install kubeblocks, please replace "0.9.0" with the version you want to use. +Also, this example requires kubeblocks installed and running. Here is the steps to install kubeblocks, please replace "`$kb_version`" with the version you want to use. ```bash -# Create dependent CRDs -kubectl create -f https://github.com/apecloud/kubeblocks/releases/download/v0.9.0/kubeblocks_crds.yaml -# If github is not accessible or very slow for you, please use following command instead -kubectl create -f https://jihulab.com/api/v4/projects/98723/packages/generic/kubeblocks/v0.9.0/kubeblocks_crds.yaml - # Add Helm repo helm repo add kubeblocks https://apecloud.github.io/helm-charts # If github is not accessible or very slow for you, please use following repo instead @@ -21,8 +16,18 @@ helm repo add kubeblocks https://jihulab.com/api/v4/projects/85949/packages/helm # Update helm repo helm repo update +# Get the versions of KubeBlocks and select the one you want to use +helm search repo kubeblocks/kubeblocks --versions +# If you want to obtain the development versions of KubeBlocks, Please add the '--devel' parameter as the following command +helm search repo kubeblocks/kubeblocks --versions --devel + +# Create dependent CRDs +kubectl create -f https://github.com/apecloud/kubeblocks/releases/download/v$kb_version/kubeblocks_crds.yaml +# If github is not accessible or very slow for you, please use following command instead +kubectl create -f https://jihulab.com/api/v4/projects/98723/packages/generic/kubeblocks/v$kb_version/kubeblocks_crds.yaml + # Install KubeBlocks -helm install kubeblocks kubeblocks/kubeblocks --namespace kb-system --create-namespace --version="0.9.0" +helm install kubeblocks kubeblocks/kubeblocks --namespace kb-system --create-namespace --version="$kb_version" ``` diff --git a/examples/postgresql/cluster-cmpd.yaml b/examples/postgresql/cluster-cmpd.yaml index 60babf97a6b..7fd28106c10 100644 --- a/examples/postgresql/cluster-cmpd.yaml +++ b/examples/postgresql/cluster-cmpd.yaml @@ -21,18 +21,6 @@ spec: - running # Determines whether the metrics exporter needs to be published to the service endpoint. disableExporter: true - # Specifies a group of affinity scheduling rules for the Component. It allows users to control how the Component's Pods are scheduled onto nodes in the cluster. - affinity: - podAntiAffinity: Preferred - topologyKeys: - - kubernetes.io/hostname - tenancy: SharedNode - # Allows the Component to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule # Specifies the name of the ServiceAccount required by the running Component. serviceAccountName: kb-pg-cluster # Each component supports running multiple replicas to provide high availability and persistence. This field can be used to specify the desired number of replicas. diff --git a/examples/postgresql/cluster.yaml b/examples/postgresql/cluster.yaml index 53f0a0ac831..6f65c2f6543 100644 --- a/examples/postgresql/cluster.yaml +++ b/examples/postgresql/cluster.yaml @@ -4,39 +4,18 @@ metadata: name: pg-cluster namespace: default spec: - # Specifies the name of the ClusterDefinition to use when creating a Cluster. - clusterDefinitionRef: postgresql - # Refers to the ClusterVersion name. Deprecated since v0.9, use ComponentVersion instead. This field is maintained for backward compatibility and its use is discouraged. Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases. - clusterVersionRef: postgresql-12.14.0 # Specifies the behavior when a Cluster is deleted. # - `DoNotTerminate`: Prevents deletion of the Cluster. This policy ensures that all resources remain intact. # - `Halt`: Deletes Cluster resources like Pods and Services but retains Persistent Volume Claims (PVCs), allowing for data preservation while stopping other operations. # - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data. # - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss. terminationPolicy: Delete - # Defines a set of node affinity scheduling rules for the Cluster's Pods. This field helps control the placement of Pods on nodes within the cluster. - affinity: - # Specifies the anti-affinity level of Pods within a Component. It determines how pods should be spread across nodes to improve availability and performance. - podAntiAffinity: Preferred - # Represents the key of node labels used to define the topology domain for Pod anti-affinity and Pod spread constraints. - topologyKeys: - - kubernetes.io/hostname - # Determines the level of resource isolation between Pods. It can have the following values: `SharedNode` and `DedicatedNode`. - # - SharedNode: Allow that multiple Pods may share the same node, which is the default behavior of K8s. - # - DedicatedNode: Each Pod runs on a dedicated node, ensuring that no two Pods share the same node. - tenancy: SharedNode - # An array that specifies tolerations attached to the Cluster's Pods, allowing them to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule # Specifies a list of ClusterComponentSpec objects used to define the individual components that make up a Cluster. This field allows for detailed configuration of each component within the Cluster. # Note: `shardingSpecs` and `componentSpecs` cannot both be empty; at least one must be defined to configure a cluster. # ClusterComponentSpec defines the specifications for a Component in a Cluster. componentSpecs: - name: postgresql - componentDefRef: postgresql + componentDef: postgresql-14 enabledLogs: - running disableExporter: true diff --git a/examples/postgresql/restore-cmpd.yaml b/examples/postgresql/restore-cmpd.yaml index 06e3913857a..516f66f4bbc 100644 --- a/examples/postgresql/restore-cmpd.yaml +++ b/examples/postgresql/restore-cmpd.yaml @@ -18,18 +18,6 @@ spec: - name: postgresql # References the name of a ComponentDefinition. The ComponentDefinition specifies the behavior and characteristics of the Component. If both `componentDefRef` and `componentDef` are provided, the `componentDef` will take precedence over `componentDefRef`. componentDef: postgresql-12 - # Specifies a group of affinity scheduling rules for the Component. It allows users to control how the Component's Pods are scheduled onto nodes in the cluster. - affinity: - podAntiAffinity: Preferred - topologyKeys: - - kubernetes.io/hostname - tenancy: SharedNode - # Allows the Component to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule # Specifies which types of logs should be collected for the Cluster. enabledLogs: - running diff --git a/examples/postgresql/restore.yaml b/examples/postgresql/restore.yaml index 2c5a8254c39..82da81a4fab 100644 --- a/examples/postgresql/restore.yaml +++ b/examples/postgresql/restore.yaml @@ -6,39 +6,18 @@ metadata: annotations: kubeblocks.io/restore-from-backup: '{"postgresql":{"connectionPassword":"","name":"pg-cluster-backup","namespace":"default","volumeRestorePolicy":"Parallel"}}' spec: - # Specifies the name of the ClusterDefinition to use when creating a Cluster. - clusterDefinitionRef: postgresql - # Refers to the ClusterVersion name. Deprecated since v0.9, use ComponentVersion instead. This field is maintained for backward compatibility and its use is discouraged. Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases. - clusterVersionRef: postgresql-12.14.0 # Specifies the behavior when a Cluster is deleted. # - `DoNotTerminate`: Prevents deletion of the Cluster. This policy ensures that all resources remain intact. # - `Halt`: Deletes Cluster resources like Pods and Services but retains Persistent Volume Claims (PVCs), allowing for data preservation while stopping other operations. # - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data. # - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss. terminationPolicy: Delete - # Defines a set of node affinity scheduling rules for the Cluster's Pods. This field helps control the placement of Pods on nodes within the cluster. - affinity: - # Specifies the anti-affinity level of Pods within a Component. It determines how pods should be spread across nodes to improve availability and performance. - podAntiAffinity: Preferred - # Represents the key of node labels used to define the topology domain for Pod anti-affinity and Pod spread constraints. - topologyKeys: - - kubernetes.io/hostname - # Determines the level of resource isolation between Pods. It can have the following values: `SharedNode` and `DedicatedNode`. - # - SharedNode: Allow that multiple Pods may share the same node, which is the default behavior of K8s. - # - DedicatedNode: Each Pod runs on a dedicated node, ensuring that no two Pods share the same node. - tenancy: SharedNode - # An array that specifies tolerations attached to the Cluster's Pods, allowing them to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule # Specifies a list of ClusterComponentSpec objects used to define the individual components that make up a Cluster. This field allows for detailed configuration of each component within the Cluster. # Note: `shardingSpecs` and `componentSpecs` cannot both be empty; at least one must be defined to configure a cluster. # ClusterComponentSpec defines the specifications for a Component in a Cluster. componentSpecs: - name: postgresql - componentDefRef: postgresql + componentDef: postgresql-12 enabledLogs: - running disableExporter: true diff --git a/examples/pulsar/README.md b/examples/pulsar/README.md index 66c3baa509e..8b25a11389e 100644 --- a/examples/pulsar/README.md +++ b/examples/pulsar/README.md @@ -6,13 +6,8 @@ ApacheĀ® Pulsarā„¢ is an open-source, distributed messaging and streaming platfo This example assumes that you have a Kubernetes cluster installed and running, and that you have installed the kubectl command line tool and helm somewhere in your path. Please see the [getting started](https://kubernetes.io/docs/setup/) and [Installing Helm](https://helm.sh/docs/intro/install/) for installation instructions for your platform. -Also, this example requires kubeblocks installed and running. Here is the steps to install kubeblocks, please replace "0.9.0" with the version you want to use. +Also, this example requires kubeblocks installed and running. Here is the steps to install kubeblocks, please replace "`$kb_version`" with the version you want to use. ```bash -# Create dependent CRDs -kubectl create -f https://github.com/apecloud/kubeblocks/releases/download/v0.9.0/kubeblocks_crds.yaml -# If github is not accessible or very slow for you, please use following command instead -kubectl create -f https://jihulab.com/api/v4/projects/98723/packages/generic/kubeblocks/v0.9.0/kubeblocks_crds.yaml - # Add Helm repo helm repo add kubeblocks https://apecloud.github.io/helm-charts # If github is not accessible or very slow for you, please use following repo instead @@ -21,8 +16,18 @@ helm repo add kubeblocks https://jihulab.com/api/v4/projects/85949/packages/helm # Update helm repo helm repo update +# Get the versions of KubeBlocks and select the one you want to use +helm search repo kubeblocks/kubeblocks --versions +# If you want to obtain the development versions of KubeBlocks, Please add the '--devel' parameter as the following command +helm search repo kubeblocks/kubeblocks --versions --devel + +# Create dependent CRDs +kubectl create -f https://github.com/apecloud/kubeblocks/releases/download/v$kb_version/kubeblocks_crds.yaml +# If github is not accessible or very slow for you, please use following command instead +kubectl create -f https://jihulab.com/api/v4/projects/98723/packages/generic/kubeblocks/v$kb_version/kubeblocks_crds.yaml + # Install KubeBlocks -helm install kubeblocks kubeblocks/kubeblocks --namespace kb-system --create-namespace --version="0.9.0" +helm install kubeblocks kubeblocks/kubeblocks --namespace kb-system --create-namespace --version="$kb_version" ``` diff --git a/examples/pulsar/cluster-service-descriptor.yaml b/examples/pulsar/cluster-service-descriptor.yaml index 796b5e5e34e..56d18f200d2 100644 --- a/examples/pulsar/cluster-service-descriptor.yaml +++ b/examples/pulsar/cluster-service-descriptor.yaml @@ -17,23 +17,6 @@ spec: # - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data. # - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss. terminationPolicy: Delete - # Defines a set of node affinity scheduling rules for the Cluster's Pods. This field helps control the placement of Pods on nodes within the cluster. - affinity: - # Specifies the anti-affinity level of Pods within a Component. It determines how pods should be spread across nodes to improve availability and performance. - podAntiAffinity: Preferred - # Represents the key of node labels used to define the topology domain for Pod anti-affinity and Pod spread constraints. - topologyKeys: - - kubernetes.io/hostname - # Determines the level of resource isolation between Pods. It can have the following values: `SharedNode` and `DedicatedNode`. - # - SharedNode: Allow that multiple Pods may share the same node, which is the default behavior of K8s. - # - DedicatedNode: Each Pod runs on a dedicated node, ensuring that no two Pods share the same node. - tenancy: SharedNode - # An array that specifies tolerations attached to the Cluster's Pods, allowing them to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: "true" - effect: NoSchedule services: - name: proxy serviceName: proxy diff --git a/examples/pulsar/cluster-zookeeper-separate.yaml b/examples/pulsar/cluster-zookeeper-separate.yaml index f3fd6e7b5a5..270749a9e60 100644 --- a/examples/pulsar/cluster-zookeeper-separate.yaml +++ b/examples/pulsar/cluster-zookeeper-separate.yaml @@ -17,27 +17,6 @@ spec: # - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data. # - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss. terminationPolicy: Delete - # Defines a set of node affinity scheduling rules for the Cluster's Pods. This field helps control the placement of Pods on nodes within the cluster. - affinity: - # Specifies the anti-affinity level of Pods within a Component. It determines how pods should be spread across nodes to improve availability and performance. - podAntiAffinity: Preferred - # Represents the key of node labels used to define the topology domain for Pod anti-affinity and Pod spread constraints. - topologyKeys: - - kubernetes.io/hostname - # Determines the level of resource isolation between Pods. It can have the following values: `SharedNode` and `DedicatedNode`. - # - SharedNode: Allow that multiple Pods may share the same node, which is the default behavior of K8s. - # - DedicatedNode: Each Pod runs on a dedicated node, ensuring that no two Pods share the same node. - tenancy: SharedNode - # An array that specifies tolerations attached to the Cluster's Pods, allowing them to be scheduled onto nodes with matching taints. - tolerations: - # An array that specifies tolerations attached to the Cluster's Pods, allowing them to be scheduled onto nodes with matching taints. - - key: kb-data - # An array that specifies tolerations attached to the Cluster's Pods, allowing them to be scheduled onto nodes with matching taints. - operator: Equal - # An array that specifies tolerations attached to the Cluster's Pods, allowing them to be scheduled onto nodes with matching taints. - value: 'true' - # An array that specifies tolerations attached to the Cluster's Pods, allowing them to be scheduled onto nodes with matching taints. - effect: NoSchedule services: - name: proxy serviceName: proxy diff --git a/examples/pulsar/cluster.yaml b/examples/pulsar/cluster.yaml index 1b0b1d46570..1403bb722ed 100644 --- a/examples/pulsar/cluster.yaml +++ b/examples/pulsar/cluster.yaml @@ -17,23 +17,6 @@ spec: # - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data. # - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss. terminationPolicy: Delete - # Defines a set of node affinity scheduling rules for the Cluster's Pods. This field helps control the placement of Pods on nodes within the cluster. - affinity: - # Specifies the anti-affinity level of Pods within a Component. It determines how pods should be spread across nodes to improve availability and performance. - podAntiAffinity: Preferred - # Represents the key of node labels used to define the topology domain for Pod anti-affinity and Pod spread constraints. - topologyKeys: - - kubernetes.io/hostname - # Determines the level of resource isolation between Pods. It can have the following values: `SharedNode` and `DedicatedNode`. - # - SharedNode: Allow that multiple Pods may share the same node, which is the default behavior of K8s. - # - DedicatedNode: Each Pod runs on a dedicated node, ensuring that no two Pods share the same node. - tenancy: SharedNode - # An array that specifies tolerations attached to the Cluster's Pods, allowing them to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule services: - name: proxy serviceName: proxy diff --git a/examples/qdrant/README.md b/examples/qdrant/README.md index fca3a33ad4f..b6d0fafa699 100644 --- a/examples/qdrant/README.md +++ b/examples/qdrant/README.md @@ -6,13 +6,8 @@ Qdrant is an open source (Apache-2.0 licensed), vector similarity search engine This example assumes that you have a Kubernetes cluster installed and running, and that you have installed the kubectl command line tool and helm somewhere in your path. Please see the [getting started](https://kubernetes.io/docs/setup/) and [Installing Helm](https://helm.sh/docs/intro/install/) for installation instructions for your platform. -Also, this example requires kubeblocks installed and running. Here is the steps to install kubeblocks, please replace "0.9.0" with the version you want to use. +Also, this example requires kubeblocks installed and running. Here is the steps to install kubeblocks, please replace "`$kb_version`" with the version you want to use. ```bash -# Create dependent CRDs -kubectl create -f https://github.com/apecloud/kubeblocks/releases/download/v0.9.0/kubeblocks_crds.yaml -# If github is not accessible or very slow for you, please use following command instead -kubectl create -f https://jihulab.com/api/v4/projects/98723/packages/generic/kubeblocks/v0.9.0/kubeblocks_crds.yaml - # Add Helm repo helm repo add kubeblocks https://apecloud.github.io/helm-charts # If github is not accessible or very slow for you, please use following repo instead @@ -21,8 +16,18 @@ helm repo add kubeblocks https://jihulab.com/api/v4/projects/85949/packages/helm # Update helm repo helm repo update +# Get the versions of KubeBlocks and select the one you want to use +helm search repo kubeblocks/kubeblocks --versions +# If you want to obtain the development versions of KubeBlocks, Please add the '--devel' parameter as the following command +helm search repo kubeblocks/kubeblocks --versions --devel + +# Create dependent CRDs +kubectl create -f https://github.com/apecloud/kubeblocks/releases/download/v$kb_version/kubeblocks_crds.yaml +# If github is not accessible or very slow for you, please use following command instead +kubectl create -f https://jihulab.com/api/v4/projects/98723/packages/generic/kubeblocks/v$kb_version/kubeblocks_crds.yaml + # Install KubeBlocks -helm install kubeblocks kubeblocks/kubeblocks --namespace kb-system --create-namespace --version="0.9.0" +helm install kubeblocks kubeblocks/kubeblocks --namespace kb-system --create-namespace --version="$kb_version" ``` Enable qdrant ```bash @@ -34,7 +39,7 @@ helm repo add kubeblocks-addons https://jihulab.com/api/v4/projects/150246/packa helm repo update # Enable qdrant -helm upgrade -i kb-addon-qdrant kubeblocks-addons/qdrant -n kb-system +helm upgrade -i kb-addon-qdrant kubeblocks-addons/qdrant -n kb-system --version $kb_version ``` ## Examples diff --git a/examples/qdrant/cluster-cmpd.yaml b/examples/qdrant/cluster-cmpd.yaml index 73bf95b619d..3820da05527 100644 --- a/examples/qdrant/cluster-cmpd.yaml +++ b/examples/qdrant/cluster-cmpd.yaml @@ -16,18 +16,6 @@ spec: - name: qdrant # References the name of a ComponentDefinition. The ComponentDefinition specifies the behavior and characteristics of the Component. If both `componentDefRef` and `componentDef` are provided, the `componentDef` will take precedence over `componentDefRef`. componentDef: qdrant - # Specifies a group of affinity scheduling rules for the Component. It allows users to control how the Component's Pods are scheduled onto nodes in the cluster. - affinity: - podAntiAffinity: Preferred - topologyKeys: - - kubernetes.io/hostname - tenancy: SharedNode - # Allows the Component to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule # Determines whether the metrics exporter needs to be published to the service endpoint. disableExporter: true # Specifies the name of the ServiceAccount required by the running Component. diff --git a/examples/qdrant/cluster.yaml b/examples/qdrant/cluster.yaml index 4bd78865744..abb78599691 100644 --- a/examples/qdrant/cluster.yaml +++ b/examples/qdrant/cluster.yaml @@ -4,39 +4,18 @@ metadata: name: qdrant-cluster namespace: default spec: - # Specifies the name of the ClusterDefinition to use when creating a Cluster. - clusterDefinitionRef: qdrant - # Refers to the ClusterVersion name. Deprecated since v0.9, use ComponentVersion instead. This field is maintained for backward compatibility and its use is discouraged. Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases. - clusterVersionRef: qdrant-1.8.1 # Specifies the behavior when a Cluster is deleted. # - `DoNotTerminate`: Prevents deletion of the Cluster. This policy ensures that all resources remain intact. # - `Halt`: Deletes Cluster resources like Pods and Services but retains Persistent Volume Claims (PVCs), allowing for data preservation while stopping other operations. # - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data. # - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss. terminationPolicy: Delete - # Defines a set of node affinity scheduling rules for the Cluster's Pods. This field helps control the placement of Pods on nodes within the cluster. - affinity: - # Specifies the anti-affinity level of Pods within a Component. It determines how pods should be spread across nodes to improve availability and performance. - podAntiAffinity: Preferred - # Represents the key of node labels used to define the topology domain for Pod anti-affinity and Pod spread constraints. - topologyKeys: - - kubernetes.io/hostname - # Determines the level of resource isolation between Pods. It can have the following values: `SharedNode` and `DedicatedNode`. - # - SharedNode: Allow that multiple Pods may share the same node, which is the default behavior of K8s. - # - DedicatedNode: Each Pod runs on a dedicated node, ensuring that no two Pods share the same node. - tenancy: SharedNode - # An array that specifies tolerations attached to the Cluster's Pods, allowing them to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule # Specifies a list of ClusterComponentSpec objects used to define the individual components that make up a Cluster. This field allows for detailed configuration of each component within the Cluster. # Note: `shardingSpecs` and `componentSpecs` cannot both be empty; at least one must be defined to configure a cluster. # ClusterComponentSpec defines the specifications for a Component in a Cluster. componentSpecs: - name: qdrant - componentDefRef: qdrant + componentDef: qdrant disableExporter: true serviceAccountName: kb-qdrant-cluster replicas: 2 diff --git a/examples/qdrant/restore-cmpd.yaml b/examples/qdrant/restore-cmpd.yaml index 1e3dc8e7067..e7e27b5be1e 100644 --- a/examples/qdrant/restore-cmpd.yaml +++ b/examples/qdrant/restore-cmpd.yaml @@ -18,12 +18,6 @@ spec: - name: qdrant # References the name of a ComponentDefinition. The ComponentDefinition specifies the behavior and characteristics of the Component. If both `componentDefRef` and `componentDef` are provided, the `componentDef` will take precedence over `componentDefRef`. componentDef: qdrant - # Specifies a group of affinity scheduling rules for the Component. It allows users to control how the Component's Pods are scheduled onto nodes in the cluster. - affinity: - podAntiAffinity: Preferred - topologyKeys: - - kubernetes.io/hostname - tenancy: SharedNode # Determines whether the metrics exporter needs to be published to the service endpoint. disableExporter: true # Specifies the name of the ServiceAccount required by the running Component. diff --git a/examples/qdrant/restore.yaml b/examples/qdrant/restore.yaml index e62dc4bf964..d9ac0fa4c63 100644 --- a/examples/qdrant/restore.yaml +++ b/examples/qdrant/restore.yaml @@ -6,39 +6,18 @@ metadata: annotations: kubeblocks.io/restore-from-backup: '{"qdrant":{"connectionPassword":"","name":"qdrant-cluster-backup","namespace":"default","volumeRestorePolicy":"Parallel"}}' spec: - # Specifies the name of the ClusterDefinition to use when creating a Cluster. - clusterDefinitionRef: qdrant - # Refers to the ClusterVersion name. Deprecated since v0.9, use ComponentVersion instead. This field is maintained for backward compatibility and its use is discouraged. Existing usage should be updated to the current preferred approach to avoid compatibility issues in future releases. - clusterVersionRef: qdrant-1.8.1 # Specifies the behavior when a Cluster is deleted. # - `DoNotTerminate`: Prevents deletion of the Cluster. This policy ensures that all resources remain intact. # - `Halt`: Deletes Cluster resources like Pods and Services but retains Persistent Volume Claims (PVCs), allowing for data preservation while stopping other operations. # - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data. # - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss. terminationPolicy: Delete - # Defines a set of node affinity scheduling rules for the Cluster's Pods. This field helps control the placement of Pods on nodes within the cluster. - affinity: - # Specifies the anti-affinity level of Pods within a Component. It determines how pods should be spread across nodes to improve availability and performance. - podAntiAffinity: Preferred - # Represents the key of node labels used to define the topology domain for Pod anti-affinity and Pod spread constraints. - topologyKeys: - - kubernetes.io/hostname - # Determines the level of resource isolation between Pods. It can have the following values: `SharedNode` and `DedicatedNode`. - # - SharedNode: Allow that multiple Pods may share the same node, which is the default behavior of K8s. - # - DedicatedNode: Each Pod runs on a dedicated node, ensuring that no two Pods share the same node. - tenancy: SharedNode - # An array that specifies tolerations attached to the Cluster's Pods, allowing them to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule # Specifies a list of ClusterComponentSpec objects used to define the individual components that make up a Cluster. This field allows for detailed configuration of each component within the Cluster. # Note: `shardingSpecs` and `componentSpecs` cannot both be empty; at least one must be defined to configure a cluster. # ClusterComponentSpec defines the specifications for a Component in a Cluster. componentSpecs: - name: qdrant - componentDefRef: qdrant + componentDef: qdrant disableExporter: true serviceAccountName: kb-qdrant-cluster replicas: 3 diff --git a/examples/redis/README.md b/examples/redis/README.md index 0b9688db8ff..3cc087a86f5 100644 --- a/examples/redis/README.md +++ b/examples/redis/README.md @@ -6,13 +6,8 @@ Redis is an open source (BSD licensed), in-memory data structure store, used as This example assumes that you have a Kubernetes cluster installed and running, and that you have installed the kubectl command line tool and helm somewhere in your path. Please see the [getting started](https://kubernetes.io/docs/setup/) and [Installing Helm](https://helm.sh/docs/intro/install/) for installation instructions for your platform. -Also, this example requires kubeblocks installed and running. Here is the steps to install kubeblocks, please replace "0.9.0" with the version you want to use. +Also, this example requires kubeblocks installed and running. Here is the steps to install kubeblocks, please replace "`$kb_version`" with the version you want to use. ```bash -# Create dependent CRDs -kubectl create -f https://github.com/apecloud/kubeblocks/releases/download/v0.9.0/kubeblocks_crds.yaml -# If github is not accessible or very slow for you, please use following command instead -kubectl create -f https://jihulab.com/api/v4/projects/98723/packages/generic/kubeblocks/v0.9.0/kubeblocks_crds.yaml - # Add Helm repo helm repo add kubeblocks https://apecloud.github.io/helm-charts # If github is not accessible or very slow for you, please use following repo instead @@ -21,8 +16,18 @@ helm repo add kubeblocks https://jihulab.com/api/v4/projects/85949/packages/helm # Update helm repo helm repo update +# Get the versions of KubeBlocks and select the one you want to use +helm search repo kubeblocks/kubeblocks --versions +# If you want to obtain the development versions of KubeBlocks, Please add the '--devel' parameter as the following command +helm search repo kubeblocks/kubeblocks --versions --devel + +# Create dependent CRDs +kubectl create -f https://github.com/apecloud/kubeblocks/releases/download/v$kb_version/kubeblocks_crds.yaml +# If github is not accessible or very slow for you, please use following command instead +kubectl create -f https://jihulab.com/api/v4/projects/98723/packages/generic/kubeblocks/v$kb_version/kubeblocks_crds.yaml + # Install KubeBlocks -helm install kubeblocks kubeblocks/kubeblocks --namespace kb-system --create-namespace --version="0.9.0" +helm install kubeblocks kubeblocks/kubeblocks --namespace kb-system --create-namespace --version="$kb_version" ``` diff --git a/examples/redis/cluster-cd-topology-twemproxy.yaml b/examples/redis/cluster-cd-topology-twemproxy.yaml index ab53fa55385..3988ab815b3 100644 --- a/examples/redis/cluster-cd-topology-twemproxy.yaml +++ b/examples/redis/cluster-cd-topology-twemproxy.yaml @@ -22,18 +22,6 @@ spec: # Specifies the name of the Component. The name must be defined in the ClusterDefinition.Spec.topologies[x].components. # This name is also part of the Service DNS name and must comply with the IANA service naming rule. When ClusterComponentSpec is referenced as a template, the name is optional. Otherwise, it is required. - name: redis - # Specifies a group of affinity scheduling rules for the Component. It allows users to control how the Component's Pods are scheduled onto nodes in the cluster. - affinity: - podAntiAffinity: Preferred - topologyKeys: - - kubernetes.io/hostname - tenancy: SharedNode - # Allows the Component to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule # Determines whether the metrics exporter needs to be published to the service endpoint. disableExporter: true # Specifies which types of logs should be collected for the Cluster. @@ -62,16 +50,6 @@ spec: storage: 20Gi - name: redis-sentinel disableExporter: false - affinity: - podAntiAffinity: Preferred - topologyKeys: - - kubernetes.io/hostname - tenancy: SharedNode - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule serviceAccountName: kb-redis-cluster replicas: 3 resources: @@ -90,16 +68,6 @@ spec: requests: storage: 20Gi - name: redis-twemproxy - affinity: - podAntiAffinity: Preferred - topologyKeys: - - kubernetes.io/hostname - tenancy: SharedNode - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule serviceAccountName: kb-redis-cluster replicas: 2 resources: diff --git a/examples/redis/cluster-cd-topology.yaml b/examples/redis/cluster-cd-topology.yaml index ef52389648f..90589be713a 100644 --- a/examples/redis/cluster-cd-topology.yaml +++ b/examples/redis/cluster-cd-topology.yaml @@ -22,18 +22,6 @@ spec: # Specifies the name of the Component. The name must be defined in the ClusterDefinition.Spec.topologies[x].components. # This name is also part of the Service DNS name and must comply with the IANA service naming rule. When ClusterComponentSpec is referenced as a template, the name is optional. Otherwise, it is required. - name: redis - # Specifies a group of affinity scheduling rules for the Component. It allows users to control how the Component's Pods are scheduled onto nodes in the cluster. - affinity: - podAntiAffinity: Preferred - topologyKeys: - - kubernetes.io/hostname - tenancy: SharedNode - # Allows the Component to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule # Determines whether the metrics exporter needs to be published to the service endpoint. disableExporter: true # Specifies which types of logs should be collected for the Cluster. @@ -62,16 +50,6 @@ spec: storage: 20Gi - name: redis-sentinel disableExporter: false - affinity: - podAntiAffinity: Preferred - topologyKeys: - - kubernetes.io/hostname - tenancy: SharedNode - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule serviceAccountName: kb-redis-cluster replicas: 3 resources: diff --git a/examples/redis/cluster-cmpd.yaml b/examples/redis/cluster-cmpd.yaml index d170de0e498..9bdc6eb3e6e 100644 --- a/examples/redis/cluster-cmpd.yaml +++ b/examples/redis/cluster-cmpd.yaml @@ -16,18 +16,6 @@ spec: - name: redis # References the name of a ComponentDefinition. The ComponentDefinition specifies the behavior and characteristics of the Component. If both `componentDefRef` and `componentDef` are provided, the `componentDef` will take precedence over `componentDefRef`. componentDef: redis-7 - # Specifies a group of affinity scheduling rules for the Component. It allows users to control how the Component's Pods are scheduled onto nodes in the cluster. - affinity: - podAntiAffinity: Preferred - topologyKeys: - - kubernetes.io/hostname - tenancy: SharedNode - # Allows the Component to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule # Determines whether the metrics exporter needs to be published to the service endpoint. disableExporter: true # Specifies which types of logs should be collected for the Cluster. @@ -57,16 +45,6 @@ spec: - name: redis-sentinel componentDef: redis-sentinel-7 disableExporter: false - affinity: - podAntiAffinity: Preferred - topologyKeys: - - kubernetes.io/hostname - tenancy: SharedNode - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule serviceAccountName: kb-redis-cluster replicas: 3 resources: diff --git a/examples/redis/cluster-sharding.yaml b/examples/redis/cluster-sharding.yaml index f222fb58e58..156e7730a12 100644 --- a/examples/redis/cluster-sharding.yaml +++ b/examples/redis/cluster-sharding.yaml @@ -21,16 +21,6 @@ spec: template: name: redis componentDef: redis-cluster-7 - affinity: - podAntiAffinity: Preferred - topologyKeys: - - kubernetes.io/hostname - tenancy: SharedNode - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule disableExporter: true enabledLogs: - running @@ -45,7 +35,7 @@ spec: memory: 1.1Gi # Specifies the version of the Component service. This field is used to determine the version of the service that is created for the Component. \ # The serviceVersion is used to determine the version of the Redis Sharding Cluster kernel. If the serviceVersion is not specified, the default value is the ServiceVersion defined in ComponentDefinition. - serviceVersion: 7.0.6 + serviceVersion: 7.2.4 # Specifies to use the NodePort, need to delete the services specs if you want to use container network services: - name: redis-advertised diff --git a/examples/redis/cluster.yaml b/examples/redis/cluster.yaml index ec198e1eaf1..b934f384180 100644 --- a/examples/redis/cluster.yaml +++ b/examples/redis/cluster.yaml @@ -17,23 +17,6 @@ spec: # - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data. # - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss. terminationPolicy: Delete - # Defines a set of node affinity scheduling rules for the Cluster's Pods. This field helps control the placement of Pods on nodes within the cluster. - affinity: - # Specifies the anti-affinity level of Pods within a Component. It determines how pods should be spread across nodes to improve availability and performance. - podAntiAffinity: Preferred - # Represents the key of node labels used to define the topology domain for Pod anti-affinity and Pod spread constraints. - topologyKeys: - - kubernetes.io/hostname - # Determines the level of resource isolation between Pods. It can have the following values: `SharedNode` and `DedicatedNode`. - # - SharedNode: Allow that multiple Pods may share the same node, which is the default behavior of K8s. - # - DedicatedNode: Each Pod runs on a dedicated node, ensuring that no two Pods share the same node. - tenancy: SharedNode - # An array that specifies tolerations attached to the Cluster's Pods, allowing them to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule # Specifies a list of ClusterComponentSpec objects used to define the individual components that make up a Cluster. This field allows for detailed configuration of each component within the Cluster. # Note: `shardingSpecs` and `componentSpecs` cannot both be empty; at least one must be defined to configure a cluster. # ClusterComponentSpec defines the specifications for a Component in a Cluster. diff --git a/examples/redis/restore-cmpd.yaml b/examples/redis/restore-cmpd.yaml index be3964f35a7..283fbd5d65e 100644 --- a/examples/redis/restore-cmpd.yaml +++ b/examples/redis/restore-cmpd.yaml @@ -18,18 +18,6 @@ spec: - name: redis # References the name of a ComponentDefinition. The ComponentDefinition specifies the behavior and characteristics of the Component. If both `componentDefRef` and `componentDef` are provided, the `componentDef` will take precedence over `componentDefRef`. componentDef: redis-7 - # Specifies a group of affinity scheduling rules for the Component. It allows users to control how the Component's Pods are scheduled onto nodes in the cluster. - affinity: - podAntiAffinity: Preferred - topologyKeys: - - kubernetes.io/hostname - tenancy: SharedNode - # Allows the Component to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule # Determines whether the metrics exporter needs to be published to the service endpoint. disableExporter: true # Specifies which types of logs should be collected for the Cluster. diff --git a/examples/redis/restore.yaml b/examples/redis/restore.yaml index b4d6b8a7d5a..589d52468d6 100644 --- a/examples/redis/restore.yaml +++ b/examples/redis/restore.yaml @@ -20,23 +20,6 @@ spec: # - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data. # - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss. terminationPolicy: Delete - # Defines a set of node affinity scheduling rules for the Cluster's Pods. This field helps control the placement of Pods on nodes within the cluster. - affinity: - # Specifies the anti-affinity level of Pods within a Component. It determines how pods should be spread across nodes to improve availability and performance. - podAntiAffinity: Preferred - # Represents the key of node labels used to define the topology domain for Pod anti-affinity and Pod spread constraints. - topologyKeys: - - kubernetes.io/hostname - # Determines the level of resource isolation between Pods. It can have the following values: `SharedNode` and `DedicatedNode`. - # - SharedNode: Allow that multiple Pods may share the same node, which is the default behavior of K8s. - # - DedicatedNode: Each Pod runs on a dedicated node, ensuring that no two Pods share the same node. - tenancy: SharedNode - # An array that specifies tolerations attached to the Cluster's Pods, allowing them to be scheduled onto nodes with matching taints. - tolerations: - - key: kb-data - operator: Equal - value: 'true' - effect: NoSchedule # Specifies a list of ClusterComponentSpec objects used to define the individual components that make up a Cluster. This field allows for detailed configuration of each component within the Cluster. # Note: `shardingSpecs` and `componentSpecs` cannot both be empty; at least one must be defined to configure a cluster. # ClusterComponentSpec defines the specifications for a Component in a Cluster.