Tanzu MySQL CRD Property Reference

This topic describes the available fields of the Tanzu MySQL Custom Resource Definition.

Synopsis

apiVersion: with.sql.tanzu.vmware.com/v1
kind: MySQL
metadata:
  name: mysql-sample
spec:
  storageSize: 1Gi
#  imagePullSecretName: tanzu-image-registry

#### Set the storage class name to change storage class of the PVC associated with this resource
#  storageClassName: standard

#### Set the type of Service used to provide access to the MySQL database.
#  serviceType: LoadBalancer

#### Set the name of the Secret used for TLS
#  tls:
#    secret:
#      name: mysql-tls-secret

#### Enable highly available cluster
#  highAvailability:
#    enabled: true

#### Enable affinity
#  databasePodConfig:
#    affinity:
#      podAntiAffinity:
#        preferredDuringSchedulingIgnoredDuringExecution:
#          - weight: 1
#            podAffinityTerm:
#              topologyKey: "kubernetes.io/hostname"
#              labelSelector:
#                matchExpressions:
#                  - key: "app.kubernetes.io/component"
#                    operator: In
#                    values:
#                      - database
#                  - key: "app.kubernetes.io/instance"
#                    operator: In
#                    values:
#                      - mysql-sample
#    tolerations:
#    - key: node.kubernetes.io/disk-pressure
#      operator: "Exists"
#      effect: "NoExecute"
#      tolerationSeconds: 3600
#  proxyPodConfig:
#    affinity:
#      podAntiAffinity:
#        preferredDuringSchedulingIgnoredDuringExecution:
#          - weight: 1
#            podAffinityTerm:
#              topologyKey: "kubernetes.io/hostname"
#              labelSelector:
#                matchExpressions:
#                  - key: "app.kubernetes.io/component"
#                    operator: In
#                    values:
#                      - proxy
#                  - key: "app.kubernetes.io/instance"
#                    operator: In
#                    values:
#                      - mysql-sample
#    tolerations:
#    - key: node.kubernetes.io/memory-pressure
#      operator: "Exists"
#      effect: "NoExecute"
#      tolerationSeconds: 3600

#### Examples to set resource limit/request for mysql/backup containers.
#  resources:

#### This is the container running the mysql server.
#    mysql:
#      requests:
#        cpu: 750m
#        memory: 500Mi
#      limits:
#        cpu: '1.0'
#        memory: 800Mi

#### This is the sidecar container that manages backups and innodb cluster operations
#    mysqlSidecar:
#      requests:
#        cpu: 100m
#        memory: 50Mi
#      limits:
#        cpu: 250m
#        memory: 75Mi

#### This is the container that proxies connections to MySQL
#    proxy:
#      requests:
#        cpu: 200m
#        memory: 48Mi
#      limits:
#        cpu: '1.0'
#        memory: 256Mi

#### This is the container that exports metrics
#    metrics:
#      requests:
#        cpu: 100m
#        memory: 32Mi
#      limits:
#        cpu: 250m
#        memory: 75Mi

Description

Applying this resource causes the Kubernetes Operator to create a StatefulSet with a single Pod and three containers. One container runs the MySQL database software, one runs the components to support backups, and the third runs the mysqld_exporter (for monitoring). The MySQL pod mounts a persistent volume claim (PVC) which holds the MySQL data.

You specify MySQL instance configuration properties to the MySQL operator with a YAML-formatted manifest file. A sample manifest file is provided in mysql.yaml. See also Creating and Deleting Instance for information about deploying a new MySQL instance using a manifest file.

The list below explains the properties that you can set in your MySQL resource.

Metadata

name: <string>
Required
Default: standard
The name of the MySQL instance. Must be unique within a namespace. Cannot be modified after the MySQL instance has been created. The metadata can set the name, namespace, labels, annotations, and more for the MySQL object. For more information, see the Kubernetes documentation.
Example: mysql-sample

Spec

storageSize: <Quantity>
Optional
Default: n/a
The size of the persistent volume claims (PVCs) for MySQL instance Pods. Specify a suffix for the units (for example: 100G, 1T). After being set, cannot be reduced, but can be increased. For information about allowed size units, see discussion about resource quantities in the kubernetes community GitHub repository.
Example: 50Gi

