github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/docs/developer_docs/integration/environment-variables-and-placeholders.md (about) 1 --- 2 title: Environment variables and placeholders 3 description: KubeBlocks Environment Variables and Placeholders 4 keywords: [environment variables, placeholders] 5 sidebar_position: 10 6 sidebar_label: Environment variables and placeholders 7 --- 8 9 # Environment variables and placeholders 10 11 ## Environment variables 12 13 ### Automatic pod's container environment variables 14 15 The following variables are injected by KubeBlocks into each pod. 16 17 | Name | Description | 18 | :--- | :---------- | 19 | KB_POD_NAME | K8s Pod Name | 20 | KB_NAMESPACE | K8s Pod Namespace | 21 | KB_SA_NAME | KubeBlocks Service Account Name | 22 | KB_NODENAME | K8s Node Name | 23 | KB_HOSTIP | K8s Host IP address | 24 | KB_PODIP | K8s Pod IP address | 25 | KB_PODIPS | K8s Pod IP addresses | 26 | KB_POD_UID | POD UID (`pod.metadata.uid`) | 27 | KB_CLUSTER_NAME | KubeBlocks Cluster API object name | 28 | KB_COMP_NAME | Running pod's KubeBlocks Cluster API object's `.spec.components.name` | 29 | KB_CLUSTER_COMP_NAME | Running pod's KubeBlocks Cluster API object's `<.metadata.name>-<.spec.components.name>` | 30 | KB_REPLICA_COUNT | Running pod's component's replica | 31 | KB_CLUSTER_UID | Running pods' KubeBlocks Cluster API object's `metadata.uid` | 32 | KB_CLUSTER_UID_POSTFIX_8 | Last eight digits of KB_CLUSTER_UID | 33 | KB_{ordinal}_HOSTNAME | Running pod's hostname, where `{ordinal}` is the ordinal of pod. <br /> N/A if workloadType=Stateless. | 34 | KB_POD_FQDN | Running pod's fully qualified domain name (FQDN). <br /> N/A if workloadType=Stateless. | 35 36 ## Built-in Place-holders 37 38 ### ComponentValueFrom API 39 40 | Name | Description | 41 | :--- | :---------- | 42 | POD_ORDINAL | Pod ordinal | 43 | POD_FQDN | Pod FQDN (fully qualified domain name) | 44 | POD_NAME | Pod Name | 45 46 ### ConnectionCredential API 47 48 | Name | Description | 49 | :--- | :---------- | 50 | UUID | Generate a random UUID v4 string. | 51 | UUID_B64 | Generate a random UUID v4 BASE64 encoded string. | 52 | UUID_STR_B64 | Generate a random UUID v4 string then BASE64 encoded. | 53 | UUID_HEX | Generate a random UUID v4 HEX representation. | 54 | HEADLESS_SVC_FQDN | Headless 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; | 55 | SVC_FQDN | Service 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; | 56 | SVC_PORT_{PORT_NAME} | A ServicePort's port value with specified port name, i.e, a servicePort JSON struct: <br /> `{"name": "mysql", "targetPort": "mysqlContainerPort", "port": 3306}`, and "$(SVC_PORT_mysql)" in the connection credential value is 3306. | 57 | RANDOM_PASSWD | Random 8 characters |