This topic describes how to create a NodePort service in cluster Kubernetes-piggymetrics-cluster. The service is used to handle production traffic forwarded from the SLB instance attached to a Swarm cluster.
You have created a managed Kubernetes cluster. For more information, see Create a managed Kubernetes cluster.
- Log on to the Container Service console. In the left-side navigation pane, choose . On the Services page, select the target cluster Kubernetes-piggymetrics-cluster and click Create in the upper-right corner.
- In the Create Service dialog box that appears, set the parameters and click Create. For more information, see Create a service.
- Name: Enter the service name. In this example, enter gateway-swarm-slb.
- Type: Select the service type, which specifies how to access the service. In this example,
select Node Port.
Node Port: Exposes the service through the IP address and static port (NodePort) of each node. A NodePort service can route requests to a Cluster IP service, which is automatically created by the system. You can access a NodePort service from outside the cluster by requesting
- Backend: Select the backend object to bind with the service. In this example, select the previously created gateway service.
- Port Mapping: Set the service port and container port. The container port must be the same as
the one exposed by the backend Pod.
The node port range is 30000 to 32767.