Fields and annotations of the Service resource for the Gateway API
The Service resource represents a Kubernetes service. For the Gateway API, services are backends across which incoming traffic is distributed within a Managed Service for Kubernetes cluster. Services operating as Application Load Balancer backends are specified in the HTTPRoute resource.
Service is a standard Kubernetes resource. Below, we describe its fields and annotations used by the Application Load Balancer tools for Managed Service for Kubernetes. For resource configuration details, see this Kubernetes guide
Service
apiVersion: v1
kind: Service
metadata:
name: <string>
spec: <ServiceSpec>
|
Field |
Value / Type |
Description |
|
|
|
This is a required field. Kubernetes API version. |
|
|
|
Resource type. |
|
|
|
This is a required field. Resource metadata. |
|
|
|
This is a required field. Do not mistake this name for the Application Load Balancer load balancer name. |
|
|
|
This is a required field. Resource specification. |
Example
apiVersion: v1
kind: Service
metadata:
name: alb-demo-1
spec:
selector:
app: alb-demo-1
type: NodePort
ports:
- name: http
port: 80
protocol: TCP
nodePort: 30081
ServiceSpec
type: NodePort
ports:
- <ServicePort>
-
|
Field |
Value / Type |
Description |
|
|
|
This is a required field. Service type. Warning Kubernetes backend services referenced in |
|
|
|
This is a required field. List of ports the service is available on. |
ServicePort
port: <int32>
name: <string>
protocol: <protocol>
nodePort: <int32>
|
Field |
Value / Type |
Description |
|
|
|
This is a required field. You can use this number if you designate a service as a backend:
|
|
|
|
Service port name. You can use this name if you designate a service as a backend:
|
|
|
|
Port network protocol; |
|
|
|
Number of the port opened on the cluster nodes where the service is deployed. The load balancer routes traffic to this port, and Kubernetes forwards the traffic to the service on its port in the The value matches the backend port in the Application Load Balancer backend group. |