tencent cloud

Feedback

Creating a Container Instance

Last updated: 2023-05-04 10:44:34

    Overview

    This document describes how to create and edit a container instance, and how to view events and logs.

    If you are creating a container instance for the first time, we recommend that you refer to Creating a Container Instance.
    If you want to use advanced features such as container group and log collection, please refer to Creating a Container Instance.

    The configuration supported by the two modes are as follows:

    Supported Item Quick Creation Complete Creation
    All regions
    All specifications
    Volume
    Container environment variables
    Number of instances
    Multi-container ×
    Advanced configuration of a container (such as running command and init container) ×
    Restart policy (it defaults to Always) ×
    Log collection ×
    Binding a role ×
    Binding an EIP ×
    Note:

    Container instances are in beta currently. To use them, please submit a ticket.

    Directions

    Granting permissions at the first time of use

    You need to grant permissions to the current account for TKE to operate cloud resources when you use an EKSCI for the first time. For details, see Service Authorization. If you have granted permissions to TKE, please skip this step.

    Note

    You can log in to the CAM console to check if there is a TKE_QCSRole role.

    Creating a container instance

    1. Log in to the TKE console.
    2. On the list page of container instances, select the region where the instance is located.
    3. Click Create instance on the top of the instance list.
    4. On the Create instance page, configure the basic information of the instance.
      Configuration ItemDescription
      Instance name Enter the name of the instance to be created.
      Region Select a closest region. For example, if you are located in Shenzhen, please select "Guzhangzhou" for the region.
      Container network Assign an IP address within the IP range of the container network to the container instance.
      Note

      Subnet determines the availability zone. Each availability zone supports different type of resources, such as AMD, GPU-T4 and GPU-V100. Please select a subnet which supports the desired type of resources according to the prompts.

      Security group Security group has the capability of a firewall and can limit the network communication of the instance. Default value is default.
      Instance specification For specifications supported by an instance, see Resource Specifications.
      Volume (optional) Provides storage for the container. Currently, it supports NFS and CBS. Also, it needs to be mounted to the specified path of the container.
      Volume type Description
      Cloud Block Storage (CBS) You can mount a Tencent Cloud CBS disk to a specified path of the container. When the container is migrated, the cloud disk will be migrated along with it. CBS volumes are suitable for the persistent storage of data and can be used for stateful services such as MySQL. For a service for which a CBS volume is configured, the maximum number of Pods is 1.
      Network File System (NFS) You only need to enter the NFS path. You can use a CFS or NFS for file storage. NFS volumes are suitable for the persistent storage of data that is read and written many times. They can also be used in scenarios such as big data analysis, media processing, and content management.
      Containers in the Pod You can add multiple containers.
      • Name: (Optional) enter a custom name. If it is left empty, the image name will be used.
      • Image: You can select an image from TCR Enterprise Edition, TCR Personal Edition, Dockerhub or a third-party image repository.
      • Image tag: It defaults to `latest` if it is left empty.
      • Environment variable: You can configure the environment variables for the container.
      • CPU limit: It is left empty by default and the container can use all instance resources. You can set the maximum amount of CPU resources that the container can use.
      • Memory limit: It is left empty by default and the container can use all instance resources. You can set the maximum amount of memory resources that the container can use.
      • Health check: For details, see Health Check for Containers.
      • Running commands and parameters: For details, see Running Commands and Parameters for Containers.
      • Init container: You can set the container to init container. Note that there must be a business container other than the init container.
      Image repository credential When you select an image from Docker Hub or a third-party image repository, you must enter the image credential, i.e., access address, username and password of the repository.
      Number of instances You can create multiple instances at a time. You can create only one replica if you select CBS as the volume type.
    5. Click Confirm to go to the "Confirm configuration" page.
    6. On this page, confirm the resource specification and configuration cost. Click Create instance to complete the creation.

    You can set the advanced configuration on Other configurations page.

    You can select a restart policy from the following three policies. It defaults to Always.

    • Always: Auto-restart the container if it is in any status other than running.
    • Never: Regardless of the status, never restart the container.
    • OnFailure: Auto-restart the container when the container terminates of the operation and the exit code is not 0.
      Restart policy is actually the behavior that acts on containers in the Pod. It does not means the container instance will be restarted.

    Editing a container instance

    1. Log in to the TKE console.
    2. On the list page of container instances, select the region where the instance is located.
    3. Click More > Edit on the right of the instance to be edited.
    4. Modify the parameters of the instance on Edit instance page.
    5. Click Update instance when you finished the modification.
      Note:

      • Previous configuration will be cleared when you update the container instance. You need to recreate it.
      • You cannot modify the following parameters for the container instance. Please recreate them if you want to modify.
      • Region
      • Network
      • Security group
      • Resource specification
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support