I have a k8s cluster on which I want to deploy the MariaDB cluster.
I have master and slave pods and want to monitor them with a maxscale.
The pod runs with its default config without any problem, but when I mount the volume in a type of configmap and run maxctrl list servers
I get the below error:
Error: Could not connect to MaxScale
The logs of the pod:
Deployment file:
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: maxscale
namespace: mariaDB-cluster
spec:
replicas: 2
selector:
matchLabels:
app: maxscale
template:
metadata:
labels:
app: maxscale
spec:
containers:
- name: maxscale
image: mariadb/maxscale:6.3.1
volumeMounts:
- name: maxscale
mountPath: /etc/maxscale.cnf.d/
ports:
- name: mariadb
containerPort: 3306
- name: restapi
containerPort: 8989
volumes:
- name: maxscale
configMap:
name: maxscale-test
items:
- key: "maxscale.cnf"
path: "maxscale.cnf"
Configmap.yaml:
apiVersion: v1
kind: ConfigMap
metadata:
name: maxscale-test
namespace: mariadb-cluster
labels:
app: maxscale
app.kubernetes.io/name: maxscale
data:
maxscale.cnf: |
[maxscale]
threads=auto
admin_enabled=false
# Server definitions
#
# Set the address of the server to the network
# address of a MariaDB server.
#
[server1]
type=server
address=127.0.0.1
port=3306
protocol=MariaDBBackend
# Monitor for the servers
#
# This will keep MaxScale aware of the state of the servers.
# MariaDB Monitor documentation:
# https://mariadb.com/kb/en/maxscale-6-monitors/
[MariaDB-Monitor]
type=monitor
module=mariadbmon
servers=server1
user=myuser
password=mypwd
monitor_interval=2000
# Service definitions
#
# Service Definition for a read-only service and
# a read/write splitting service.
#
# ReadConnRoute documentation:
# https://mariadb.com/kb/en/mariadb-maxscale-6-readconnroute/
[Read-Only-Service]
type=service
router=readconnroute
servers=server1
user=myuser
password=mypwd
router_options=slave
# ReadWriteSplit documentation:
# https://mariadb.com/kb/en/mariadb-maxscale-6-readwritesplit/
[Read-Write-Service]
type=service
router=readwritesplit
servers=server1
user=myuser
password=mypwd
# Listener definitions for the services
#
# These listeners represent the ports the
# services will listen on.
#
[Read-Only-Listener]
type=listener
service=Read-Only-Service
protocol=MariaDBClient
port=4008
[Read-Write-Listener]
type=listener
service=Read-Write-Service
protocol=MariaDBClient
port=4006
I use the maxscale default config, but it does not work when I mount it to /etc/maxscale.cnf.d, so I think the problem is related to reading the config file.