Configuration Management

ConfigMap

General

A configmap stores configuration data as key-value pairs and can be mounted into a workload as a configuration file. A configmap decouples environment configuration from the container image, which makes it easier to modify application configuration.

Creating a ConfigMap

In the ZStack Zaku main menu, select Container Orchestration > Configuration Management > ConfigMap. On the ConfigMap page, click Create ConfigMap and the Create ConfigMap page is displayed.

You can refer to the following example to enter the required information:
  • Name: set the name of the configmap. Naming rules: the length is limited to 2-50 characters, the input can contain only lowercase letters, digits and hyphens (-), and a hyphen cannot be used at the beginning or the end of the name.
  • Data: add configuration data in the form of key/value pairs. Multiple key/value pairs can be added.
    • Key: enter the key. The input must be 1-253 characters in length and can contain only letters, digits and the following special characters: (-)(.)(_). Duplicate keys are not allowed.
    • Value: enter the value, that is, the configuration content, which can be multi-line text.

Managing ConfigMaps

In the ZStack Zaku main menu, select Container Orchestration > Configuration Management > ConfigMap to enter the ConfigMap page.

ConfigMaps support the following operations:
Operation Description
Create configmap Create a new configmap.
Modify configmap Modify the configmap data.
Note: The name of a configmap cannot be modified.
Update Yaml Update the configmap using Yaml.
Delete configmap Delete the configmap from the cluster.
Note: If the configmap has been mounted to pods, restarting these pods fails after the deletion, so proceed with caution.

Secret

General

A secret stores sensitive configuration in a Kubernetes cluster, such as passwords and certificates, and can be used in a workload as a file or an environment variable. Because secrets can exist independently of the pods that use them, there is less risk of exposing secrets and their data while pods are created, viewed and edited.

Creating a Secret

In the ZStack Zaku main menu, select Container Orchestration > Configuration Management > Secret. On the Secret page, click Create Secret and the Create Secret page is displayed.

Creating a secret involves the following three scenarios:
  • Creating a secret of the Opaque type
  • Creating a secret of the TLS certificate type
  • Creating a secret of the registry login secret type

Creating a Secret of the Opaque Type

You can refer to the following example to enter the required information:
  • Name: set the name of the secret. Naming rules: the length is limited to 2-50 characters, the input can contain only lowercase letters, digits and hyphens (-), and a hyphen cannot be used at the beginning or the end of the name.
  • Type: select Opaque. Secrets of the Opaque type are often used to store sensitive configurations, such as account passwords.
  • Data: add configuration data in the form of key/value pairs. When the secret is created, the values in the data are base64-encoded before being saved.
    • Key: enter the key. The input must be 1-253 characters in length and can contain only letters, digits and the following special characters: (-)(.)(_). Duplicate keys are not allowed.
    • Value: enter the value, that is, the configuration content, which can be multi-line text.

Creating a Secret of the TLS Certificate Type

You can refer to the following example to enter the required information:
  • Name: set the name of the secret. Naming rules: the length is limited to 2-50 characters, the input can contain only lowercase letters, digits and hyphens (-), and a hyphen cannot be used at the beginning or the end of the name.
  • Type: select TLS certificate. Secrets of the TLS certificate type are mainly used to store TLS certificates.
  • Data: add configuration data in the form of a certificate and a private key. When the secret is created, the values in the data are base64-encoded before being saved.
    • Certificate: enter the TLS certificate file.
    • Private key: enter the TLS private key file.

Creating a Secret of the Registry Login Secret Type

You can refer to the following example to enter the required information:
  • Name: set the name of the secret. Naming rules: the length is limited to 2-50 characters, the input can contain only lowercase letters, digits and hyphens (-), and a hyphen cannot be used at the beginning or the end of the name.
  • Type: select registry login secret. Secrets of the registry login secret type are mainly used to store the authentication information required to log in to an image repository or to pull images from a private repository.
  • Data: add configuration data.
    • Repository address: enter the address of the image repository.
    • Username: enter the username used to log in to the image repository.
    • Password: enter the password of the username used to log in to the image repository.

Managing Secrets

In the ZStack Zaku main menu, select Container Orchestration > Configuration Management > Secret to enter the Secret page.

Secrets support the following operations:

Operation Description
Create secret Create a new secret.
Modify secret Modify the secret data.
Note:
  • The name of a secret cannot be modified.
  • Currently only secrets of the Opaque, TLS certificate and registry login secret types can be modified.
Update Yaml Update the secret using Yaml. Secrets of all types support updates.
Delete secret Delete the secret from the cluster.
Note: If the secret has been mounted to pods, restarting these pods fails after the deletion, so proceed with caution.