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. Environment variables
    1. Pod container environment variables
  2. Built-in Place-holders
    1. ComponentValueFrom API
    2. ConnectionCredential API

Environment variables and placeholders

Environment variables

Pod container environment variables

The following variables are injected by KubeBlocks into each pod.

NameDescription
KB_POD_NAMEK8s Pod Name
KB_NAMESPACEK8s Pod Namespace
KB_SA_NAMEKubeBlocks Service Account Name
KB_NODENAMEK8s Node Name
KB_HOSTIPK8s Host IP address
KB_PODIPK8s Pod IP address
KB_PODIPSK8s Pod IP addresses
KB_POD_UIDPOD UID (pod.metadata.uid)
KB_CLUSTER_NAMEKubeBlocks Cluster API object name
KB_COMP_NAMERunning pod's KubeBlocks Cluster API object's .spec.components.name
KB_CLUSTER_COMP_NAMERunning pod's KubeBlocks Cluster API object's <.metadata.name>-<.spec.components.name>
KB_REPLICA_COUNTRunning pod's component's replica
KB_CLUSTER_UIDRunning pods' KubeBlocks Cluster API object's metadata.uid
KB_CLUSTER_UID_POSTFIX_8Last eight digits of KB_CLUSTER_UID
KB_{ordinal}_HOSTNAMERunning pod's hostname, where {ordinal} is the ordinal of pod.
N/A if workloadType=Stateless.
KB_POD_FQDNRunning pod's fully qualified domain name (FQDN).
N/A if workloadType=Stateless.

Built-in Place-holders

ComponentValueFrom API

NameDescription
POD_ORDINALPod ordinal
POD_FQDNPod FQDN (fully qualified domain name)
POD_NAMEPod Name

ConnectionCredential API

NameDescription
UUIDGenerate a random UUID v4 string.
UUID_B64Generate a random UUID v4 BASE64 encoded string.
UUID_STR_B64Generate a random UUID v4 string then BASE64 encoded.
UUID_HEXGenerate a random UUID v4 HEX representation.
HEADLESS_SVC_FQDNHeadless service FQDN placeholder, value pattern - $(CLUSTER_NAME)-$(1ST_COMP_NAME)-headless.$(NAMESPACE).svc, where 1ST_COMP_NAME is the 1st component that provide ClusterDefinition.spec.componentDefs[].service attribute.
SVC_FQDNService FQDN placeholder, value pattern - $(CLUSTER_NAME)-$(1ST_COMP_NAME).$(NAMESPACE).svc, where 1ST_COMP_NAME is the 1st component that provide ClusterDefinition.spec.componentDefs[].service attribute.
SVC_PORT_{PORT_NAME}A ServicePort's port value with specified port name, i.e, a servicePort JSON struct:
{"name": "mysql", "targetPort": "mysqlContainerPort", "port": 3306}, and "$(SVC_PORT_mysql)" in the connection credential value is 3306.
RANDOM_PASSWDRandom 8 characters

© 2025 ApeCloud PTE. Ltd.