Back to Charts

⚠️ Repo Archive Notice

stable/percona-xtradb-cluster/README.md

latest13.6 KB
Original Source

⚠️ Repo Archive Notice

As of Nov 13, 2020, charts in this repo will no longer be updated. For more information, see the Helm Charts Deprecation and Archive Notice, and Update.

Percona XtraDB Cluster

Percona Server for MySQL® is a free, fully compatible, enhanced, open source drop-in replacement for MySQL that provides superior performance, scalability and instrumentation. With over 3,000,000 downloads, Percona Server for MySQL's self-tuning algorithms and support for extremely high-performance hardware delivers excellent performance and reliability.

Notable users include Netflix, Amazon Web Services, Alcatel-Lucent, and Smug Mug.

DEPRECATION NOTICE

This chart is deprecated and no longer supported.

Introduction

This chart, based off of the Percona chart (which in turn is based off the MySQL chart), bootstraps a multi-node Percona XtraDB Cluster deployment on a Kubernetes cluster using the Helm package manager.

The chart exploits the deterministic nature of StatefulSet and KubeDNS to ensure the cluster bootstrap is performed in the correct order.

Prerequisites

  • Kubernetes 1.8+ with Beta APIs enabled
  • PV provisioner support in the underlying infrastructure

Installing the Chart

To install the chart with the release name my-release:

bash
$ helm install --name my-release stable/percona-xtradb-cluster

The command deploys a Percona XtraDB Cluster on the Kubernetes cluster in the default configuration. The configuration section lists the parameters that can be configured during installation.

The root password can only be used inside each pod. You should set a default mysqlDatabase, mysqlUser and mysqlPassword in the values.yaml file.

By default an insecure password will be generated for the root and replication users. If you'd like to set your own password change the mysqlRootPassword or xtraBackupPassword respectively in the values.yaml.

You can retrieve your root password (usable only via localhost in each pod) by running the following command. Make sure to replace [YOUR_RELEASE_NAME]:

printf $(printf '\%o' `kubectl get secret [YOUR_RELEASE_NAME]-percona -o jsonpath="{.data.mysql-root-password[*]}"`)

Tip: List all releases using helm list

Uninstalling the Chart

To uninstall/delete the my-release deployment:

bash
$ helm delete my-release

The command removes all the Kubernetes components associated with the chart and deletes the release.

Configuration

The following table lists the configurable parameters of the Percona chart and their default values.

ParameterDescriptionDefault
image.repositorypercona-xtradb-cluster image Repo.5.7.19 release
image.tagpercona-xtradb-cluster image tag.percona/percona-xtradb-cluster
image.pullPolicyImage pull policyIfNotPresent
replicasNumber of pods to join the Percona XtraDB Cluster3
allowRootFromRemote hosts to allow root access, set to 127.0.0.1 to disable remote root%
mysqlRootPasswordPassword for the root user.not-a-secure-password
xtraBackupPasswordPassword for the xtrabackup user.replicate-my-data
pxc_strict_modeSetting for pxc_strict_mode.ENFORCING
mysqlUserUsername of new user to create.nil
mysqlPasswordPassword for the new user.nil
mysqlDatabaseName for new database to create.nil
serviceAccountNameName for the pod's serviceAccountnil
securityContext.runAsUserRun the pod with this uidnil
securityContext.runAsGroupRun the pod with this gidnil
securityContext.fsGroupSet GID for mounted volumesnil
persistence.enabledCreate a volume to store datafalse
persistence.sizeSize of persistent volume claim8Gi RW
persistence.storageClassType of persistent volume claimnil (uses alpha storage class annotation)
persistence.accessModeReadWriteOnce or ReadOnlyReadWriteOnce
tolerationsNode labels for pod assignment[]
nodeSelectorNode labels for pod assignment{}
podAnnotationsPod annotations{}
resourcesCPU/Memory resource requests/limitsMemory: 256Mi, CPU: 100m
configFilesfiles to write to /etc/mysql/conf.dsee values.yaml
ssl.enabledSetup and use SSL for MySQL connectionsfalse
ssl.secretName of the secret containing the SSL certificatesmysql-ssl-certs
ssl.certificates[0].nameName of the secret containing the SSL certificatesnil
ssl.certificates[0].caCA certificatenil
ssl.certificates[0].certServer certificate (public key)nil
ssl.certificates[0].keyServer key (private key)nil
logTailif set to true runs a container to tail /var/log/mysqld.log in the podtrue
metricsExporter.enabledif set to true runs a mysql metrics exporter container in the podfalse
metricsExporter.commandOverridesOverrides default docker command for metrics exporter[]
metricsExporter.argsOverridesOverrides default docker args for metrics exporter[]
metricsExporter.tagSpecify a docker image tag for prom/mysqld-exporter metrics exporter docker imagenil
prometheus.operator.enabledSetting to true will create Prometheus-Operator specific resourcesfalse
prometheus.operator.prometheusRule.enabledCreate default alerting rulestrue
prometheus.operator.prometheusRule.labelsLabels to add to alerts{}
prometheus.operator.prometheusRule.namespaceNamespace which Prometheus is installed innil
prometheus.operator.prometheusRule.selectorLabel Selector for Prometheus to find ServiceMonitorsnil
prometheus.operator.serviceMonitor.intervalInterval at which Prometheus will scrape metrics exporter10s
prometheus.operator.serviceMonitor.namespaceNamespace which Prometheus is installed innil
prometheus.operator.serviceMonitor.selectorLabel Selector for Prometheus to find ServiceMonitorsnil
podDisruptionBudgetPod disruption budget{enabled: false, maxUnavailable: 1}
service.percona.headlessif set to true makes the percona service headlessfalse
initResourcesCPU/Memory resource requests/limits for init containersMemory: 128Mi, CPU: 100m

