Skip to content
logo
Percona Operator for MySQL
Horizontal and vertical scaling
Initializing search
    percona/k8sps-docs
    percona/k8sps-docs
    • Welcome
      • Design and architecture
      • Install with Helm
      • Install on Minikube
      • System Requirements
      • Install on Google Kubernetes Engine (GKE)
      • Install on Amazon Elastic Kubernetes Service (AWS EKS)
      • Generic Kubernetes installation
      • Backup and restore
      • Application and system users
      • Anti-affinity and tolerations
      • Labels and annotations
      • Changing MySQL Options
      • Exposing the cluster
      • Transport Encryption (TLS/SSL)
      • Telemetry
      • Horizontal and vertical scaling
        • Increase the Persistent Volume Claim size
      • Monitor with Percona Monitoring and Management (PMM)
      • Add sidecar containers
      • Monitor Kubernetes
      • Custom Resource options
      • Percona certified images
      • Copyright and licensing information
      • Trademark policy
      • Release notes index
      • Percona Operator for MySQL 0.5.0 (2023-03-30)
      • Percona Operator for MySQL 0.4.0 (2023-01-30)
      • Percona Operator for MySQL 0.3.0 (2022-09-29)
      • Percona Operator for MySQL 0.2.0 (2022-06-30)
      • Percona Distribution for MySQL Operator based on Percona Server for MySQL 0.1.0 (2022-01-25)

    • Increase the Persistent Volume Claim size

    Scale Percona Distribution for MySQL on Kubernetes¶

    One of the great advantages brought by Kubernetes platform is the ease of an application scaling. Scaling an application results in adding or removing the Pods and scheduling them to available Kubernetes nodes.

    Size of the cluster is controlled by a size key in the Custom Resource options configuration. That’s why scaling the cluster needs nothing more but changing this option and applying the updated configuration file. This may be done in a specifically saved config, or on the fly, using the following command:

    $ kubectl patch ps cluster1 --type='json' -p='[{"op": "replace", "path": "/spec/mysql/size", "value": 5 }]'
    

    In this example we have changed the size of the Percona Server for MySQL Cluster to 5 instances.

    Increase the Persistent Volume Claim size¶

    Kubernetes manages storage with a PersistentVolume (PV), a segment of storage supplied by the administrator, and a PersistentVolumeClaim (PVC), a request for storage from a user. In Kubernetes v1.11 the feature was added to allow a user to increase the size of an existing PVC object. The user cannot shrink the size of an existing PVC object. Certain volume types support, by default, expanding PVCs (details about PVCs and the supported volume types can be found in Kubernetes documentation)

    The following are the steps to increase the size:

    1. Extract and backup the yaml file for the cluster

      kubectl get ps cluster1 -o yaml --export > CR_backup.yaml
      
    2. Now you should delete the cluster.

      You can use the following command to delete the cluster:

      $ kubectl delete -f CR_backup.yaml
      
    3. For each node, edit the yaml to resize the PVC object.

      $ kubectl edit pvc datadir-cluster1-mysql-0
      

      In the yaml, edit the spec.resources.requests.storage value.

      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 6Gi
      

      Perform the same operation on the other nodes.

      $ kubectl edit pvc datadir-cluster1-mysql-1
      $ kubectl edit pvc datadir-cluster1-mysql-2
      
    4. In the CR configuration file, use vim or another text editor to edit the PVC size.

      $ vim CR_backup.yaml
      
    5. Apply the updated configuration to the cluster.

      $ kubectl apply -f CR_backup.yaml
      

    Contact Us

    For free technical help, visit the Percona Community Forum.

    To report bugs or submit feature requests, open a JIRA ticket.

    For paid support and managed or consulting services , contact Percona Sales.


    Last update: 2023-08-31
    Percona LLC and/or its affiliates, © 2009 - 2023
    Made with Material for MkDocs

    Cookie consent

    We use cookies to recognize your repeated visits and preferences, as well as to measure the effectiveness of our documentation and whether users find what they're searching for. With your consent, you're helping us to make our documentation better. Read more about Percona Cookie Policy.