YugabyteDB Cluster CRD

YugabyteDB clusters can be created/configured by creating/updating the custom resource object ybclusters.yugabytedb.rook.io. Please follow instructions in the YugabyteDB Operator Quikstart to create a YugabyteDB cluster.

The configuration options provided by the custom resource are explained here.

Sample

  1. apiVersion: yugabytedb.rook.io/v1alpha1
  2. kind: YBCluster
  3. metadata:
  4. name: rook-yugabytedb
  5. namespace: rook-yugabytedb
  6. spec:
  7. master:
  8. # Replica count for Master.
  9. replicas: 3
  10. # optional. Default values for resource are as below
  11. resource:
  12. requests:
  13. cpu: 2
  14. memory: 2Gi
  15. limits:
  16. cpu: 2
  17. memory: 2Gi
  18. # Mentioning network ports is optional. If some or all ports are not specified, then they will be defaulted to below-mentioned values, except for tserver-ui.
  19. network:
  20. ports:
  21. - name: yb-master-ui
  22. port: 7000 # default value
  23. - name: yb-master-rpc
  24. port: 7100 # default value
  25. # Volume claim template for Master
  26. volumeClaimTemplate:
  27. metadata:
  28. name: datadir
  29. spec:
  30. accessModes: [ "ReadWriteOnce" ]
  31. resources:
  32. requests:
  33. storage: 1Gi
  34. storageClassName: standard # Modify this field with required storage class name.
  35. tserver:
  36. # Replica count for TServer
  37. replicas: 3
  38. # optional. Default values for resource are as below
  39. resource:
  40. requests:
  41. cpu: 2
  42. memory: 4Gi
  43. limits:
  44. cpu: 2
  45. memory: 4Gi
  46. # Mentioning network ports is optional. If some or all ports are not specified, then they will be defaulted to below-mentioned values, except for tserver-ui.
  47. # For tserver-ui a cluster ip service will be created if the yb-tserver-ui port is explicitly mentioned. If it is not specified, only StatefulSet & headless service will be created for TServer. TServer ClusterIP service creation will be skipped. Whereas for Master, all 3 kubernetes objects will always be created.
  48. network:
  49. ports:
  50. - name: yb-tserver-ui
  51. port: 9000
  52. - name: yb-tserver-rpc
  53. port: 9100 # default value
  54. - name: ycql
  55. port: 9042 # default value
  56. - name: yedis
  57. port: 6379 # default value
  58. - name: ysql
  59. port: 5433 # default value
  60. # Volume claim template for TServer
  61. volumeClaimTemplate:
  62. metadata:
  63. name: datadir
  64. spec:
  65. accessModes: [ "ReadWriteOnce" ]
  66. resources:
  67. requests:
  68. storage: 1Gi
  69. storageClassName: standard # Modify this field with required storage class name.

Configuration options

Master/TServer

Master & TServer are two essential components of a YugabyteDB cluster. Master is responsible for recording and maintaining system metadata & for admin activities. TServers are mainly responsible for data I/O. Specify Master/TServer specific attributes under master/tserver. The valid attributes are replicas, network & volumeClaimTemplate.

Replica Count

Specify replica count for master & tserver pods under replicas field. This is a required field.

Resource

Specify resource requests and limits for CPU & Memory. If provided, the given resource values will be used. If omitted the default CPU request & limit will be 2, whereas default memory request & limit will be 2Gi & 4Gi for Master & TServer, respectively. You may override these values for dev environments where the cluster doesn’t have CPU/Memory as per the defaults. Though it is recommended to use the defaults for production-like deployments.

Network

network field accepts NetworkSpec to be specified which describes YugabyteDB network settings. This is an optional field. Default network settings will be used, if any or all of the acceptable values are absent.

A ClusterIP service will be created when yb-tserver-ui port is explicitly specified. If it is not specified, only StatefulSet & headless service will be created for TServer. ClusterIP service creation will be skipped. Whereas for Master, all 3 kubernetes objects will always be created.

The acceptable port names & their default values are as follows:

NameDefault Value
yb-master-ui7000
yb-master-rpc7100
yb-tserver-rpc9100
ycql9042
yedis6379
ysql5433

Volume Claim Templates

Specify a PersistentVolumeClaim template under the volumeClaimTemplate field for master & tserver each. This is a required field.