This topic describes how to create a serverless Kubernetes (ASK) cluster in the Container Service for Kubernetes (ACK) console. This topic also describes how to create an application from an image and view the containers in an ASK cluster.

Prerequisites

Step 1: Create an ASK cluster

Note This section describes only the key parameters that are required to create an ASK cluster. You can configure other parameters and install components based on your business requirements. For more information, see Create an ASK cluster.
  1. Log on to the ACK console.
  2. In the left-side navigation pane of the ACK console, click Clusters.
  3. In the upper-right corner of the Clusters page, click Create Kubernetes Cluster.
  4. On the page that appears, click the Serverless Kubernetes tab and configure the following parameters.
    Parameter Description Example
    Cluster Name Enter a name for the cluster.
    Note The name must be 1 to 63 characters in length, and can contain digits, letters, and hyphens (-).
    ask-hangzhou
    Cluster Specification

    Select a cluster type. You can select Standard edition or Professional.

    Standard edition
    Region Select a region to deploy the cluster. China (Hangzhou)
    VPC Specify the virtual private cloud (VPC) in which you want to deploy the cluster. Kubernetes clusters support only VPCs. You can select Create VPC or Select Existing VPC.
    • Create VPC: If you select this option, ACK automatically creates a VPC and a NAT gateway in the VPC. ACK also configures SNAT rules on the NAT gateway.
    • Select Existing VPC: If you select this option, you must select a VPC from the VPC drop-down list and select vSwitches in the vSwitch section. If you want to enable Internet access for the cluster to download container images or perform other operations, you must configure a NAT gateway. We recommend that you upload container images to a Container Registry instance in the region in which the cluster is deployed. This way, you can pull the images over the VPC.

    For more information, see Create and manage a VPC.

    Select Existing VPC
    Configure SNAT Specify whether to automatically create a NAT gateway and configure SNAT rules on the NAT gateway.

    This parameter is required only if you set VPC to Create VPC.

    Note After you select Create VPC, you can specify whether to automatically create a NAT gateway and configure SNAT rules on the NAT gateway. If you clear this check box, you must manually create a NAT gateway and configure SNAT rules on the NAT gateway. Otherwise, the cluster deployed in the VPC cannot access the Internet.

    For more information, see Create and manage Internet NAT gateways.

    Configure SNAT for VPC
    Service CIDR

    Set Service CIDR. The CIDR block specified by Service CIDR cannot overlap with that of the VPC or those of the existing clusters in the VPC. The CIDR block cannot be modified after the cluster is created. The Service CIDR block cannot overlap with the pod CIDR block. For more information about how to plan CIDR blocks for an ACK cluster, see Plan CIDR blocks for an ACK cluster.

    172.21.0.0/20
    Access to API Server
    By default, an internal-facing Server Load Balancer (SLB) instance is created for the Kubernetes API server of an ASK cluster. You can modify the specification of the SLB instance. For more information, see Instance types and specifications.
    Notice If you delete the SLB instance, you cannot access the Kubernetes API server of the cluster.
    Select or clear Expose API Server with EIP. The Kubernetes API server provides multiple HTTP-based RESTful APIs, which can be used to create, delete, modify, query, and monitor resources, such as pods and Services.
    • If you select this check box, an elastic IP address (EIP) is created and associated with the SLB instance. In this case, the Kubernetes API server of the cluster is exposed to the Internet through port 6443 of the EIP. You can use kubeconfig files to connect to and manage the cluster over the Internet.
    • If you clear this check box, no EIP is created. You can connect to and manage the cluster by using kubeconfig files only from within the VPC.

    For more information, see Control public access to the API server of a cluster.

    Expose API Server with EIP
    Terms of Service You must read and select Terms of Service for Serverless Kubernetes before you create the cluster. Select Terms of Service
  5. After you configure the cluster, click Next:Component Configurations in lower-right part of the page to configure components.
    Parameter Description Example
    Service Discovery Specify whether to enable the service discovery feature. Default value: Disable. For more information, see ASK Service discovery and DNS.
    • You can select PrivateZone to enable the PrivateZone service.
    • You can select CoreDNS to enable the CoreDNS service.
    Disable
    Ingress Specify whether to install an Ingress controller. By default, Do Not Install is selected.
    • If you select Nginx Ingress, the NGINX Ingress controller is automatically installed. For more information about the NGINX Ingress controller, see Advanced Ingress configurations.
    • If you select ALB Ingress, the Application Load Balancer (ALB) Ingress controller is automatically installed. For more information about how to access Services in a cluster by using ALB Ingresses, see Access Services by using an ALB Ingress.
    Do Not Install
    Monitoring Service Specify whether to install the metrics-server component. By default, Install metrics-server is not selected.

    We recommend that you select Install metrics-server to enable the monitoring service.

    Install metrics-server
    Log Service Specify whether to enable Log Service. You can select an existing Log Service project or create one. By default, Enable Log Service is selected.

    This allows you to use Log Service with simple configurations when you create an application. For more information, see Collect log files by using Log Service.

    Create Project
    Knative Specify whether to enable Knative. By default, Enable Knative is not selected. For more information, see Knative overview. Enable Knative
  6. After you configure components, click Next:Confirm Order in lower-right part of the page.
  7. On the Confirm Order wizard page, select Terms of Service for Serverless Kubernetes in the Term of Service section and click Create Cluster.

