• Cloud Container Engine

cce
  1. Help Center
  2. Cloud Container Engine
  3. User Guide
  4. Getting Started
  5. Creating a Containerized Application

Creating a Containerized Application

Create your containerized application after creating a container cluster and template. This section uses the Guestbook application as an example to describe how to create a containerized application from a component template.

Prerequisites

  • The container cluster on which the Guestbook application will run has been created.
  • The component templates that will be used to create the Guestbook application have been created.

Procedure

  1. Specify containerized application parameters.

    1. In the navigation pane of the CCE console, choose App Manager. On the App Manager page, click Create Containerized App.
    2. On the Create Containerized App page, specify containerized application parameters.
      Figure 1 Specifying containerized application parameters
      • Template Type

        Type of the template that will be used to create the containerized application.

        There are two types of templates: application template and component template.

        In the Guestbook example, Component template is selected.

        For details on how to create containerized applications using application templates, see section Creating a Containerized Application.

      • Container Cluster

        Container cluster on which the containerized application will run.

        In the Guestbook example, the cluster name is gbk.

      • App Name

        Name of the containerized application to be created.

        NOTE:

        An application 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 (-).

        In the Guestbook example, the application name is guestbook.

  2. Create the Frontend component.

    1. On the Create Containerized App page, click Create Component.
      The Create Component dialog box is then displayed.
      Figure 2 Create Component page
    2. In the Create Component dialog box, specify component parameters.
      • Template Name

        Component template created in section Creating Component Templates.

        In the Frontend component example, the template name is gbkfrontend.

      • Component Name
        Name of the component to be created.
        NOTE:

        A component name must be unique within a cluster and 1 to 24 characters long. It must begin with a lowercase letter and but it must not end with a hyphen (-). Only lowercase letters, digits, and hyphens (-) are allowed.

      • AZ
        • Automatic: An AZ is automatically selected for the application.
        • Custom: An AZ is selected for the application according to the AZ affinity and anti-affinity rules you created.

          Affinity: Affinity rules define in which AZs the application will be deployed. It is recommended that the AZs in which cluster nodes will be deployed should be selected as affinity AZs.

          AntiAffinity: Anti-affinity rules define in which AZs the application must not be deployed.

          If the affinity or anti-affinity rule is inappropriate, the CCE console displays a Warning dialog box "According to the selected affinity or anti-affinity rule, the application may not be scheduled onto any node. Are you sure you want to continue?" Click Cancel and correct the affinity or anti-affinity rule.

        In the Guestbook example, this parameter is set to the recommended value Automatic.

      • Node

        Node on which the component will run.

      • Instances

        Number of instances that the component has. Every instance is shipped as a container.

        In the Frontend component example, the number of instances is 1.

      • Service Name

        Service names serve a similar purpose as domain names. Components are addressed by their service names.

        In the Frontend component example, the service name is frontend.
        NOTE:

        A service name can be 1 to 24 characters long. It must begin with a lowercase letter and but it must not end with a hyphen (-). Only lowercase letters, digits, and hyphens (-) are allowed.

      • Public Service

        Indicates whether the component is accessible to external networks.

        In the Frontend component example, Public Service must be selected. Otherwise, the Frontend component is not accessible to Guestbook users.

        • Service Type

          The value is either NodePort or LoadBalancer.

          In the Frontend component example, NodePort is selected.

        • Network Protocol

          The value is either TCP or UDP. In the Frontend component example, TCP is selected.

        • Container Port

          Listening port used by the component. It is advisable to retain the default value.

        • Node Port

          Port that a node will use to provide services externally. In the Guestbook example, an automatically allocated node port is selected.

    1. Click OK.

  3. Repeat 2 to create Redis_master and Redis_slave components.

    The Redis_master and Redis_slave components do not need to provide external access. Therefore, Public Service should be deselected.

    The service name used must be the same as the service name defined in the process of Building a Container Image of the Frontend Component. The Frontend component maps the service name of the Redis_master component into the IP address of the Redis_master while attempting to access Redis_master.

    Figure 3 Create the Redis_master component
    Figure 4 Create the Redis_slave component

  4. Click OK to complete the creation of containerized application.

    It takes about 3 to 5 minutes to create a containerized application. If the Status of the application is Running, the application has been created successfully.

  5. Acquire the Guestbook service address.

    1. On the list of containerized applications, click the name of the Guestbook application or click Manage for the Guestbook application.
    2. On the Components tab page, click the  icon next to any component of the Guestbook to show the component information. Click the Basic Info tab to view the service address.
      NOTE:

      If the service type is NodePort, the service address is <Public IP address>:<Node port> of any node in the cluster. To view nodes' public IP addresses, go to the Nodes tab page on the Container Cluster page.

      Figure 5 View the Guestbook service address

  6. Access the Guestbook application using the service address.

    Figure 6 Access the Guestbook application