K8S 部署 MariaDB,
文章目录
- 单节点部署
- 集群部署
本文使用 bitnami 镜像部署 MariaDB
官方文档:https://github.com/bitnami/charts/tree/main/bitnami/mariadb
添加 bitnami 仓库
helm repo add bitnami https://charts.bitnami.com/bitnami
单节点部署
自定义 values.yaml
- storageClass:集群的存储类,可以参考文章 k8s 安装本地 storageClass 或者
K8S 集群使用 NFS 做 storageclass - auth.rootPassword:root 账号的密码
- primary.persistence.size:主节点的存储大小
- metrics.enabled:开启监控,默认为 false
- primary.service.type:设置 NodePort,集群外调用
- primary.service.nodePorts.mysql:设置集群调用端口
global: storageClass: "nfs-client" auth: rootPassword: "123456" primary: persistence: size: 4Gi metrics: enabled: true primary: service: type: NodePort nodePorts: mysql: 30009
开始部署,例子是部署在名叫 mariadb 的命名空间里
helm install mariadb bitnami/mariadb -n mariadb -f values.yaml
部署成功
Rancher 可以看到 mariadb 和 metrics 部署成功
集群部署
自定义 values.yaml
- architecture:MariaDB 架构,可选 standalone (单机) 或者 replication (集群),默认为 standalone
- secondary.replicaCount:从节点个数
global: storageClass: "nfs-client" auth: rootPassword: "123456" primary: persistence: size: 4Gi metrics: enabled: true primary: service: type: NodePort nodePorts: mysql: 30009 architecture: replication secondary: replicaCount: 3
开始部署
helm install mariadb bitnami/mariadb -n mariadb -f values.yaml
部署成功,可以看到从节点有 3 个
navicat 连接成功
本站文章为和通数据库网友分享或者投稿,欢迎任何形式的转载,但请务必注明出处.
同时文章内容如有侵犯了您的权益,请联系QQ:970679559,我们会在尽快处理。