cassandra.yaml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. ---
  2. # Source: cassandra/templates/cassandra-secret.yaml
  3. apiVersion: v1
  4. kind: Secret
  5. metadata:
  6. name: my-release-cassandra
  7. namespace: default
  8. labels:
  9. app.kubernetes.io/name: cassandra
  10. helm.sh/chart: cassandra-6.0.1
  11. app.kubernetes.io/instance: my-release
  12. app.kubernetes.io/managed-by: Helm
  13. type: Opaque
  14. data:
  15. cassandra-password: "SFVZRzR2VU4zaQ=="
  16. ---
  17. # Source: cassandra/templates/headless-svc.yaml
  18. apiVersion: v1
  19. kind: Service
  20. metadata:
  21. name: my-release-cassandra-headless
  22. namespace: default
  23. labels:
  24. app.kubernetes.io/name: cassandra
  25. helm.sh/chart: cassandra-6.0.1
  26. app.kubernetes.io/instance: my-release
  27. app.kubernetes.io/managed-by: Helm
  28. spec:
  29. clusterIP: None
  30. publishNotReadyAddresses: true
  31. ports:
  32. - name: intra
  33. port: 7000
  34. targetPort: intra
  35. - name: tls
  36. port: 7001
  37. targetPort: tls
  38. - name: jmx
  39. port: 7199
  40. targetPort: jmx
  41. - name: cql
  42. port: 9042
  43. targetPort: cql
  44. - name: thrift
  45. port: 9160
  46. targetPort: thrift
  47. selector:
  48. app.kubernetes.io/name: cassandra
  49. app.kubernetes.io/instance: my-release
  50. ---
  51. # Source: cassandra/templates/service.yaml
  52. apiVersion: v1
  53. kind: Service
  54. metadata:
  55. name: my-release-cassandra
  56. namespace: default
  57. labels:
  58. app.kubernetes.io/name: cassandra
  59. helm.sh/chart: cassandra-6.0.1
  60. app.kubernetes.io/instance: my-release
  61. app.kubernetes.io/managed-by: Helm
  62. spec:
  63. type: ClusterIP
  64. ports:
  65. - name: cql
  66. port: 9042
  67. targetPort: cql
  68. nodePort: null
  69. - name: thrift
  70. port: 9160
  71. targetPort: thrift
  72. nodePort: null
  73. - name: metrics
  74. port: 8080
  75. nodePort: null
  76. selector:
  77. app.kubernetes.io/name: cassandra
  78. app.kubernetes.io/instance: my-release
  79. ---
  80. # Source: cassandra/templates/statefulset.yaml
  81. apiVersion: apps/v1
  82. kind: StatefulSet
  83. metadata:
  84. name: my-release-cassandra
  85. namespace: default
  86. labels:
  87. app.kubernetes.io/name: cassandra
  88. helm.sh/chart: cassandra-6.0.1
  89. app.kubernetes.io/instance: my-release
  90. app.kubernetes.io/managed-by: Helm
  91. spec:
  92. selector:
  93. matchLabels:
  94. app.kubernetes.io/name: cassandra
  95. app.kubernetes.io/instance: my-release
  96. matchExpressions:
  97. - { key: tier, operator: In, values: [cache] }
  98. - { key: environment, operator: NotIn, values: [dev] }
  99. serviceName: my-release-cassandra-headless
  100. podManagementPolicy: OrderedReady
  101. replicas: 2
  102. updateStrategy:
  103. type: RollingUpdate
  104. template:
  105. metadata:
  106. labels:
  107. app.kubernetes.io/name: cassandra
  108. helm.sh/chart: cassandra-6.0.1
  109. app.kubernetes.io/instance: my-release
  110. app.kubernetes.io/managed-by: Helm
  111. spec:
  112. affinity:
  113. podAffinity:
  114. podAntiAffinity:
  115. preferredDuringSchedulingIgnoredDuringExecution:
  116. - podAffinityTerm:
  117. labelSelector:
  118. matchLabels:
  119. app.kubernetes.io/name: cassandra
  120. app.kubernetes.io/instance: my-release
  121. namespaces:
  122. - default
  123. topologyKey: kubernetes.io/hostname
  124. weight: 1
  125. nodeAffinity:
  126. securityContext:
  127. fsGroup: 1001
  128. containers:
  129. - name: cassandra
  130. command:
  131. - bash
  132. - -ec
  133. - |
  134. # Node 0 is the password seeder
  135. if [[ $HOSTNAME =~ (.*)-0$ ]]; then
  136. echo "Setting node as password seeder"
  137. export CASSANDRA_PASSWORD_SEEDER=yes
  138. else
  139. # Only node 0 will execute the startup initdb scripts
  140. export CASSANDRA_IGNORE_INITDB_SCRIPTS=1
  141. fi
  142. /opt/bitnami/scripts/cassandra/entrypoint.sh /opt/bitnami/scripts/cassandra/run.sh
  143. image: docker.io/bitnami/cassandra:3.11.8-debian-10-r20
  144. imagePullPolicy: "IfNotPresent"
  145. securityContext:
  146. runAsUser: 1001
  147. env:
  148. - name: BITNAMI_DEBUG
  149. value: "false"
  150. - name: CASSANDRA_CLUSTER_NAME
  151. value: cassandra
  152. - name: CASSANDRA_SEEDS
  153. value: "my-release-cassandra-0.my-release-cassandra-headless.default.svc.cluster.local"
  154. - name: CASSANDRA_PASSWORD
  155. valueFrom:
  156. secretKeyRef:
  157. name: my-release-cassandra
  158. key: cassandra-password
  159. - name: POD_IP
  160. valueFrom:
  161. fieldRef:
  162. fieldPath: status.podIP
  163. - name: CASSANDRA_USER
  164. value: "cassandra"
  165. - name: CASSANDRA_NUM_TOKENS
  166. value: "256"
  167. - name: CASSANDRA_DATACENTER
  168. value: dc1
  169. - name: CASSANDRA_ENDPOINT_SNITCH
  170. value: SimpleSnitch
  171. - name: CASSANDRA_RACK
  172. value: rack1
  173. - name: CASSANDRA_ENABLE_RPC
  174. value: "true"
  175. envFrom:
  176. livenessProbe:
  177. exec:
  178. command:
  179. - /bin/bash
  180. - -ec
  181. - |
  182. nodetool status
  183. initialDelaySeconds: 60
  184. periodSeconds: 30
  185. timeoutSeconds: 5
  186. successThreshold: 1
  187. failureThreshold: 5
  188. readinessProbe:
  189. exec:
  190. command:
  191. - /bin/bash
  192. - -ec
  193. - |
  194. nodetool status | grep -E "^UN\\s+${POD_IP}"
  195. initialDelaySeconds: 60
  196. periodSeconds: 10
  197. timeoutSeconds: 5
  198. successThreshold: 1
  199. failureThreshold: 5
  200. ports:
  201. - name: intra
  202. containerPort: 7000
  203. - name: tls
  204. containerPort: 7001
  205. - name: jmx
  206. containerPort: 7199
  207. - name: cql
  208. containerPort: 9042
  209. - name: thrift
  210. containerPort: 9160
  211. resources:
  212. limits: {}
  213. requests: {}
  214. volumeMounts:
  215. - name: data
  216. mountPath: /bitnami/cassandra
  217. volumes:
  218. - name: config-volume
  219. configMap:
  220. name: config-example
  221. volumeClaimTemplates:
  222. - metadata:
  223. name: data
  224. labels:
  225. app.kubernetes.io/name: cassandra
  226. app.kubernetes.io/instance: my-release
  227. spec:
  228. accessModes:
  229. - "ReadWriteOnce"
  230. resources:
  231. requests:
  232. storage: "8Gi"