Some of the parameters above map to the env variables defined in the Percona XtraDB Cluster DockerHub image.

Specify each parameter using the --set key=value[,key=value] argument to helm install. For example,

bash
$ helm install --name my-release \
  --set mysqlRootPassword=secretpassword,mysqlUser=my-user,mysqlPassword=my-password,mysqlDatabase=my-database \
    stable/percona-xtradb-cluster

The above command sets the MySQL root account password to secretpassword. Additionally it creates a standard database user named my-user, with the password my-password, who has access to a database named my-database.

Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,

bash
$ helm install --name my-release -f values.yaml stable/percona-xtradb-cluster

Tip: You can use the default values.yaml

Persistence

The Percona XtraDB Cluster DockerHub image stores the MySQL data and configurations at the /var/lib/mysql path of the container.

By default, an emptyDir volume is mounted at that location.

"An emptyDir volume is first created when a Pod is assigned to a Node, and exists as long as that Pod is running on that node. When a Pod is removed from a node for any reason, the data in the emptyDir is deleted forever."

You can change the values.yaml to enable persistence and use a PersistentVolumeClaim instead.

SSL

This chart supports configuring MySQL to use encrypted connections with TLS/SSL certificates provided by the user. This is accomplished by storing the required Certificate Authority file, the server public key certificate, and the server private key as a Kubernetes secret. The SSL options for this chart support the following use cases:

  • Manage certificate secrets with helm
  • Manage certificate secrets outside of helm

Manage certificate secrets with helm

Include your certificate data in the ssl.certificates section. For example:

ssl:
  enabled: false
  secret: mysql-ssl-certs
  certificates:
  - name: mysql-ssl-certs
    ca: |-
      -----BEGIN CERTIFICATE-----
      ...
      -----END CERTIFICATE-----
    cert: |-
      -----BEGIN CERTIFICATE-----
      ...
      -----END CERTIFICATE-----
    key: |-
      -----BEGIN RSA PRIVATE KEY-----
      ...
      -----END RSA PRIVATE KEY-----

Note: Make sure your certificate data has the correct formatting in the values file.

Manage certificate secrets outside of helm

  1. Ensure the certificate secret exist before installation of this chart.
  2. Set the name of the certificate secret in ssl.secret.
  3. Make sure there are no entries underneath ssl.certificates.

To manually create the certificate secret from local files you can execute:

kubectl create secret generic mysql-ssl-certs \
  --from-file=ca.pem=./ssl/certificate-authority.pem \
  --from-file=server-cert.pem=./ssl/server-public-key.pem \
  --from-file=server-key.pem=./ssl/server-private-key.pem

Note: ca.pem, server-cert.pem, and server-key.pem must be used as the key names in this generic secret.

If you are using a certificate your configurationFiles must include the three ssl lines under [mysqld]

[mysqld]
    ssl-ca=/ssl/ca.pem
    ssl-cert=/ssl/server-cert.pem
    ssl-key=/ssl/server-key.pem

PXC Strict Mode

PXC Strict Mode is designed to avoid the use of experimental and unsupported features in Percona XtraDB Cluster. It performs a number of validations at startup and during runtime.

Depending on the actual mode you select, upon encountering a failed validation, the server will either throw an error (halting startup or denying the operation), or log a warning and continue running as normal. The following modes are available:

  • DISABLED: Do not perform strict mode validations and run as normal.
  • PERMISSIVE: If a vaidation fails, log a warning and continue running as normal.
  • ENFORCING: If a validation fails during startup, halt the server and throw an error. If a validation fails during runtime, deny the operation and throw an error.
  • MASTER: The same as ENFORCING except that the validation of explicit table locking is not performed. This mode can be used with clusters in which write operations are isolated to a single node.

By default, PXC Strict Mode is set to ENFORCING, except if the node is acting as a standalone server or the node is bootstrapping, then PXC Strict Mode defaults to DISABLED.

Source: https://www.percona.com/doc/percona-xtradb-cluster/LATEST/features/pxc-strict-mode.html