KubeBlocks
BlogsKubeBlocks Cloud
⌘K
​

Overview

Introduction
Concepts
Kubernetes and Operator 101
Supported addons
About this manual

Try out KubeBlocks with Playground

Try out KubeBlocks on cloud
Try out KubeBlocks on laptop

Installation

Prerequisite for Local Env

Prerequisite for Local Env
Install kbcli
Install KubeBlocks
Install Addons
Uninstall KubeBlocks and kbcli

Upgrade KubeBlocks

Upgrade to v0.8
Upgrade to v0.9.0
Upgrade to v0.9.3
FAQ

Connect Database

Overview
Testing environment
Production environment

Maintenance

Scale

Horizontal Scale
Vertical Scale

Backup and Restore

Introduction

Backup

Configure BackupRepo
Configure BackupPolicy
Scheduled backup
On-demand backup

Restore

Restore from backup set
PITR

In Place Update

Overview on in-place update
Enable in-place update

Resource Scheduling

Configure pod affinity for database clusters

Cross K8s Deployment

Deploy a Cluster across Multiple Kubernetes Clusters by KubeBlocks

Instance Template

Introduction of instance template
Apply instance template

Observability

Monitor database
Configure alert

User Management

Manage user accounts

Handle an Exception

Handle an exception
Full disk lock

Developer

Developer guides
Terminology

Add an add-on to KubeBlocks

Add-ons of KubeBlocks
Add an add-on
Backup and restore
Parameter template
Parameter configuration
Monitoring
Multi-component configuration
Environment variables and placeholders

External Component

Reference external component

API Reference

Cluster
Backup
Add-On
  1. Mechanism of lock/unlock
  2. Enable full disk lock
  3. Disable full disk lock

Full disk lock

The full disk lock function of KubeBlocks ensures the stability and availability of a database. This function triggers a disk lock when the disk usage reaches a set threshold, thereby pausing write operations and only allowing read operations. Such a mechanism prevents a database from being affected by disk space exhaustion.

Mechanism of lock/unlock

When the space water level of any configured volume exceeds the defined threshold, the instance is locked (read-only). Meanwhile, the system sends a related warning event, including the specific threshold and space usage information of each volume.

When the space water level of all configured volumes falls below the defined threshold, the instance is unlocked (read and write). Meanwhile, the system sends a related warning event, including the specific threshold and space usage information of each volume.

NOTE
  1. The full disk lock function currently supports global (ClusterDefinition) enabling or disabling and does not support Cluster dimension control. Dynamically enabling or disabling this function may affect the existing Cluster instances that use this ClusterDefinition and cause them to restart. Please operate with caution.

  2. The full disk locking function relies on the read permission (get & list) of the two system resource nodes and nodes/stats. If you create an instance via kbcli, make sure to grant the controller administrative rights to the ClusterRoleBinding.

  3. Currently, full disk lock is available for ApeCloud MySQL, PostgreSQL and MongoDB.

Enable full disk lock

  • For MySQL, the read/write user cannot write to the disk when the disk usage reaches the highwatermark value, while the superuser can still write.
  • For PostgreSQL and MongoDB, both the read/write user and the superuser cannot write when the disk usage reaches highwatermark.
  • 90 is the default value setting for the high watermark at the component level which means the disk is locked when the disk usage reaches 90%, while 85 is used for the volumes which overwrites the component's threshold value.

Steps:

  1. Edit the ClusterDefinition Custom Resource (CR) of a database.

    This guide takes mysql as an example. You can replace mysql with postgresql or mongodb.

    kubectl edit clusterdefinition mysql
    
  2. Add the volumeProtectionSpec field under spec.componentDefs[] to enable the full disk lock function. You can set the values of highWatermark as needed.

    ...
    spec:
      componentDefs:
      ...
      - name: mysql
        volumeProtectionSpec:
          highWatermark: 90
          volumes:
          - highWatermark: 85
            name: data
      ...
    
    NOTE

    The recommended value of highWatermark is 90.

  3. Save the changes and exit.

Disable full disk lock

To disable the full disk lock function, just delete the volumeProtectionSpec field from the ClusterDefinition CR.

Steps:

  1. Edit the ClusterDefinition CR of a database.

    This guide takes mysql as an example. You can replace mysql with postgresql or mongodb.

    kubectl edit clusterdefinition mysql
    
  2. Delete the volumeProtectionSpec field.

  3. Save the changes and exit.

© 2025 ApeCloud PTE. Ltd.