Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MaxScale Pod CrashLoopBackOff - Service Name Conflict #56

Open
achar007 opened this issue Oct 5, 2024 · 0 comments
Open

MaxScale Pod CrashLoopBackOff - Service Name Conflict #56

achar007 opened this issue Oct 5, 2024 · 0 comments

Comments

@achar007
Copy link

achar007 commented Oct 5, 2024


Hi folks,

I’m running MaxScale as a Kubernetes pod using a ConfigMap, Secret, and Service resources. However, I’m experiencing an issue where the MaxScale pod is in a CrashLoopBackOff state.

Here’s the command I used to apply the configuration:

kubectl apply -f maxscale.yaml

Below is the configuration from maxscale.yaml:

# maxscale.yaml
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: maxscale-config
data:
  maxscale.cnf: |
    ########################
    ## Server list
    ########################

    [server1]
    type            = server
    address         = mariadb-sts-0.mariadb-service.kaizen.svc.cluster.local
    port            = 3306
    protocol        = MariaDBBackend
    serv_weight     = 1

    [server2]
    type            = server
    address         = mariadb-sts-1.mariadb-service.kaizen.svc.cluster.local
    port            = 3306
    protocol        = MariaDBBackend
    serv_weight     = 1

    [server3]
    type            = server
    address         = mariadb-sts-2.mariadb-service.kaizen.svc.cluster.local
    port            = 3306
    protocol        = MariaDBBackend
    serv_weight     = 1

    #########################
    ## MaxScale configuration
    #########################

    [maxscale]
    threads                 = auto
    log_augmentation        = 1
    ms_timestamp            = 1
    syslog                  = 1

    #########################
    # Monitor for the servers
    #########################

    [MariaDB-Monitor]
    type                    = monitor
    module                  = mariadbmon
    servers                 = server1,server2,server3
    user                    = root
    password                = secret
    auto_failover           = true
    auto_rejoin             = true
    enforce_read_only_slaves = 1

    #########################
    ## Service definitions for read/write splitting and read-only services.
    #########################

    [Read-Write-Service]
    type            = service
    router          = readwritesplit
    servers         = server1,server2,server3
    user            = root
    password        = secret
    max_slave_connections           = 100%
    max_sescmd_history              = 1500
    causal_reads                    = true
    causal_reads_timeout            = 10
    transaction_replay              = true
    transaction_replay_max_size     = 1Mi
    delayed_retry                   = true
    master_reconnection             = true
    master_failure_mode             = fail_on_write
    max_slave_replication_lag       = 3

    [Read-Only-Service]
    type            = service
    router          = readconnroute
    servers         = server1,server2,server3
    router_options  = slave
    user            = root
    password        = secret

    ##########################
    ## Listener definitions for the service
    ## Listeners represent the ports the service will listen on.
    ##########################

    [Read-Write-Listener]
    type            = listener
    service         = Read-Write-Service
    protocol        = MariaDBClient
    port            = 4008

    [Read-Only-Listener]
    type            = listener
    service         = Read-Only-Service
    protocol        = MariaDBClient
    port            = 4006

---
apiVersion: v1
kind: Secret
metadata:
  name: maxscale-secret
type: Opaque
data:
  ROOT_USER: cm9vdA==  # "root" in base64
  ROOT_PASSWORD: c2VjcmV0  # "secret" in base64
  MAXSCALE_USER: cm9vdA==  # "root" in base64
  MAXSCALE_PASSWORD: c2VjcmV0  # "secret" in base64

---
apiVersion: v1
kind: Pod
metadata:
  name: maxscale
  labels:
    app: maxscale
spec:
  containers:
    - name: maxscale
      image: mariadb/maxscale:latest
      ports:
        - containerPort: 4006
        - containerPort: 4008
      volumeMounts:
        - name: maxscale-config
          mountPath: /etc/maxscale.cnf
          subPath: maxscale.cnf
      env:
        - name: ROOT_USER
          valueFrom:
            secretKeyRef:
              name: maxscale-secret
              key: ROOT_USER
        - name: ROOT_PASSWORD
          valueFrom:
            secretKeyRef:
              name: maxscale-secret
              key: ROOT_PASSWORD
        - name: MAXSCALE_USER
          valueFrom:
            secretKeyRef:
              name: maxscale-secret
              key: MAXSCALE_USER
        - name: MAXSCALE_PASSWORD
          valueFrom:
            secretKeyRef:
              name: maxscale-secret
              key: MAXSCALE_PASSWORD
  volumes:
    - name: maxscale-config
      configMap:
        name: maxscale-config

---
apiVersion: v1
kind: Service
metadata:
  name: maxscale-service
spec:
  type: ClusterIP
  ports:
    - port: 4006
      targetPort: 4006
      name: ro-listener
    - port: 4008
      targetPort: 4008
      name: rw-listener
  selector:
    app: maxscale

When I check the status of my pods with:

kubectl get all -n kaizen

I see the following output, indicating the MaxScale pod is failing:

NAME                READY   STATUS             RESTARTS      AGE
pod/mariadb-sts-0   1/1     Running            1 (78m ago)   95m
pod/mariadb-sts-1   1/1     Running            1 (78m ago)   131m
pod/mariadb-sts-2   1/1     Running            1 (78m ago)   130m
pod/maxscale        0/1     CrashLoopBackOff   1 (5s ago)    11s

NAME                       TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)             AGE
service/mariadb-service    ClusterIP   None            <none>        3306/TCP            132m
service/maxscale-service   ClusterIP   10.105.33.116   <none>        4006/TCP,4008/TCP   11s

NAME                           READY   AGE
statefulset.apps/mariadb-sts   3/3     132m

When I check the logs for the MaxScale pod, I see the following error message:

kubectl -n kaizen logs maxscale

Starting...
MaxScale PID = 18
'check system' not defined in control file, failed to add automatic configuration (service name maxscale is used already) -- please add 'check system <name>' manually
maxscale:2: Service name conflict, maxscale already defined '/var/log/monit.log'

Can anyone help me understand why the MaxScale pod is crashing and how to resolve this service name conflict? Any guidance would be greatly appreciated!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant