Version: v26.03

Installation and Deployment Pre-environment Check Tool Guide ​

Background ​

Users have found that during the use of installation and deployment tools, due to possible residual configuration files from other software in the environment, as well as some applications that conflict with specifications, installation and deployment processes may be abnormal or fail. To ensure successful installation and deployment, a pre-environment check tool needs to be built to ensure the environment is available before installation and deployment. The tool currently implements the following functions:

  • Given a file path list, query whether files remain in the current environment and output a check report.
  • Given a file path list, support safe deletion (asking user for deletion confirmation) and forced deletion (delete directly without asking), and output a check report.
  • Check whether specified programs are installed in the environment and output a check report.
  • Support time synchronization verification between multiple machines, detecting whether clocks between other nodes and the bootstrap node are synchronized.

Prerequisites ​

This tool currently only supports execution in Linux amd64 and Linux arm64 environments, please download the corresponding version of the tool according to your environment.

Download Itemamd64arm64
envCheck toolDownloadDownload
Default configuration fileDownloadDownload

Configuration files can be created manually or downloaded and modified as default configuration files.

Restrictions ​

None.

Guide ​

Note:

  • After download, the tool is named envCheck and is a binary executable file.
  • You can use different functions of the tool by modifying the configuration file and executing different commands. The corresponding configuration file and tool are in the same folder and named config.json (the configuration file location can be placed elsewhere, but when placed in other locations, the command line parameter --config needs to be explicitly specified). Here it defaults to the same folder with the content shown in the examples below.

Complete Configuration File Example ​

json
// config.json
{
  "log_file": "./envCheck.log",
  "output_format": "text",
  "paths": [
    "$HOME/.kube",
    "/etc/kubernetes",
    "/usr/bin/kube*",
    "/usr/local/bin/kube*",
    "/usr/local/bin/crictl",
    "/etc/sysctl.d/k8s.conf",
    "/etc/systemd/system/kubelet.service",
    "/etc/systemd/system/kubelet.service.d",
    "/var/lib/openFuyao/etcd",
    "/var/lib/kubelet",
    "/run/containerd/containerd.sock",
    "/usr/lib/systemd/system/kubelet.service.d",
    "/var/run/containerd/containerd.sock",
    "/var/run/docker.sock"
  ],
  "clean_force": false,
  "program_list": [
    "docker",
    "kubectl",
    "containerd"
  ],
  "hosts": [
    {
      "ip": "192.168.1.1",
      "username": "root",
      "password": "******",
      "port": "22",
      "role": ["bootstrap"]
    },
    {
      "ip": "192.168.1.2",
      "username": "root",
      "password": "******",
      "port": "22",
      "role": ["master"]
    }
  ],
  "clock_threshold": 10
}

Notice:

Regarding configuration files, the tool will perform the following validations:

  • When using file query or cleanup functions, paths cannot be empty.
  • When using conflicting application detection function, program_list cannot be empty.
  • When using clock synchronization detection function, hosts cannot be empty.

Configuration file field descriptions:

Field NameDescription
log_filePath to store log files (including filename)
output_formatTool execution result report output format, currently supports text, json
pathsFile path list that needs to be specified for file query and cleanup
clean_forceWhether to execute forced deletion (no user confirmation needed)
program_listList of application names to check for installation
hostsList of machines that need clock synchronization detection
ipIP address used for ssh connection
usernameUsername used for ssh connection
passwordPassword used for ssh connection
portPort used for ssh connection
roleMachine role (bootstrap indicates bootstrap node)
clock_thresholdMachine clock error allowable threshold (unit: seconds)

Note:

When the tool runs, it will output running results to the terminal by default and generate a corresponding html file in the current folder, and the running process will record logs in the envCheck.log file in the current folder. Users can set this by modifying corresponding fields in the configuration file. The following sections default to output_format being text in the configuration file.

Users can execute the following command to get tool help documentation.

bash
envCheck -h

File Query Function ​

  • Execute the following command for default query.

    bash
    envCheck query

    The tool will query whether files exist in the paths specified by paths in config.json in the current folder. After the tool finishes running, query results will be output to the terminal and a query.html file will be generated in the current folder.

  • Execute the following command to specify configuration file path during query.

    bash
    envCheck query --config=./queryConfig.json

    The tool will query whether files exist in the paths specified by paths in queryConfig.json in the current folder. After the tool finishes running, query results will be output to the terminal and a query.html file will be generated in the current folder.

File Cleanup Function ​

Note:

Before executing the file cleanup function, you need to confirm the clean_force field value in the configuration file, which defaults to false. false means you will be asked for confirmation before deleting files, true means no confirmation will be requested. If you add the --force execution command, it means regardless of the clean_force field value, the tool will directly delete corresponding files.

  • Execute the following command for default cleanup (user will be asked before deleting each file).

    bash
    envCheck clean

    The tool will ask whether to delete files in the paths specified by paths in config.json in the current folder. After the tool finishes running, cleanup results will be output to the terminal and a clean.html file will be generated in the current folder.

  • Execute the following command for forced deletion, files will be deleted directly without asking the user.

    bash
    envCheck clean --force

    The tool will directly delete files in the paths specified by paths in config.json in the current folder. After the tool finishes running, cleanup results will be output to the terminal and a clean.html file will be generated in the current folder.

  • Execute the following command to specify configuration file path during deletion.

    bash
    envCheck clean --config=./cleanConfig.json

    The tool will execute file cleanup function according to settings in the cleanConfig.json file. After the tool finishes running, cleanup results will be output to the terminal and a clean.html file will be generated in the current folder.

Program Existence Detection ​

  • Execute the following command for default application query.

    bash
    envCheck check

    The tool will query whether applications specified by program_list in config.json in the current folder are installed. After the tool finishes running, query results will be output to the terminal and a check.html file will be generated in the current folder.

  • Execute the following command to specify configuration file path during query.

    bash
    envCheck check --config=./checkConfig.json

    The tool will query whether applications specified by program_list in checkConfig.json in the current folder are installed. After the tool finishes running, query results will be output to the terminal and a check.html file will be generated in the current folder.

Clock Synchronization Detection Function ​

Prerequisites

Using the clock synchronization detection function requires users to first modify related host information in the default configuration file.

Getting Started

  • Execute the following command to query clock error between other hosts and the bootstrap node host.

    bash
    envCheck clock

    The tool will judge based on hosts and clock_threshold in config.json in the current folder whether clock error between non-bootstrap nodes and bootstrap node (bootstrap) does not exceed the specified threshold. After the tool finishes running, detection results will be output to the terminal and a clock.html file will be generated in the current folder.

  • Execute the following command to specify configuration file during query.

    bash
    envCheck clock --config=./clockConfig.json

    The tool will judge based on hosts and clock_threshold in clockConfig.json in the current folder whether clock error between non-bootstrap nodes and bootstrap node (bootstrap) does not exceed the specified threshold. After the tool finishes running, detection results will be output to the terminal and a clock.html file will be generated in the current folder.