(Optional) Importing a Certificate and KubeConfig File

Instructions

The import tool cert-importer exists in the software package of the component.

Import Tool Description

Importing the KubeConfig File

  1. Log in to the Kubernetes management node.
  2. Create the /etc/kubernetes/mindxdl folder and set the permission to 750.

    rm -rf /etc/kubernetes/mindxdl
    mkdir /etc/kubernetes/mindxdl
    chmod 750 /etc/kubernetes/mindxdl

  3. Create the KubeConfig file resilience-controller-cfg.conf by referring to Kubernetes guidance. The user field in the KubeConfig file is resilience-controller. Place the KubeConfig file to the /etc/kubernetes/mindxdl/ directory.
  4. Go to the decompression path of the Resilience Controller installation package and add the lib folder to the environment variable LD_LIBRARY_PATH in the current window, which does not need to be persisted or inherited to other users. (Configure the path of the .so file related to the encryption component for the certificate import tool.)

    1. Run the following command to back up the environment variable:
      export LD_LIBRARY_PATH_BAK=${LD_LIBRARY_PATH}
    2. Run the following command to set the lib folder to the environment variable LD_LIBRARY_PATH:
      export LD_LIBRARY_PATH=`pwd`/lib/:${LD_LIBRARY_PATH}

  5. Import the KubeConfig file (Resilience Controller used as an example).

    ./cert-importer -kubeConfig=/etc/kubernetes/mindxdl/resilience-controller-cfg.conf  -cpt=rc

    If the following information is displayed, the import is successful.

    encrypt kubeConfig successfully
    start to write data to disk
    [OP]import kubeConfig successfully
    change owner and set file mode successfully
    • If the KubeConfig file has been imported but the component still displays an error message indicating an abnormal Kubernetes connection, rectify the fault by referring to Cluster Scheduling Components Fail to Connect Kubernetes.
    • When the certificate is imported, cert-importer automatically creates the /var/log/mindx-dl/cert-importer directory with permissions set to 750 and ownership assigned to root:root.

  6. Run the following command to restore the backup environment variable:

    export LD_LIBRARY_PATH=${LD_LIBRARY_PATH_BAK}

Table 3 Certificate configuration files of cluster scheduling components

Component

Configuration File Directory

Directory and File Owner

Configuration File Description

Root directory related to the cluster scheduling component certificate

/etc/mindx-dl/

hwMindX:hwMindX

kmc_primary_store/master.ks: automatically generated master key. Do not delete it.

.config/backup.ks: automatically generated backup key. Do not delete it.

Resilience Controller

/etc/mindx-dl/resilience-controller/

.config/config6: imported and encrypted Kubernetes KubeConfig file, which is used for connecting to Kubernetes.

.config6: imported backup of the encrypted Kubernetes KubeConfig file.

Table 4 Parameters of the import tool

Parameter

Type

Default Value

Description

-kubeConfig

String

None

Path of the KubeConfig file to be imported.

-cpt

String

rc

Name of the component whose certificate is imported. rc indicates Resilience Controller.

-encryptAlgorithm

Integer

9

Encryption algorithm for private key passwords:

  • 8: AES128GCM
  • 9: AES256GCM
NOTE:

Invalid values are reset to the default value.

-version

Bool

false

Resilience Controller version query.

-n

Bool

false

Whether to delete the KubeConfig file after it is imported.

  • true: not delete
  • false: delete

-logFile

String

/var/log/mindx-dl/cert-importer/cert-importer.log

Path for storing the tool run logs.

NOTE:

Dumped files are named in the format of "cert-importer-dump triggering time.log", for example, cert-importer-2023-10-07T03-38-24.402.log.

-updateMk

Bool

false

Whether to update the master key of the KMC encryption component.

  • true: update
  • false: not update

-updateRk

Bool

false

Whether to update the root key of the KMC encryption component.

  • true: update
  • false: not update

-h or --help

None

None

Help information.