Fields and annotations of the Service resource
The Service
resource defines the Kubernetes service. Services in Network Load Balancer for Managed Service for Kubernetes are load balancers for incoming traffic.
Service
is a standard Kubernetes resource. This reference describes the resource's fields and annotations supported by Network Load Balancer for Managed Service for Kubernetes. For a complete reference for the resource, please see the Kubernetes documentation
Service
apiVersion: v1
kind: Service
metadata: <ObjectMeta>
spec: <ServiceSpec>
Field |
Value or type |
Description |
|
|
Required |
|
|
Resource type |
|
|
Required |
|
|
Required |
Example
apiVersion: v1
kind: Service
metadata:
name: nlb-demo-1
spec:
selector:
app: app-demo-1
type: LoadBalancer
ports:
- port: 80
name: plaintext
targetPort: 8080
ObjectMeta
name: <string>
annotations:
yandex.cloud/load-balancer-type: <string>
yandex.cloud/subnet-id: <string>
yandex.cloud/load-balancer-healthcheck-healthy-threshold: <string>
yandex.cloud/load-balancer-healthcheck-interval: <string>
yandex.cloud/load-balancer-healthcheck-timeout: <string>
yandex.cloud/load-balancer-healthcheck-unhealthy-threshold: <string>
Field |
Value or type |
Description |
|
|
Required Does not match the load balancer name in Network Load Balancer |
|
|
Annotations (metadata.annotations)
Annotations are collections of key:value
pairs used for assigning metadata to objects. Annotation values are always of the string
data type. See more on annotations in the Kubernetes documentation
You can provide the following annotations for the ObjectMeta
object:
-
yandex.cloud/load-balancer-type
Load balancer type (by default, with an external IP address).
For a load balancer with an internal IP address, the value is
internal
. -
yandex.cloud/subnet-id
ID of the subnet in which you need to allocate an IP address for the internal network load balancer.
-
yandex.cloud/load-balancer-healthcheck-healthy-threshold
Number of consecutive successful checks to consider a node available.
The minimum value is
2
, the maximum is10
. -
yandex.cloud/load-balancer-healthcheck-interval
Health check interval in seconds.
The minimum value is
2s
, the maximum is300s
. -
yandex.cloud/load-balancer-healthcheck-timeout
Timeout for health checks in seconds. A node is considered unavailable if it has not responded within the specified time.
The minimum value is
1s
, the maximum is60s
. -
yandex.cloud/load-balancer-healthcheck-unhealthy-threshold
Number of consecutive failed checks to consider a node unavailable.
The minimum value is
2
, the maximum is10
.
ServiceSpec
type: LoadBalancer
ports:
- <ServicePort>
- ...
loadBalancerIP: <string>
externalTrafficPolicy: <string>
Field |
Value or type |
Description |
|
|
Required Warning The Kubernetes services used as network load balancers must be of the |
|
|
|
|
|
When using an external load balancer, you can specify a static public IP address in this field. You need to reserve such an address in advance. When reserving a public IP address, you can enable DDoS protection. If you do not specify a static IP address, the network load balancer will get a dynamic IP address |
|
|
|
ServicePort
port: <int32>
name: <string>
targetPort: <int32>
Field |
Value or type |
Description |
|
|
Required |
|
|
Required |
|
|
Port name within the service. |