Found 0 result in total
Content is empty
If you don't find the content you expect, please try another search term
Last updated:2021-05-11 10:41:27
A Kubernetes Service abstracts the policies for accessing a set of pods. It shields dynamic changes of backend pods and multi-pod load balancing, and manages Service access over the Layer 4 network in a cluster. The following types of Services are available:
ClusterIP
(default): ClusterIP
Services are further classified into common Services and headless Services depending on whether cluster IP addresses are allocated.
Fixed virtual IP addresses
(cluster IP addresses) are allocated to common Services in a Kubernetes cluster so that the Services can be accessed within the cluster.NodePort
: Cluster IP addresses are used. In addition, Service ports are mapped to the same ports on each node in a Kubernetes cluster so that the Services can be accessed by external systems through the IP address and port number of a node.
LoadBalancer
: In addition to cluster IP addresses and node ports, SLB is used to enable external access to the Services. The backend servers of SLB are mapped to node ports.You can set the access method of an associated Service when you create a workload or associate a Service with a workload when you create the Service. To create a Service, perform the following steps:
Log in to the KCE console.
In the left navigation pane, click Cluster.
Click the ID of the cluster in which you want to create a Service. The cluster details page appears.
In the left navigation pane, choose Service Management > Service. On the Service list page, click Create.
Set basic information such as the name and namespace of the Service.
Set the access method. KCE supports four access methods. For more information, see the following table.
Set the associated workload in two ways: Set Selector Manually or Refer to the workload.
Click Create.
Access method | Service type | Description |
---|---|---|
Public Access(LoadBalancer) | LoadBalancer | - This option allows Services to be exposed to the Internet through SLB so that they can be accessed over the Internet. The cluster automatically creates a public SLB instance and an EIP to perform dynamic mounting and synchronization of listeners. - The Services can be accessed over the Internet through the IP address of the SLB instance and a Service port. For more information, see Access Services by using SLB. |
Via VPC(LoadBalancer) | LoadBalancer | - This option allows Services to be exposed to the VPC where the Kubernetes cluster resides through SLB so that they can be accessed by other resources or Kubernetes clusters in the VPC. The cluster automatically creates a private SLB instance to perform dynamic mounting and synchronization of listeners. - The Services can be accessed in the VPC through the IP address of the SLB instance and a Service port. For more information, see Access Services by using SLB. |
Intra-Cluster(ClusterIP) | ClusterIP | - This option allows Services to be exposed to the Kubernetes cluster so that they can be accessed by other Services or containers in the cluster. - You can create headless Services. - You can access the Services in the cluster through the Service name and Service port. |
NodePort(NodePort) | NodePort | - This option allows Services to be exposed out of the Kubernetes cluster through a static port on each node. - You can access the Services outside the cluster through the node IP address and port. |
Other access configurations for different SLB types are described as follows:
SLB Subnet: Select the subnet where the SLB instance resides. This item is available when the access method is Via VPC(LoadBalancer). You can select an endpoint subnet in the VPC where the cluster resides.
Port Mapping: Specify the protocol and ports for accurately sending the configurations to listeners. Layer 4 protocols are supported. The default protocol is TCP. Container Port specifies the target port of backend pods. Service Port specifies the public Service port of listeners.
ExternalTrafficPolicy: Select a method for routing external traffic to the cluster when the Service type is LoadBalancer or NodePort. Traffic is routed to the local node or the cluster when you select Local or Cluster (default). If you select Local, the source IP address of the client can be obtained, and traffic can be forwarded more efficiently. However, a potential risk of unbalanced traffic forwarding exists. If you select Cluster, the overall load capacity is higher, but the source IP address of the client cannot be obtained.
On the Service list page, click Update Access Method for a Service. On the Update Service page, update access configurations such as the access method.
On the Service list page, click Delete for a Service. In the message that appears, click OK.
Pure Mode