Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
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:

  • NetworkPolicy
  • ObjectMeta
  • NetworkPolicySpec
  • IngressRule
  • IPBlock
  1. Tool reference for Managed Service for Kubernetes
  2. NetworkPolicy

NetworkPolicy resource fields and annotations

Written by
Yandex Cloud
Updated at May 5, 2025
  • NetworkPolicy
  • ObjectMeta
  • NetworkPolicySpec
    • IngressRule
    • IPBlock

NetworkPolicy is a resource used for managing access to services published via Network Load Balancer based on IP addresses.

NetworkPolicy 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 NetworkPolicy resource reference, see this Kubernetes article.

For more information about network policies, see Kubernetes cluster network policies.

NetworkPolicyNetworkPolicy

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata: <ObjectMeta>
spec: <NetworkPolicySpec>

Field

Value / Type

Description

apiVersion

networking.k8s.io/v1

This is a required field
Kubernetes API version.

kind

NetworkPolicy

Resource type

metadata

ObjectMeta

This is a required field
Resource metadata.

spec

NetworkPolicySpec

This is a required field
Resource specification.

Example
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: whitelist-netpol
  namespace: ns-example
spec:
  podSelector:
    matchLabels:
      role: db
  policyTypes:
  - Ingress
  ingress:
  - from:
    - ipBlock:
        cidr: 198.18.235.0/24
    - ipBlock:
        cidr: 198.18.248.0/24
    - ipBlock:
        cidr: 172.16.1.0/12

ObjectMetaObjectMeta

name: <string>
namespace: <string>

Field

Value / Type

Description

name

string

This is a required field
Policy name.

namespace

string

Namespace for the policy

NetworkPolicySpecNetworkPolicySpec

podSelector: <selectorRules>
policyTypes:
  - Ingress
ingress:
  - <IngressRule>
  - ...

Field

Value / Type

Description

podSelector

LabelSelector

This is a required field
Pod filtering rules.

See this Kubernetes article.

policyTypes

[]Policy

This is a required field
Policy type. The only value is Ingress.

ingress

[]IngressRule

This is a required field
List of traffic filtering rules.

IngressRuleIngressRule

from:
  - ipBlock: <IPBlock>
  - ...

Field

Value / Type

Description

from

[]IPBlock

This is a required field
List of IP address ranges allowed to access the load balancer.

IPBlockIPBlock

ipBlock:
  cidr: <string>

Field

Value / Type

Description

cidr

string

This is a required field
Range of IP addresses allowed to access the load balancer.

The 198.18.235.0/24 and 198.18.248.0/24 ranges are always specified as they are reserved by Network Load Balancer for node health checks.

Was the article helpful?

Previous
Service
Next
Monitoring metrics
Yandex project
© 2025 Yandex.Cloud LLC