What to do next

  • After the cluster is created, you can find the cluster on the Clusters page in the console.
    Create an ASK cluster
  • On the Clusters page, find the created cluster and click Details in the Actions column. On the details page, click the Basic Information tab to view the basic information about the cluster and click the Connection Information tab to view the information about how to connect to the cluster.

Step 2: Create an application from an image

Note This section describes only the key parameters that are required to create an application from an image. For more information, see Create an application from an image.
1. Configure basic information
  1. In the left-side navigation pane of the details page, choose Workloads > Deployments.
  2. In the upper-right corner of the Deployments page, click Create from Image.
  3. On the Basic Information wizard page, configure the basic settings of the application.
    Parameter Description Example
    Name Enter a name for the application. serverless-app-deployment
    Type Specify the type of the resource object. Valid values include Deployment and StatefulSet. Deployment
  4. Click Next.
2. Configure container settings
  1. In the General section of the Container wizard page, configure the basic settings of the container.
    Parameter Description Example
    Image Name To select an image, click Select Image. In the Select Image dialog box, select an image and click OK.

    You can also enter the address of an image that is stored in a private registry. The image address must be in the following format: domainname/namespace/imagename:tag.

    In this example, an image that is stored on a Container Registry Personal Edition instance is used. The instance is deployed in the China (Hangzhou) region.
    Image Version Click Select Image Version and select an image version. If you do not specify an image version, the latest image version is used. In this example, no image version is specified.
  2. In the Ports section, click Add to configure one or more container ports.
    Parameter Description Example
    Name

    Enter a name for the port.

    nginx
    Container Port Specify the container port that you want to expose. The port number must be from 1 to 65535. 80
    Protocol Valid values: TCP and UDP. TCP
  3. Click Next.
3. Configure advanced settings
  1. In the Access Control section of the Advanced wizard page, configure a Service to expose the backend pod.
    Click Create on the right side of Services. In the Create Service dialog box, configure the following parameters.
    Parameter Description Example
    Name Enter a name for the Service. serverless-app-svc
    Type The type of Service. This parameter determines how the Service is accessed. Select Server Load Balancer. Then, select Public Access and Create SLB Instance. You can click Modify to change the Server Load Balancer (SLB) instance specification based on your business requirements.

    In this example, the default specification Small I (slb.s1.small) is used.

    Port Mapping Specify a Service port and a container port. The container port must be the same as the one that is exposed in the backend pod. In this example, the Service port is set to 8080 and the container port is set to 80.

    You can find the created Service in the Access Control section. You can click Update or Delete to change the configurations.

  2. Click Create.
4. Access the NGINX application
  1. On the Complete wizard page, click View Details. You can find serverless-app-deployment on the Deployments page.
    Deployments
  2. Access the NGINX application.
    1. In the left-side navigation pane of the cluster details page, choose Network > Services. On the Services page, you can find the serverless-app-svc Service.
      Services
    2. Click the address in the External Endpoint column to access the NGINX application by using a browser.
      nginx
      Note For more information about how to access an application by using an Ingress, see Access Services by using an ALB Ingress.

Step 3: View the pod

  1. In the left-side navigation pane of the details page, choose Workloads > Pods.
  2. Select the pod that you want to view and click Details in the Actions column.
    Note You can modify or delete the pod based on your needs. We recommend that you use templates to manage pods that are created by using templates. Do not directly modify or delete these pods.
  3. On the details page of the pod, you can view the detailed information about the pod.
    2