apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
metadata:
name: oceanbase-cluster
namespace: default
annotations:
#Specify how many clusters to create with-in one ob cluster, set to 2 when creating a primary and secondary cluster
"kubeblocks.io/extra-env": "{\"TENANT_NAME\":\"obtenant\",\"ZONE_COUNT\":\"1\",\"OB_CLUSTERS_COUNT\":\"2\",\"TENANT_CPU\":\"2\",\"TENANT_MEMORY\":\"2G\",\"TENANT_DISK\":\"5G\"}"
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
# 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: ob-ce-0
componentDef: ob-ce-repl-host
replicas: 1
resources:
limits:
cpu: '3'
memory: 8Gi
requests:
cpu: '3'
memory: 8Gi
volumeClaimTemplates:
- name: data-file
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50Gi
- name: data-log
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50Gi
- name: log
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
- name: workdir
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
- name: ob-ce-1
componentDef: ob-ce-repl-host
replicas: 1
resources:
limits:
cpu: '3'
memory: 8Gi
requests:
cpu: '3'
memory: 8Gi
volumeClaimTemplates:
- name: data-file
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50Gi
- name: data-log
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50Gi
- name: log
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
- name: workdir
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
kbcli version Kubernetes: v1.28.7-gke.1026000 KubeBlocks: 0.9.0-beta.17 kbcli: 0.9.0-beta.4
create cluster kubectl apply -f cluster-repl.yaml
cluster create failed