Use Helm

Background

Use Helm to provide guidance for the installation of ShardingSphere-Proxy instance in a Kubernetes cluster. For more details, please checkout ShardingSphere-on-Cloud.

Requirements

  • Kubernetes 1.18+
  • kubectl
  • Helm 3.2.0+
  • StorageClass of PV (Persistent Volumes) can be dynamically applied for persistent data (Optional) .

Procedure

Online installation

  1. Add ShardingSphere-Proxy to the local helm repo:
  1. helm repo add shardingsphere https://shardingsphere.apache.org/charts
  1. Install ShardingSphere-Proxy charts:
  1. helm install shardingsphere-proxy shardingsphere/shardingsphere-proxy

Source installation

  1. Charts will be installed with default configuration if the following commands are executed:
  1. git clone https://github.com/apache/shardingsphere-on-cloud.git
  2. cd charts/shardingsphere-proxy/charts/governance
  3. helm dependency build
  4. cd ../..
  5. helm dependency build
  6. cd ..
  7. helm install shardingsphere-proxy shardingsphere-proxy

Note:

  1. Please refer to the configuration items description below for more details:
  2. Execute helm list to acquire all installed releases.

Uninstall

  1. Delete all release records by default, add --keep-history to keep them.
  1. helm uninstall shardingsphere-proxy

Parameters

Governance-Node parameters

NameDescriptionValue
governance.enabledSwitch to enable or disable the governance helm charttrue

Governance-Node ZooKeeper parameters

NameDescriptionValue
governance.zookeeper.enabledSwitch to enable or disable the ZooKeeper helm charttrue
governance.zookeeper.replicaCountNumber of ZooKeeper nodes1
governance.zookeeper.persistence.enabledEnable persistence on ZooKeeper using PVC(s)false
governance.zookeeper.persistence.storageClassPersistent Volume storage class“”
governance.zookeeper.persistence.accessModesPersistent Volume access modes[“ReadWriteOnce”]
governance.zookeeper.persistence.sizePersistent Volume size8Gi
governance.zookeeper.resources.limitsThe resources limits for the ZooKeeper containers{}
governance.zookeeper.resources.requests.memoryThe requested memory for the ZooKeeper containers256Mi
governance.zookeeper.resources.requests.cpuThe requested cpu for the ZooKeeper containers250m

Compute-Node ShardingSphere-Proxy parameters

NameDescriptionValue
compute.image.repositoryImage name of ShardingSphere-Proxy.apache/shardingsphere-proxy
compute.image.pullPolicyThe policy for pulling ShardingSphere-Proxy imageIfNotPresent
compute.image.tagShardingSphere-Proxy image tag5.1.2
compute.imagePullSecretsSpecify docker-registry secret names as an array[]
compute.resources.limitsThe resources limits for the ShardingSphere-Proxy containers{}
compute.resources.requests.memoryThe requested memory for the ShardingSphere-Proxy containers2Gi
compute.resources.requests.cpuThe requested cpu for the ShardingSphere-Proxy containers200m
compute.replicasNumber of cluster replicas3
compute.service.typeShardingSphere-Proxy network modeClusterIP
compute.service.portShardingSphere-Proxy expose port3307
compute.mysqlConnector.versionMySQL connector version5.1.49
compute.startPortShardingSphere-Proxy start port3307
compute.serverConfigServer Configuration file for ShardingSphere-Proxy“”

Sample

