This is my configMap. I'm trying to specify [mysqld] config, but when I use this file alone with
helm upgrade -i eramba bitnami/mariadb --set auth.rootPassword=eramba,auth.database=erambadb,initdbScriptsConfigMap=eramba,volumePermissions.enabled=true,primary.persistence.existingClaim=eramba-storage --namespace eramba-1 --set mariadb.volumePermissions.enabled=true
I don't see the specified configurations in my db pod; however, I do see the c2.8.1.sql file applied tho.
apiVersion: v1
kind: ConfigMap
metadata:
name: eramba
namespace: eramba-1
data:
my.cnf: |-
[mysqld]
max_connections = 2000
sql_mode=""
max_allowed_packet="128000000"
innodb_lock_wait_timeout="200"
c2.8.1.sql: |
CREATE DATABASE IF NOT EXISTS erambadb;
#create user 'erambauser'@'eramba-mariadb' identified by 'erambapassword';
#grant all on erambadb.* to 'erambauser'@'eramba-mariadb';
#flush privileges;
USE erambadb;
#
# SQL Export
# Created by Querious (201067)
# Created: 22 October 2019 at 17:39:48 CEST
# Encoding: Unicode (UTF-8)
#
SET @PREVIOUS_FOREIGN_KEY_CHECKS = @@FOREIGN_KEY_CHECKS;
SET FOREIGN_KEY_CHECKS = 0;
.....
CodePudding user response:
If you look at values.yaml file for MariaDB helm chart, you can see 3 types of ConfigMap:
- initdbScriptsConfigMap - to supply Init scripts to be run at first boot of DB instance
- primary.existingConfigmap - to control MariaDB Primary instance configuration
- secondary.existingConfigmap - to control MariaDB Secondary instance configuration
Thus, each of them is intended for the specific purpose and it is not a good idea to mix these settings in one ConfigMap.
I recommend you to create new ConfigMap eramba2 for custom my.cnf with all necessary values (not only new) as below.
apiVersion: v1
kind: ConfigMap
metadata:
name: eramba2
namespace: eramba-1
data:
my.cnf: |-
[mysqld]
skip-name-resolve
explicit_defaults_for_timestamp
max_connections = 2000
sql_mode=""
innodb_lock_wait_timeout="200"
basedir=/opt/bitnami/mariadb
plugin_dir=/opt/bitnami/mariadb/plugin
port=3306
socket=/opt/bitnami/mariadb/tmp/mysql.sock
tmpdir=/opt/bitnami/mariadb/tmp
max_allowed_packet=128000000
bind-address=::
pid-file=/opt/bitnami/mariadb/tmp/mysqld.pid
log-error=/opt/bitnami/mariadb/logs/mysqld.log
character-set-server=UTF8
collation-server=utf8_general_ci
[client]
port=3306
socket=/opt/bitnami/mariadb/tmp/mysql.sock
default-character-set=UTF8
plugin_dir=/opt/bitnami/mariadb/plugin
[manager]
port=3306
socket=/opt/bitnami/mariadb/tmp/mysql.sock
pid-file=/opt/bitnami/mariadb/tmp/mysqld.pid
Create eramba2 ConfigMap:
kubectl create -f eramba2.yaml
And then create MariaDB with helm using new ConfigMap eramba2:
helm upgrade -i eramba bitnami/mariadb --set auth.rootPassword=eramba,auth.database=erambadb,initdbScriptsConfigMap=eramba,volumePermissions.enabled=true,primary.persistence.existingClaim=eramba-storage,mariadb.volumePermissions.enabled=true,primary.existingConfigmap=eramba2 --namespace eramba-1
Connect to pod:
kubectl exec -it eramba-mariadb-0 -- /bin/bash
Check my.cnf file:
cat /opt/bitnami/mariadb/conf/my.cnf
