Skip to content

Instantly share code, notes, and snippets.

@fcaldarelli
Created September 14, 2025 13:05
Show Gist options
  • Select an option

  • Save fcaldarelli/2cde21b25a24c44b7ceb50eb6f131953 to your computer and use it in GitHub Desktop.

Select an option

Save fcaldarelli/2cde21b25a24c44b7ceb50eb6f131953 to your computer and use it in GitHub Desktop.
# ===============================
# Secrets for MariaDB and MaxScale
# ===============================
apiVersion: v1
kind: Secret
metadata:
name: mariadb-root-secret
namespace: mariadb-ha
stringData:
password: aaaaaaPDaA8fKDv
# ===============================
# MySQL Configuration (ConfigMap)
# ===============================
---
apiVersion: v1
kind: ConfigMap
metadata:
name: mariadb-config
namespace: mariadb-ha
data:
my.cnf: |
[mariadb]
skip-name-resolve
max_allowed_packet = 32M
max_connections = 150
tmp_table_size = 128M
max_heap_table_size = 128M
bulk_insert_buffer_size = 64M
query_cache_size = 0
query_cache_type = 0
slow_query_log = 1
log_output = TABLE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
innodb_buffer_pool_size = 7G
innodb_log_file_size = 256M
innodb_file_per_table = 1
innodb_flush_log_at_trx_commit = 1
# ===============================
# MariaDB Galera Cluster
# ===============================
---
apiVersion: k8s.mariadb.com/v1alpha1
kind: MariaDB
metadata:
name: mariadb
namespace: mariadb-ha
spec:
rootPasswordSecretKeyRef:
name: mariadb-root-secret
key: password
port: 3306
replicas: 3
galera:
enabled: true
config:
volumeClaimTemplate:
storageClassName: openebs-hostpath
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
storage:
size: 40Gi
storageClassName: openebs-hostpath
myCnfConfigMapKeyRef:
name: mariadb-config
key: my.cnf
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "app.kubernetes.io/instance"
operator: In
values:
- mariadb
topologyKey: "kubernetes.io/hostname"
podDisruptionBudget:
maxUnavailable: 1
updateStrategy:
type: ReplicasFirstPrimaryLast
service:
type: NodePort
resources:
requests:
cpu: 2000m
memory: 12Gi
limits:
cpu: 2000m
memory: 12Gi
metrics:
enabled: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment