Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Customize default container

MOCO has containers that are automatically added by the system in addition to containers added by the user. (e.g. agent, moco-init etc...)

The MySQLCluster.spec.podTemplate.overwriteContainers field can be used to overwrite such containers. Currently, only container resources and securityContexts can be overwritten. overwriteContainers is only available in MySQLCluster v1beta2.

apiVersion: moco.cybozu.com/v1beta2
kind: MySQLCluster
metadata:
  namespace: default
  name: test
spec:
  podTemplate:
    spec:
      containers:
      - name: mysqld
        image: ghcr.io/cybozu-go/moco/mysql:8.4.6
    overwriteContainers:
    - name: agent
      resources:
        requests:
          cpu: 50m
    - name: moco-init
      securityContext:
        capabilities:
          add: ["SYS_NICE"]

System containers

The following is a list of system containers and default resource settings. Specifying container names in overwriteContainers that are not listed here will result in an error in API validation.

NameDefault CPU Requests/LimitsDefault Memory Requests/LimitsDescription
agent100m / 100m100Mi / 100MiMOCO's agent container running in sidecar. refs: https://github.com/cybozu-go/moco-agent
moco-init100m / 100m512Mi / 512MiInitializes MySQL data directory and create a configuration snippet to give instance specific configuration values such as server_id and admin_address.
slow-log100m / 100m20Mi / 20MiSidecar container for outputting slow query logs.
mysqld-exporter200m / 200m100Mi / 100MiMySQL server exporter sidecar container.

All system containers are configured runAsUser=1000 and runAsGroup=1000 in securityContext. If you specify securityContext in overwriteContainers, this configuration of specified container will be overwritten.