This topic describes how to create an application from an image in the Container Service console.

Prerequisites

A Serverless Kubernetes cluster is created. For more information, seeCreate a serverless Kubernetes cluster.

Procedure

  1. Log on to the Container Service console.
  2. In the left-side navigation pane under Container Service-Kubernetes, choose Application > Deployment.
  3. Set Name, Clusters, Namespace, Replicas, Type, Label, and Annotations. Then, click Next to go to the application configuration page.

    If Namespace is not specified, the system uses the default namespace.

  4. Select the image you want to use and the image version.
    • Image Name: Click Select Image. In the dialog box that appears, select the required image, and then click OK. You can also enter the name of a private registry in the format of domainname/namespace/imagename:tag. In this example, the NGINX image is used.
    • Image Version: Click Select Image Version to select a version. If this parameter is not specified, the latest image version is used.
  5. Click Add Container to add more containers.
    In this example, single-container pods are used. If you specify multiple containers, the same number of pods are started.
  6. Configure resource limits and required resources for the application.
    Serverless Kubernetes is currently in the open beta test. A Serverless Kubernetes cluster can use 2 CPU cores and 4 GB memory at most.
    • Resource limits: the upper limit of CPU and memory resources available for the application. This prevents the application from occupying excessive resources.
    • Required resources: the amount of CPU and memory resources that are reserved for the application, that is, exclusive to the container. This prevents the application from becoming unavailable due to resource shortage when other services or processes compete for resources.

    CPU is measure in millicores, that is, one thousandth of one core. Memory is measured in bytes, which can be GiB, MiB, or KiB.

  7. Set environment variables.

    You can use key-value pairs to set environment variables for the pods. Environment variables are used to add environmental labels or pass configuration parameters to the pods. For more information, see Pod variable.

  8. Set the Command and Parameter parameters for the container.

    You can set the Command and Parameter parameters for the container running in the pod.

    If the two parameters are not specified, the default settings of the image are used. If they are specified, their settings overwrite the default settings of the image. If only Parameter is specified, the default command is run with the specified parameters when the container is started.

    The Command and Parameter parameters cannot be modified after the pod is created.

  9. After completing the application configuration, click Next. On the access configuration page that appears, bind a service to the back-end pod.

    The service is optional. If you choose to create a service, click Create and set service parameters in the Create Service dialog box that appears. Currently, you can only create a service of the LoadBalancer type.

    • Type: Set this parameter to Server Load Balancer and select Public Access or Internal Access as required.
    • Name: A service name containing the application name suffixed with svc is generated by default, which is serverless-app-svc in this example. You can modify the service name.
    • Port Mapping: Add the service port and container port. TCP and UDP are supported.
  10. After completing the access configuration, click Create.

What to do next

After the creation task is submitted, the creation completion page appears, where you can view the application details. You can also go to the Deployments page to view the application.

The serverless-app-svc application appears in the deployment list.

In the left-side navigation pane, choose Ingresses and Load Balancing > Services. The serverless-app-svc service appears in the service list.

Visit the external endpoint of the service in your browser. The NGINX welcome page appears.