values.yaml

  1. #
  2. # Licensed to the Apache Software Foundation (ASF) under one or more
  3. # contributor license agreements. See the NOTICE file distributed with
  4. # this work for additional information regarding copyright ownership.
  5. # The ASF licenses this file to You under the Apache License, Version 2.0
  6. # (the "License"); you may not use this file except in compliance with
  7. # the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. ## @section Governance-Node parameters
  18. ## @param governance.enabled Switch to enable or disable the governance helm chart
  19. ##
  20. governance:
  21. enabled: true
  22. ## @section Governance-Node ZooKeeper parameters
  23. zookeeper:
  24. ## @param governance.zookeeper.enabled Switch to enable or disable the ZooKeeper helm chart
  25. ##
  26. enabled: true
  27. ## @param governance.zookeeper.replicaCount Number of ZooKeeper nodes
  28. ##
  29. replicaCount: 1
  30. ## ZooKeeper Persistence parameters
  31. ## ref: https://kubernetes.io/docs/user-guide/persistent-volumes/
  32. ## @param governance.zookeeper.persistence.enabled Enable persistence on ZooKeeper using PVC(s)
  33. ## @param governance.zookeeper.persistence.storageClass Persistent Volume storage class
  34. ## @param governance.zookeeper.persistence.accessModes Persistent Volume access modes
  35. ## @param governance.zookeeper.persistence.size Persistent Volume size
  36. ##
  37. persistence:
  38. enabled: false
  39. storageClass: ""
  40. accessModes:
  41. - ReadWriteOnce
  42. size: 8Gi
  43. ## ZooKeeper's resource requests and limits
  44. ## ref: https://kubernetes.io/docs/user-guide/compute-resources/
  45. ## @param governance.zookeeper.resources.limits The resources limits for the ZooKeeper containers
  46. ## @param governance.zookeeper.resources.requests.memory The requested memory for the ZooKeeper containers
  47. ## @param governance.zookeeper.resources.requests.cpu The requested cpu for the ZooKeeper containers
  48. ##
  49. resources:
  50. limits: {}
  51. requests:
  52. memory: 256Mi
  53. cpu: 250m
  54. ## @section Compute-Node parameters
  55. ##
  56. compute:
  57. ## @section Compute-Node ShardingSphere-Proxy parameters
  58. ## ref: https://kubernetes.io/docs/concepts/containers/images/
  59. ## @param compute.image.repository Image name of ShardingSphere-Proxy.
  60. ## @param compute.image.pullPolicy The policy for pulling ShardingSphere-Proxy image
  61. ## @param compute.image.tag ShardingSphere-Proxy image tag
  62. ##
  63. image:
  64. repository: "apache/shardingsphere-proxy"
  65. pullPolicy: IfNotPresent
  66. ## Overrides the image tag whose default is the chart appVersion.
  67. ##
  68. tag: "5.1.2"
  69. ## @param compute.imagePullSecrets Specify docker-registry secret names as an array
  70. ## e.g:
  71. ## imagePullSecrets:
  72. ## - name: myRegistryKeySecretName
  73. ##
  74. imagePullSecrets: []
  75. ## ShardingSphere-Proxy resource requests and limits
  76. ## ref: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
  77. ## @param compute.resources.limits The resources limits for the ShardingSphere-Proxy containers
  78. ## @param compute.resources.requests.memory The requested memory for the ShardingSphere-Proxy containers
  79. ## @param compute.resources.requests.cpu The requested cpu for the ShardingSphere-Proxy containers
  80. ##
  81. resources:
  82. limits: {}
  83. requests:
  84. memory: 2Gi
  85. cpu: 200m
  86. ## ShardingSphere-Proxy Deployment Configuration
  87. ## ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
  88. ## ref: https://kubernetes.io/docs/concepts/services-networking/service/
  89. ## @param compute.replicas Number of cluster replicas
  90. ##
  91. replicas: 3
  92. ## @param compute.service.type ShardingSphere-Proxy network mode
  93. ## @param compute.service.port ShardingSphere-Proxy expose port
  94. ##
  95. service:
  96. type: ClusterIP
  97. port: 3307
  98. ## MySQL connector Configuration
  99. ## ref: https://shardingsphere.apache.org/document/current/en/quick-start/shardingsphere-proxy-quick-start/
  100. ## @param compute.mysqlConnector.version MySQL connector version
  101. ##
  102. mysqlConnector:
  103. version: "5.1.49"
  104. ## @param compute.startPort ShardingSphere-Proxy start port
  105. ## ShardingSphere-Proxy start port
  106. ## ref: https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-proxy/startup/docker/
  107. ##
  108. startPort: 3307
  109. ## @section Compute-Node ShardingSphere-Proxy ServerConfiguration parameters
  110. ## NOTE: If you use the sub-charts to deploy Zookeeper, the server-lists field must be "{{ printf \"%s-zookeeper.%s:2181\" .Release.Name .Release.Namespace }}",
  111. ## otherwise please fill in the correct zookeeper address
  112. ## The server.yaml is auto-generated based on this parameter.
  113. ## If it is empty, the server.yaml is also empty.
  114. ## ref: https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/yaml-config/mode/
  115. ## ref: https://shardingsphere.apache.org/document/current/en/user-manual/common-config/builtin-algorithm/metadata-repository/
  116. ##
  117. serverConfig:
  118. ## @section Compute-Node ShardingSphere-Proxy ServerConfiguration authority parameters
  119. ## NOTE: It is used to set up initial user to login compute node, and authority data of storage node.
  120. ## ref: https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-proxy/yaml-config/authentication/
  121. ## @param compute.serverConfig.authority.privilege.type authority provider for storage node, the default value is ALL_PERMITTED
  122. ## @param compute.serverConfig.authority.users[0].password Password for compute node.
  123. ## @param compute.serverConfig.authority.users[0].user Username,authorized host for compute node. Format: <username>@<hostname> hostname is % or empty string means do not care about authorized host
  124. ##
  125. authority:
  126. privilege:
  127. type: ALL_PRIVILEGES_PERMITTED
  128. users:
  129. - password: root
  130. user: root@%
  131. ## @section Compute-Node ShardingSphere-Proxy ServerConfiguration mode Configuration parameters
  132. ## @param compute.serverConfig.mode.type Type of mode configuration. Now only support Cluster mode
  133. ## @param compute.serverConfig.mode.repository.props.namespace Namespace of registry center
  134. ## @param compute.serverConfig.mode.repository.props.server-lists Server lists of registry center
  135. ## @param compute.serverConfig.mode.repository.props.maxRetries Max retries of client connection
  136. ## @param compute.serverConfig.mode.repository.props.operationTimeoutMilliseconds Milliseconds of operation timeout
  137. ## @param compute.serverConfig.mode.repository.props.retryIntervalMilliseconds Milliseconds of retry interval
  138. ## @param compute.serverConfig.mode.repository.props.timeToLiveSeconds Seconds of ephemeral data live
  139. ## @param compute.serverConfig.mode.repository.type Type of persist repository. Now only support ZooKeeper
  140. ## @param compute.serverConfig.mode.overwrite Whether overwrite persistent configuration with local configuration
  141. ##
  142. mode:
  143. type: Cluster
  144. repository:
  145. type: ZooKeeper
  146. props:
  147. maxRetries: 3
  148. namespace: governance_ds
  149. operationTimeoutMilliseconds: 5000
  150. retryIntervalMilliseconds: 500
  151. server-lists: "{{ printf \"%s-zookeeper.%s:2181\" .Release.Name .Release.Namespace }}"
  152. timeToLiveSeconds: 60
  153. overwrite: true