Updated on 2024-12-18 GMT+08:00

Creating a Configuration Set

Context

Podinfo is a tiny web application that showcases best practices of running microservices in Kubernetes. It is used for testing and workshops. This chapter uses the podinfo source code as an example to describe how to create a configuration set.

To deliver software more quickly and stably and reduce subsequent maintenance workload, the podinfo source code is stored in the GitHub repository and deployed in the cluster by creating a configuration set. GitOps is used for automated software deployment. For details, see Procedure.

  • When creating a podinfo source code repository, register a GitHub account and fork all podinfo code to your GitHub repository.
  • When defining the delivery resource list file in the GitHub repository, ensure that the file does not contain sensitive information (such as the database connection key). Sensitive information must be stored in environment variables or encrypted secrets.
Figure 1 Podinfo page

Procedure

  1. Log in to Huawei Cloud Console.
  2. Choose Ubiquitous Cloud Native Service from Service List. In the navigation pane, choose Configuration Management.
  3. Click Add Cluster in the upper right corner, select the cluster for which you want to enable configuration management, and click OK.
  4. In the Clusters with GitOps Enabled area, click the cluster name. Then, click the GitOps tab and check whether the GitOps plug-in (name: {Cluster name}-FluxPlugin) has been deployed. If the plug-in deployment status is Running, the plug-in has been deployed.

    Figure 2 Cluster overview

  5. Click the Configuration Sets tab and click Create Configuration Set.

  6. Select a repository source. If a repository source already exists, use the existing repository source. If you need to create a repository source, create one.

Using the Existing Repository Source

  1. Enter the configuration set name, select the target namespace, select Use an existing one, and select an existing repository. Enter the configuration set path (top-level path of the configuration set to be synchronized in the repository source) under Automatic Synchronization Policy. Then click Next: Confirm.

  2. After confirming that the configuration information is correct, click Create Configuration Set. If the configuration information is incorrect, click Previous to modify it.

Creating a Repository Source

  1. Click Create one and enter the repository source name and URL.
  2. Enter the code library branch that needs to be synchronized.
  3. Select a mode for Data Source Authentication and enter the secret.

    • Public repositories provide read-only permissions with no need for identity authentication.
    • If you select a private repository, you can select Selecting a cluster secret or Providing authentication information (SSH) for Data Source Authentication. Both modes require that the configured secret pass the identity authentication.
    • For details about how to create a repository key, see Keys.
    • If 404 is reported when you create a repository source after configuration management is enabled for a discrete cluster, you can try again after the network does not fluctuate.

  4. After the repository source is created, enter the configuration set path under Automatic Synchronization Policy and click Next: Confirm.
  5. After confirming that the configuration information is correct, click Create Configuration Set. If the configuration information is incorrect, click Previous to modify it.

Viewing Configuration Set Information

  1. Click the cluster name to go to the configuration management page. Click the configuration set name to view the configuration set information.

  2. Click the K8s Resources tab to view the resources of the configuration set. Click View Details in the Operation column to view the details.