All Products
Search
Document Center

Container Service for Kubernetes:Use a YAML template to deploy an NGINX application, use an Ingress to expose the NGINX application, and use Simple Log Service to collect and view logs

Last Updated:Jul 04, 2025

The Container Service for Kubernetes (ACK) console provides extensive features to help you manage and maintain clusters and applications. This topic describes how to deploy an NGINX application, configure an Ingress, and query log data in the ACK console.

Prerequisites

Step 1: Deploy an NGINX application

  1. Log on to the ACK console. In the navigation pane on the left, click Clusters.

  2. On the Clusters page, find the cluster you want to manage and click its name. In the left-side pane, choose Workloads > Deployments.

  3. On the Deployments page, click Create from YAML in the upper-right corner. Then, configure the parameters and click Create.

    To configure log collection, add the following content to the spec.containers field in your template:

    Note

    In the following sample code, aliyun_logs_log-nginxvarlog specifies that the name of the created Logstore is log-nginxvarlog. The value stdout specifies that the Logstore collects standard outputs of containers from the specified path. For log collection parameter configuration details, see Collect container logs from ACK clusters.

    env:
    - name: aliyun_logs_log-nginxvarlog
      value: stdout

    image

After the NGINX application is created, you can click the image.pngicon in the upper-left corner of the page to view the application on the Deployments page.

image

Step 2: Create a Service and release the NGINX application

  1. In the left-side navigation pane of the details page, choose Network > Services .

  2. On the Services page, click Create in the upper-right corner. In the Create Service dialog box, configure the parameters and click OK.

    Parameter

    Description

    Example

    Name

    Enter a name for the Service.

    nginxservice

    Service Type

    Multiple types are supported.

    Cluster IP

    Backend

    Set the associated services.

    nginx-deployment-basic

    Port Mapping

    Configure the external port mapping.

    • Service Port: 80

    • Container Port: 80

    • Protocol: TCP

Step 3: Create an NGINX Ingress to expose the NGINX application

  1. In the left-side navigation pane of the details page, choose Network > Ingresses.

  2. On the Ingresses page, click Create Ingress.

  3. Set Gateway Type to Nginx Ingress, configure the Ingress as described in the following section, and click OK.

    The following section describes only the key parameters. For more information about how to configure other parameters, see Create an NGINX Ingress.

    • Name: Enter a name for the Ingress. The name is set to ingress-demo in this example.

    • Rules: Leave the Domain Name parameter empty, set Path to /, use the default match rule, use the nginxservice Service that you created in Step 2, and set Port to 80.

    Wait about 1 minute. The Ingress IP address is displayed in the Endpoint column of ingress-demo on the Ingresses page Enter the Ingress IP address into the address bar of the browser. If the following page is displayed, the Ingress is created.

    image

Step 4: View the access log of the NGINX application

After the NGINX application is released and exposed, the NGINX Ingress controller allows you to stream all HTTP request log data to standard outputs. You can view the access log of the NGINX application and monitor the real-time status of the NGINX Ingress in the Simple Log Service console.

  1. Log on to the ACK console. In the navigation pane on the left, click Clusters.

  2. On the Clusters page, find the target cluster and click its name. In the navigation pane on the left, click Cluster Information.

  3. On the page that appears, click the Cluster Resources tab, find Log Service Project, and then click its ID to check the Logstore.

  4. On the Logstores tab, select log-nginxvarlog to view the latest access log of the application.

    image