This topic describes how to create a NodePort service in the Kubernetes-piggymetrics-cluster
cluster. The service is used to handle production traffic forwarded from the SLB instance
attached to a Container Service for Swarm cluster.
Procedure
- Log on to the Container Service for Kubernetes console. In the left-side navigation pane, choose . On the Services page, find the Kubernetes-piggymetrics-cluster cluster and click
Create in the upper-right corner.
- In the Create Service dialog box, set the required parameters and click Create. For more information, see Create a service.
Note
- Name: Enter the service name. gateway-swarm-slb is entered in this example.
- Type: Select the service type, which specifies how the service is accessed. Node Port is selected in this example.
Node Port: enables access to the service through the IP address and static port (NodePort)
on each node. A NodePort service can be used to route requests to a ClusterIP service.
The ClusterIP service is automatically created by the system. You can access the NodePort
service from outside the cluster by sending requests to <NodeIP>:<NodePort>
.
- Backend: Select the backend instance to be bound to the service. The created gateway service
is selected in this example.
- Port Mapping: Set the service port and container port. The container port must be the same as
that exposed by the backend pod.
The node port range is from 30000 to 32767.