imagePullSecretName: <string>
Required
Default: n/a
An existing Kubernetes docker-registry secret that can access the registry containing the MySQL image.
Example: tanzu-mysql-image-registry

storageClassName: <string>
Optional
Default: standard
The StorageClass used for PVCs associated with MySQL instance Pods. Cannot be modified after the MySQL instance has been created. For available types, contact your Kubernetes admin. For information about the StorageClass concept, see the Kubernetes documentation.
Example: standard

serviceType: <string>
Optional
Default: ClusterIP
The type of Service used to provide access to the MySQL database. Only ClusterIP and LoadBalancer are supported. For more information about Kubernetes ServiceTypes, see the Service Types in the Kubernetes documentation.
Example: LoadBalancer

version: <string>
Optional
Default: The value of defaultInstanceVersion set by the service administrator in the Tanzu MySQL Helm chart.
The version of the MySQL instance installed. Can be any of ‘1.0.0’, '1.1.0’, or '1.2.0’. See List Instances By Version.
Example: 1.1.0

tls.secret.name: <string>
Optional
Default: n/a
The name of the Kubernetes secret containing the TLS certificate and private key used to support encrypted connections by clients. For more configuration details, see Configuring TLS for MySQL Instances
Example: mysql-tls-secret

highAvailability.enabled: <boolean>
Optional
Default: false
Whether the instance is a high-availability cluster (not single-node). After being set to true, it cannot be modified. For information about high availability, see Configuring MySQL Instances for High Availability. Example: true

databasePodConfig.affinity: <corev1.Affinity>
Optional
Default: Database pods for a given instance are scheduled in unique Kubernetes nodes.
The affinity rules for the MySQL database pods must follow the affinity defined by the Kubernetes api, can be updated, and are not required when creating resources. For more information regarding the various fields, see the Affinity and Anti-Affinity in the Kubernetes documention.
Example:

apiVersion: with.sql.tanzu.vmware.com/v1
kind: MySQL
metadata:
    name: my-instance
spec:
    storageSize: 1Gi
      databasePodConfig:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - weight: 1
            - topologyKey: "kubernetes.io/hostname"
               labelSelector:
                 matchExpressions:
                   - key: "app.kubernetes.io/component"
                   operator: In
                   values:
                     - database
                   - key: "app.kubernetes.io/instance"
                   operator: In
                   values:
                     - <instance.name>

databasePodConfig.tolerations: <corev1.Toleration>
Optional
Default: No default tolerations are configured by the Tanzu MySQL Operator.
Configures Kubernetes Tolerations for the MySQL instance’s database Pods. The Tolerations can be updated, and are not required when creating resources. For more details on the Kubernetes Taints and Tolerations concept, see Taints and Tolerations in the Kubernetes documentation.
Example:

---
  apiVersion: with.sql.tanzu.vmware.com/v1
  kind: MySQL
  metadata:
      name: my-instance
  spec:
      storageSize: 1Gi
      databasePodConfig:
        tolerations:
        - key: node.kubernetes.io/memory-pressure
          operator: "Exists"
            effect: "NoExecute"
              tolerationSeconds: 3600

proxyPodConfig.affinity: <corev1.Affinity>
Optional
Default: Preference is to avoid scheduling the two proxy pods on the same Kubernetes node.
Affinity rules for the Proxy database pods. Used only when spec.highAvailability.enabled = true. For more information regarding the various fields, see the Affinity and Anti-Affinity in the Kubernetes documention.
Example:

apiVersion: with.sql.tanzu.vmware.com/v1
kind: MySQL
metadata:
    name: my-instance
spec:
    storageSize: 1Gi
      databasePodConfig:
      affinity:
        affinity:
        podAntiAffinity:
            preferredDuringSchedulingIgnoredDuringExecution:
            - weight: 1
            - topologyKey: "kubernetes.io/hostname"
                labelSelector:
                matchExpressions:
                    - key: "app.kubernetes.io/component"
                    operator: In
                    values:
                        - proxy
                    - key: "app.kubernetes.io/instance"
                    operator: In
                    values:
                        - <instance.name>

proxyPodConfig.tolerations: <corev1.Toleration>
Optional
Default: No default tolerations are configured by the Tanzu MySQL Operator
Configures Kubernetes Tolerations for the MySQL instance’s database Pods. For more details on the Kubernetes Taints and Tolerations concept, see Taints and Tolerations in the Kubernetes documentation.
Example:

