nextcloud / nextcloud/helm

architecture: replication dns issue

Open
#415 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

externalDatabase
Dominant language
Go Template
Stars
534
Forks
314
Avg merge
42m
Merged PRs (30d)
1

Description

Describe your Issue

When in replication mode for MariaDB, the mariadb-isalive container does not find the correct maria instance. It is looking for <ns-name>-mariadb when I would assume it should be looking for <ns-name>-mariadb-primary?. Because of this, the container will never end the initialization stage.

I would assume the externalDatabase.host value could change where mariadb-isalive is looking, but it does not.

I did create a bandaid solution, but I assume everyone would like this to work out of the box.

NOTE: The concept of this issue also exists with postgresql.

Describe your Environment

  • Kubernetes distribution: k3s

  • ArgoCD version v2.7.6+00c914a.dirty

  • Helm Chart Version: current with what's in master branch

Relevant parts of values.yaml:

...
internalDatabase:
  enabled: false

externalDatabase: # needs to be true in orded to use mariadb (see commends in original values.yaml)
  enabled: true
  host: nextcloud-mariadb-primary # (currently does not change where mariadb-isalive is searching)

mariadb:
  enabled: true
  architecture: replication
  primary:
    persistence:
      enabled: true
      size: 8Gi
...

Logs from mariadb-isalive

│ ERROR 2005 (HY000): Unknown server host 'nextcloud-mariadb' (-2)                                                                                                                                                                          │
│ waiting for mysql                                                                                                                                                                                                                         │
│ ERROR 2005 (HY000): Unknown server host 'nextcloud-mariadb' (-2)                                                                                                                                                                          │
│ waiting for mysql                                                                                                                                                                                                                         │
│ ERROR 2005 (HY000): Unknown server host 'nextcloud-mariadb' (-2)                                                                                                                                                                          │
│ waiting for mysql                                                                                                                                                                                                                         │
│ ERROR 2005 (HY000): Unknown server host 'nextcloud-mariadb' (-2)                                                                                                                                                                          │
│ waiting for mysql                                                                                                                                                                                                                         │
│ ERROR 2005 (HY000): Unknown server host 'nextcloud-mariadb' (-2)                                                                                                                                                                          │
│ waiting for mysql                                                                                                                                                                                                                         │
│ ERROR 2005 (HY000): Unknown server host 'nextcloud-mariadb' (-2)                                                                                                                                                                          │
│ waiting for mysql                                                                                                                                                                                                                         │
│ ERROR 2005 (HY000): Unknown server host 'nextcloud-mariadb' (-2)                                                                                                                                                                          │
│ waiting for mysql

Namespace state

image

Bandaid Solution

I was able to fix the dns issue by adding a headless service that pointed to the primary instance of the database.

apiVersion: v1
kind: Service
metadata:
  name: nextcloud-mariadb
  namespace: nextcloud
spec:
  clusterIP: None
  clusterIPs:
    - None
  internalTrafficPolicy: Cluster
  ipFamilies:
    - IPv4
  ipFamilyPolicy: SingleStack
  ports:
    - name: mariadb
      port: 3306
      protocol: TCP
      targetPort: mariadb
  selector:
    app.kubernetes.io/component: primary
    app.kubernetes.io/instance: nextcloud
    app.kubernetes.io/name: mariadb
  sessionAffinity: None
  type: ClusterIP
status:
  loadBalancer: {}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with values.yaml and the Helm templates that configure mariadb-isalive, externalDatabase.host, and the MariaDB services. Render the chart with replication enabled and compare the generated DNS names and health-check configuration. Done means the health check reaches the primary database without a manual headless service, including the analogous PostgreSQL case.

Written by the indexing model from the issue text.

Assessment

Tech stack
helm, kubernetes
Domain
databases, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.