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:
-
An ACK Serverless cluster
-
kubectl installed and configured to connect to your cluster. For more information, see Connect to an ACK cluster by using kubectl
Deploy an NGINX application
-
Create a Deployment with an NGINX container image.
kubectl run nginx --image=registry.cn-hangzhou.aliyuncs.com/spacexnice/netdia:latest -
Expose the Deployment as a LoadBalancer service. The
--type=LoadBalancerflag 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