All Documents
Current Document

Content is empty

If you don't find the content you expect, please try another search term

Documentation

Check images

Last updated:2021-08-04 11:26:31

You can use a custom image to create a KEC instance.

The custom image can be created based on an offline server, a VM, or a non-Kingsoft Cloud host. Images you import must meet image requirements. For more information, see Import images.

To shorten the period of creating images and instances, you are recommended to use an image check tool to create images that conform to standards. The check tool can check different configuration metrics based on the server environment, locate causes of non-compliance, generate .txt or .json check reports, and offer solutions.

Limits

Currently, the tool supports only Linux images, including images of Linux distributions such as the Ubuntu, CentOS, Debian, Red Hat, and Fedora.

Example

The following example shows how to use the tool to check the environment of a CentOS 6.8 64-bit server.

  1. Log in to the server, VM, or non-Kingsoft Cloud host.

  2. Download the image check tool.

  3. Run the image_check command with root privileges.

    chmod +x image_check
    sudo image_check

    You can also run the -p [Destination path] command to specify a path to store the check report. If no path is specified, the report is stored in the path where the tool is stored.

  4. Wait for the tool to check the system configuration.

    image_check 1.0.2
    Begin check your system......
    The inspection report is generating.
    The information you need to input when you import your image to Kingsoft 
    Cloud website:
    Current system: CentOS 6.8
    Architecture: x86_64
    System disk size: 21 GB
    
    Check driver                  [  OK  ]
    Check shadow file authority        [  OK  ]
    Check security                [WARNING]
    Check network                 [  OK  ]
    Check ssh                    [  OK  ]
    Check firewall                [  OK  ]
    Check filesystem               [  OK  ]
    Check device id                [  OK  ]
    Check root account              [  OK  ]
    Check password                [  OK  ]
    Check partition table            [  OK  ]
    Check lib                    [  OK  ]
    Check disk size                [FAILED]
    Check disk use rate             [  OK  ]
    Check inode use rate            [  OK  ]
    
    13 items are OK.
    1 items are failed.
    1 items are warning.
    
    The report is generated: /tmp/image_check_report_2018-07-13_22-46-53.txt
    Please read the report to check the details.
  5. View the check report. The report name is image_check_report_date_time.txt or image_check_report.json.

Check items

The tool checks the configuration of a server based on which you create a custom image to ensure the functionality of instances created from the image.

Check item Consequence of non-compliance Compliance recommendation
driver The instance cannot be started. Install the virtio driver on Linux.
/etc/shadow The password file cannot be modified. The password change service is unavailable in the console. Do not run the chattr command to lock the /etc/shadow file.
SElinux Exceptions may occur and affect use of the instance. Do not modify /etc/selinux/config to enable SELinux.
network Network services of the instance are unstable. Disable or delete the Network Manager and enable the network service.
ssh The instance cannot be connected remotely in the console. Enable the SSH service. Do not set PermitRootLogin. You can use the comment tag (#) to comment out the relevant lines.
firewall Exceptions may occur and affect use of the instance. Disable Iptables and Firewalld.
file system The instance fails to be created, or it cannot run normally. Use the XFS, EXT2, EXT3, or EXT4 file system.
device id The instance fails to be created, or the instance screen turns black. Change the device ID to UUID or /dev/vda* in the /etc/fstab and grub configuration files.
root account The instance cannot be connected remotely with the username and password. Retain the root account.
passwd Users cannot be added to the instance. Retain the passwd command or reinstall passwd.
partition table The instance cannot be started. Use the MBR partition.
lib The instance cannot be configured automatically. Change the destination locations of the /lib and /lib64 link files to relative paths.
disk size N/A Make sure that the size of the system disk meets the requirements specified in Import images.
disk usage A network cannot be configured for the instance. Reserve sufficient disk space.
inode usage A network cannot be configured for the instance. Reserve sufficient inode resources.
ubuntu account The instance cannot be logged in to. Make sure that the user ubuntu exists in the Ubuntu image.

The check result of a check item can be OK, FAILED, or WARNING.

  • OK: The check item complies with requirements.
  • FAILED: The check item does not comply with requirements, making the instance unable to be started. It is recommended that you resolve the issue. Otherwise, your custom image will fail to be imported.
  • WARNING: The check item does not comply with requirements. As a result, the instance can be started, but may show exceptions when used, which affects use efficiency. You can resolve the issue immediately or ignore it for now.

Output

After the check is completed, a check report is generated in the .txt and .json formats. You can run the -p [Destination path] command to specify a path to store the check report. If no path is specified, the report is stored in the path where the tool is stored.

  1. The .txt report is named image_check_report_date_time.txt, and contains the instance configuration and check result. The following example shows the check result for a CentOS 6.8 64-bit server:
The information you need to input when you import your image to Kingsoft Cloud website:
Current system is: CentOS 6.8    // The operating system and version of the instance.
Architecture: x86_64   // The system architecture.
System disk size: 21 GB    // The system disk size of the instance.
The program can obtain system version information from any of these files, but please ensure that these files retain the original content.
Do not modify /etc/issue, /etc/*release*, or /etc/debian_version (this file is not available for all distributions).
 Failure to do so will result in the system's release being unrecognized and causing system creation to fail.

Check driver   // The name of the check item.
Pass: kvm driver exists.   // The check result.

Kingsoft Cloud supports kvm virtualization technology.
We strongly recommend installing kvm driver.
  1. The .json report is named image_check_report.json, and contains the instance configuration and check result. The following example shows the check result for a CentOS 6.8 64-bit server:
platform:"CentOS",      // The operating system of the instance.
"os_big_version":"6",     // The major version of the operating system.
"os_small_version":"8",    // The minor version of the operating system.
"architecture":"x86_64",   // The system architecture.
"system_disk_size":"21",   // The system disk size of the instance.
"version":"1.0.0",       // The version of the image check tool.
"time":"2018-07-13_23-42-21",   // The check time.
 "check_items":[{
"name":"driver",       // The name of the check item.
"result":"OK",        // The check result.
"error_code":"0",      // The error code.
"description":"Pass: kvm driver exists.",  // The description.
      "comment":"Kingsoft Cloud supports kvm virtualization technology. We strongly recommend installing kvm driver. "
 }]
}

Note: The system disk size of the instance in the report is an approximate value, in GB. The check is performed on a per bit basis. If the detected system disk size is 21 GB, but the check result for the disk size item is OK, the image can still be imported.

On this page
Pure ModeNormal Mode

Pure Mode

Click to preview the document content in full screen
Feedback