Manage applications from the command line

更新时间:
复制 MD 格式

Use kubectl to deploy an NGINX application to your ACK Serverless cluster and verify it is running.

Prerequisites

Before you begin, ensure that you have:

Deploy an NGINX application

  1. Create a Deployment with an NGINX container image.

    kubectl run nginx --image=registry.cn-hangzhou.aliyuncs.com/spacexnice/netdia:latest
  2. Expose the Deployment as a LoadBalancer service. The --type=LoadBalancer flag provisions a Server Load Balancer (SLB) instance and routes external traffic to the NGINX container on port 80.

    kubectl expose deployment nginx --port=80 --target-port=80 --type=LoadBalancer

Verify the deployment

List all pods in the default namespace to confirm the application is running.

kubectl get pods

The output is similar to:

NAME                                   READY     STATUS    RESTARTS   AGE
nginx-2721357637-d****                 1/1       Running   1          9h

A pod with STATUS: Running and READY: 1/1 indicates the deployment succeeded. The pod name suffix is auto-generated by Kubernetes.

What's next

  • Scale your application by adjusting the number of replicas

  • Update the container image to deploy a new version

  • Delete the application when it is no longer needed