Yandex Cloud
Search
Contact UsTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Network Load Balancer
  • Getting started
  • Access management
  • Pricing policy
  • Terraform reference
    • Overview
    • Service
    • NetworkPolicy
  • Monitoring metrics
  • Audit Trails events
  • Release notes
  • FAQ

In this article:

  • Service
  • ObjectMeta
  • Metadata.annotations
  • ServiceSpec
  • ServicePort
  1. Tool reference for Managed Service for Kubernetes
  2. Service

Service resource fields and annotations

Written by
Yandex Cloud
Updated at January 26, 2026
  • Service
  • ObjectMeta
    • Metadata.annotations
  • ServiceSpec
    • ServicePort

The Service resource defines a Kubernetes service. In Network Load Balancer for Managed Service for Kubernetes, services are load balancers for incoming traffic.

Service is a standard Kubernetes resource. This reference describes the resource fields and annotations supported by Network Load Balancer for Managed Service for Kubernetes. For a complete reference for the resource, see this Kubernetes guide.

ServiceService

apiVersion: v1
kind: Service
metadata: <ObjectMeta>
spec: <ServiceSpec>

Field

Value / Type

Description

apiVersion

v1

This is a required field.
Kubernetes API version.

kind

Service

Resource type.

metadata

ObjectMeta

This is a required field.
Resource metadata.

spec

ServiceSpec

This is a required field.
Resource specification.

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

ObjectMetaObjectMeta

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 / Type

Description

name

string

This is a required field.
Resource name.

It does not match the load balancer name in Network Load Balancer.

annotations

map[string]string

Resource annotations.

Metadata.annotationsMetadata.annotations

Annotations are collections of key:value pairs for assigning metadata to objects. Annotation values have the string data type. For more information on annotations, see this Kubernetes guide.

You can add the following annotations to ObjectMeta:

  • 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 the internal load balancer will get its IP address.

  • yandex.cloud/load-balancer-healthcheck-healthy-threshold

    Number of consecutive successful checks to consider a node healthy.

    It can range from 2 to 10.

  • yandex.cloud/load-balancer-healthcheck-interval

    Health check interval in seconds.

    It can range from 2s to 300s.

  • yandex.cloud/load-balancer-healthcheck-timeout

    Health check timeout in seconds. If a node fails to respond within this time, it is considered unhealthy.

    It can range from 1s to 60s.

  • yandex.cloud/load-balancer-healthcheck-unhealthy-threshold

    Number of consecutive failed checks to consider a node unhealthy.

    It can range from 2 to 10.

ServiceSpecServiceSpec

type: LoadBalancer
ports:
  - <ServicePort>
  - ...
loadBalancerIP: <string>
externalTrafficPolicy: <string>

Field

Value / Type

Description

type

LoadBalancer

This is a required field.
Service type.

Warning

Kubernetes services used as network load balancers must be of the LoadBalancer type. For more information about this type, see this Kubernetes guide.

ports

[]ServicePort

This is a required field.
List of ports the service is available on.

loadBalancerIP

string

When using an external load balancer, you may 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 public IP address, the network load balancer will get a dynamic public IP address.

When using an internal load balancer, you can specify an internal IP address. Make sure the specified internal IP address is not assigned to some other resource in the same cloud network.

Warning

Once removed from the specification, the internal IP address may be automatically assigned to a different resource in the same cloud network. We recommend selecting the address closer to the upper bound of your subnet's IP address range.

externalTrafficPolicy

string

Traffic management policy:

  • Cluster: Traffic can reach any of the Kubernetes cluster nodes. If the target pods are not on that node, kube-proxy redirects traffic to another node. This is a default value.

  • Local: Traffic goes directly to the nodes where the application containers are running. In this case, the following applies:

    • User request IP address remains unchanged.
    • Inter-VM traffic is reduced.

ServicePortServicePort

name: <string>
port: <int32>
targetPort: <int32>
nodePort: <int32>

Field

Value / Type

Description

name

string

Service port name.

port

int32

This is a required field.
Port to process incoming user requests to the service.

This port will also be assigned to the load balancer listener as the incoming traffic port.

targetPort

int32

Container port on which the application will be available.

If you skip this field, the targetPort value will match the port value.

nodePort

int32

Port to process incoming user requests to the service from outside the cluster.

This port will also be assigned to the load balancer listener as the target incoming traffic port for targets in the target group.

Typically, this field is skipped and its value is automatically selected from the specified range.

However, you can specify a port explicitly. This port must not be used by other Kubernetes objects.

Its range of values is 30000-32767.

Was the article helpful?

Previous
Overview
Next
NetworkPolicy
© 2026 Direct Cursus Technology L.L.C.