You do not need to create or manage nodes in an ACK Serverless cluster. This frees you from operations and maintenance (O&M) tasks, such as node security maintenance, and lets you focus on applications instead of the underlying infrastructure. This topic describes how to use an ACK Serverless cluster to quickly deploy an online web application that is based on the official NGINX image.
The resources that you create incur about USD 0.05 for 30 minutes. After you complete the steps in this topic, you can release the resources that you created.
Prerequisites
You have created an ACK Serverless cluster. For more information, see Create an ACK Serverless cluster.
You have bound an internet-facing endpoint to the API server of the cluster. For more information, see Control public access to the API server of a cluster.
An Internet NAT gateway is created in the virtual private cloud (VPC) in which the cluster resides and SNAT entries are configured. For more information, see Use the SNAT feature of an Internet NAT gateway to access the Internet.
Step 1: Deploy an NGINX application
Deploy using the console
Step 1: Create an NGINX application and expose the application using a Service
Log on to the ACK console. In the left navigation pane, click Clusters.
On the Clusters page, find the cluster you want to manage and click its name. In the left navigation pane, choose .
On the Deployments page, click Create from Image in the upper-right corner.
On the Basic Information page, set the parameters and click Next.
Use the default values for other parameters.
Parameter
Example
Application Name
nginx-deploy
Replicas
1
On the Container page, set the parameters and click Next.
Use the default values for other parameters.
Parameter
Example
Image Name
anolis-registry.cn-zhangjiakou.cr.aliyuncs.com/openanolis/nginx:1.14.1-8.6
Required Resources
CPU: 1 Core
Memory: 2 GB
Port
Name: example-port
Container Port: 80
Protocol: TCP
On the Advanced page, click Create next to Service. In the panel that appears, set the parameters and click OK.
Use the default values for other parameters.
Parameter
Example
Name
nginx-deploy-svc-test
Service Type
SLB
SLB Type: NLB
Select Resource: Create Resource
Port Mapping
Name: example-map
Service Port: 80
Container Port: 80
Protocol: TCP
Click Create, and then click View Details.
On the details page of the Deployment, click the Pods tab and wait until the status of the pod changes to Running. Then, click the Access Method tab and copy the public IP address or URL from the External Endpoint field.
Use kubectl
You can use kubectl on your on-premises machine or in Cloud Shell to perform the following operations. If you use kubectl in Cloud Shell, you do not need to configure the config file.
Step 1: Create an NGINX application and expose the application using a Service
Connect to the ACK Serverless cluster using kubectl. For more information, see Connect to a Kubernetes cluster using kubectl.
Create an nginx.yaml file with the following code block:
apiVersion: v1 kind: Service metadata: name: nginx-deploy-svc spec: ports: - port: 80 protocol: TCP selector: app: nginx type: LoadBalancer --- apiVersion: apps/v1 # Use the API version that corresponds to your Kubernetes version. kind: Deployment metadata: name: nginx-deploy labels: app: nginx spec: replicas: 1 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: anolis-registry.cn-zhangjiakou.cr.aliyuncs.com/openanolis/nginx:1.14.1-8.6 ports: - containerPort: 80 resources: requests: cpu: "1" memory: "2Gi"Run the following command to deploy an application using the nginx.yaml file in the cluster:
kubectl apply -f nginx.yamlExpected output:
service/nginx-service created deployment.apps/nginx-deploy createdRun the following command to view the details of the application:
kubectl get deployExpected output:
NAME READY UP-TO-DATE AVAILABLE AGE nginx-deploy 1/1 1 1 9m32sRun the following command to view the details of the Service and record the public IP address (EXTERNAL-IP) of the nginx-service Service:
kubectl get svcExpected output:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 172.XX.X.X <none> 443/TCP 10d nginx-service LoadBalancer 172.19.X.XXX 47.57.XX.XX 80:32278/TCP 39s
Step 2: Test access to the NGINX application
In a browser, enter the public IP address or URL of the Service and press Enter.
If the NGINX welcome page appears as shown in the following figure, the application and Service are working as expected.

What to do next
Configure auto scaling policies for the application. For more information, see Configure auto scaling policies for a cluster.
If you do not want to configure auto scaling, you can perform the following steps to release the resources that you created:
Delete the created application and service
On the Clusters page of the Container Service for Kubernetes (ACK) console, click the name of the target cluster.
In the navigation pane on the left, choose Workloads > Deployments. Select the NGINX application that you created, click Batch Delete, and then follow the on-screen instructions to confirm the deletion.
Delete a cluster
ACK Serverless clusters are in public preview and offer a free trial. However, you must pay for other Alibaba Cloud services used by your ACK Serverless clusters based on the billing rules of the services. Fees are charged by these Alibaba Cloud services separately. After you complete the configuration, you can manage the cluster in one of the following ways:
If you no longer need the cluster, log on to the ACK console. On the Clusters page, choose More > Delete in the Actions column of the cluster to delete the cluster. In the Delete Cluster dialog box, select Delete ALB Instances Created by the Cluster, Delete Alibaba Cloud DNS PrivateZone instances Created by the Cluster, and I understand the above information and want to delete the specified cluster, and then click OK. For more information about how to delete an ACK Serverless cluster, see Delete an ACK Serverless cluster.
If you want to continue to use the cluster, recharge your Alibaba Cloud account at least 1 hour before the trial period ends and ensure that your account has a balance of at least CNY 100. For more information about the billing of Alibaba Cloud services used by ACK Serverless Pro clusters, see Cloud service fee.