tencent cloud


Creating Simple Nginx Service

Last updated: 2022-04-20 17:11:56


    This document describes how to quickly create an Nginx service in a container cluster.



    Creating Nginx service

    1. Log in to the TKE console and select Cluster in the left sidebar.
    2. On the Cluster Management page, click the ID of the cluster where the service will be created to go to the Deployment page of the cluster, as shown in the figure below:
    3. Click Create on this page. For more information, see Creating a Deployment.
    4. On the "Create Workload" page, specify the basic information of the workload as instructed. See the figure below.
    • Workload Name: take nginx as an example in this document.
    • Description: fill in the related workload information.
    • Label: in this example, the default value of the label is k8s-app = nginx.
    • Namespace: select a namespace based on your requirements.
    • Type: take Deployment (deploy Pods in an extensible manner) as an example.
    • Volume: set the volume to which your workload will be mounted based on your requirements. For more information, see Instructions for Other Storage Volumes.
    1. Configure "Containers in the Pod" as instructed. See the figure below:

      The main parameters are described as follows:
    • Name: enter the name of the container in the pod. Here, “test” is used as an example.
    • Image: click Select Image, select DockerHub Image > Nginx in the pop-up, and click OK.
    • Image Tag: use the default value latest.
    • Image Pull Policy: choose from Always, IfNotPresent and Never as needed. In this document, we use the default policy.
    1. In Number of Instances, set the number of instances for the service according to the following information. In this document, we choose Manual Adjustment and set the instance number to one. See the figure below:
    2. Specify the access mode of the workload, as shown in the following figure.
    • Service: select Enable.
    • Service Access: select Via Internet.
    • Load Balancer: select according to your requirements.
    • Port Mapping: select TCP, and set both the container port and service port to 80.

      The security group of the service’s cluster must open the node network and container network to the Internet. It is also required to open ports 30000 to 32768 to the Internet. Otherwise, the problem of TKE being unusable could occur. For more details, see TKE Security Group Settings.

    1. Click Create workload to complete the creation of the Nginx service.

    Accessing Nginx service

    Ngnix service can be accessed using the following two methods.

    Accessing Nginx service using Cloud Load Balancer IP

    1. In the left sidebar, click Cluster to go to the Cluster Management page.
    2. Click on the Nginx service’s cluster ID and select Service > Service.
    3. On the service management page, copy the CLB IP address of the Nginx service. See the figure below.
    4. Paste the CLB IP address in the browser and press Enter to access the service.

    Accessing Nginx service using service name

    Other services or containers in the cluster can access the WordPress service using the service name.

    Verifying Nginx service

    When the service is successfully created, you directly enter the Nginx server welcome page when accessing the service. See the figure below:

    More Nginx settings

    If the container fails to be created, you can view Event FAQs to locate the causes.

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support