---
  apiVersion: with.sql.tanzu.vmware.com/v1
  kind: MySQL
  metadata:
      name: my-instance
  spec:
      storageSize: 1Gi
      databasePodConfig:
        tolerations:
        tolerations:
        - key: node.kubernetes.io/memory-pressure
            operator: "Exists"
              effect: "NoExecute"
                tolerationSeconds: 3600

Resources

resources.mysql: <limits.cpu, limits.memory>
Optional
Default: Best effort
The maximum CPU and memory allowed for the MySQL container. If not specified, Kubernetes does its best effort to allocate necessary compute resources for this container. For more information about managing resources for containers, see Manage Resources in the Kubernetes documentation. Example:

...
resources:
   mysql:
     limits:
       cpu: '1.0'
       memory: 800Mi
...

resources.mysql: <requests.cpu, requests.memory>
Optional
Default: Best effort
The minimum CPU and memory allowed for the MySQL container. If not specified, defaults to limits, if limits have been explicitly specified. For more information about limits, see theFor more information about managing resources for containers, see Manage Resources in the Kubernetes documentation. Example:

...
resources:
   mysql:
     requests:
       cpu: 750m
       memory: 500Mi
...

resources.mysqlSidecar: <limits.cpu, limits.memory>
Optional
Default: Best effort
The minimum CPU and memory allowed for the MySQL Sidecar container. This sidecar container manages backups and highAvailability cluster operations. If not specified, Kubernetes does its best effort to allocate necessary compute resources for this container. For more information about managing resources for containers, see Manage Resources in the Kubernetes documentation.
Example:

...
resources:
   mysqlSidecar:
    limits:
       cpu: 250m
       memory: 75Mi
...

resources.mysqlSidecar: <requests.cpu, requests.memory>
Optional
Default: Best effort
The minimum CPU and memory allowed for the MySQL Sidecar container. This sidecar container manages backups and highAvailability cluster operations. If not specified, defaults to limits, if limits have been explicitly specified. For more information about limits, see theFor more information about managing resources for containers, see Manage Resources in the Kubernetes documentation.
Example:

...
resources:
   mysqlSidecar:
     requests:
       cpu: 100m
       memory: 50Mi
...

resources.metrics: <limits.cpu, limits.memory>
Optional
Default: Best effort
The minimum CPU and memory allowed for the MySQL metrics container. This container is created during MySQL instance initialization. If not specified, Kubernetes does its best effort to allocate necessary compute resources for this container. For more information about managing resources for containers, see Manage Resources in the Kubernetes documentation.
Example:

...
resources:
   metrics:
    limits:
       cpu: 250m
       memory: 75Mi
...

resources.metrics: <requests.cpu, requests.memory>
Optional
Default: Best effort
The minimum CPU and memory allowed for the MySQL metrics container. This container is created during MySQL instance initialization. If not specified, defaults to limits, if limits have been explicitly specified. For more information about limits, see Manage Resources in the Kubernetes documentation.
Example:

...
resources:
   metrics:
     requests:
       cpu: 100m
       memory: 32Mi
...

resources.proxy: <limits.cpu, limits.memory>
Optional
Default: Best effort
The minimum CPU and memory allowed for the MySQL proxy container that handles connections to MySQL when highAvailability.enabled is true. If not specified, Kubernetes does its best effort to allocate necessary compute resources for this container. For more information about managing resources for containers, see Manage Resources in the Kubernetes documentation.
Example:

...
resources:
   proxy:
    limits:
       cpu: 200m
       memory: 48Mi
...

resources.proxy: <requests.cpu, requests.memory>
Optional
Default: Best effort
The minimum CPU and memory allowed for the MySQL proxy container that handles connections to MySQL when highAvailability.enabled is true. If not specified, defaults to limits, if limits have been explicitly specified. For more information see Manage Resources in the Kubernetes documentation.
Example:

...
resources:
   proxy:
     requests:
       cpu: '1.0''
       memory: 256Mi
...

persistentVolumeClaimPolicy: <string>
Optional
Default: Retain
Describes the PVC retention policy when the associated MySQL instance is deleted. Values can be Retain or Delete.
Example: Delete