• Cloud Container Engine

cce
  1. Help Center
  2. Cloud Container Engine
  3. User Guide
  4. Getting Started
  5. Creating Component Templates

Creating Component Templates

You can create a component template using the uploaded container images.

Background

A single containerized application consists of one or more components. Each component has one or more containers.

When creating a component template from container images, specify:

  • Network protocol
  • Communications port
  • Memory capacity
  • CPU capacity
  • Volume
  • Environment variables

For the Guestbook application, three component templates must be created:

  • gbkfrontend
  • gbkredismaster
  • gbkredisslave

Procedure

  1. Create the component template gbkfrontend.

    1. In the navigation pane of the CCE console, choose Component Template. On the Component Template page, click Create Component Template.
    1. On the Create Component Template page, specify parameters of the component template gbkfrontend.
      Figure 1 Defining a component template
      • Template Name
        Name of the component template to be created. In the Frontend component example, the template name is gbkfrontend.
        NOTE:

        A component template name must:

        • Be 1 to 24 characters long. Only lowercase letters, digits, and hyphens (-) are allowed.
        • Begin with a lowercase letter and but not end with a hyphen (-).
      • Container Image

        Name and version number of the container image that will be used to create the component template.

        Container images are classified into two types:

        • Internal container images, which are stored in CCE's container registry.
        • External container images, which are stored in container registries from other sources.
      • Network and Port

        Network protocol and listening port used by the component.

        In the gbkfrontend example, Network is TCP and Port is 80.

      • Memory and CPU

        Memory capacity and CPU capacity of the component.

        In the gbkfrontend example, Memory is 64 MB and CPU is 100 mcores.

      • Support uncapped resource

        If only one container supports uncapped CPU, the container can use available resources on the node, in addition to the CPU capacity of the container.

        If multiple containers support uncapped CPU, they can additionally share available resources on the node on a percentage basis. For example, if the CPU capacity of container A is 100 mcores and the CPU capacity of container B is 300 mcores, then they share available resources on the node at a ratio of 1:3.

        Usually, the default value of Support uncapped resource is retained.

      • Volumes and Environment Variables

        You can leave these fields unspecified.

    2. Click OK to complete the creation.

  2. Repeat 1 to create gbkredismaster and gbkredisslave templates.

    NOTE:

    The default port number of the Redis components is 6379. The port number must be the same as that defined in section Building Container Images.

    The created component templates are listed on the Component Template page.