Skip to content

API Specification

Packages:

policy.networking.k8s.io/v1alpha1

Package v1alpha1 contains API Schema definitions for the policy.networking.k8s.io API group.

Resource Types:

    AdminNetworkPolicy

    AdminNetworkPolicy is a cluster level resource that is part of the AdminNetworkPolicy API.

    Field Description
    metadata
    Kubernetes meta/v1.ObjectMeta
    Refer to the Kubernetes API documentation for the fields of the metadata field.
    spec
    AdminNetworkPolicySpec

    Specification of the desired behavior of AdminNetworkPolicy.



    priority
    int32

    Priority is a value from 0 to 1000. Policies with lower priority values have higher precedence, and are checked before policies with higher priority values. All AdminNetworkPolicy rules have higher precedence than NetworkPolicy or BaselineAdminNetworkPolicy rules Every AdminNetworkPolicy should have a unique priority value; if two (or more) policies with the same priority could both match a connection, then the implementation can apply any of the matching policies to the connection, and there is no way for the user to reliably determine which one it will choose.

    Support: Core

    subject
    AdminNetworkPolicySubject

    Subject defines the pods to which this AdminNetworkPolicy applies. Note that host-networked pods are not included in subject selection.

    Support: Core

    ingress
    []AdminNetworkPolicyIngressRule
    (Optional)

    Ingress is the list of Ingress rules to be applied to the selected pods. A total of 100 rules will be allowed in each ANP instance. The relative precedence of ingress rules within a single ANP object (all of which share the priority) will be determined by the order in which the rule is written. Thus, a rule that appears at the top of the ingress rules would take the highest precedence. ANPs with no ingress rules do not affect ingress traffic.

    Support: Core

    egress
    []AdminNetworkPolicyEgressRule
    (Optional)

    Egress is the list of Egress rules to be applied to the selected pods. A total of 100 rules will be allowed in each ANP instance. The relative precedence of egress rules within a single ANP object (all of which share the priority) will be determined by the order in which the rule is written. Thus, a rule that appears at the top of the egress rules would take the highest precedence. ANPs with no egress rules do not affect egress traffic.

    Support: Core

    status
    AdminNetworkPolicyStatus
    (Optional)

    Status is the status to be reported by the implementation.

    AdminNetworkPolicyEgressPeer

    (Appears on: AdminNetworkPolicyEgressRule)

    AdminNetworkPolicyEgressPeer defines a peer to allow traffic to. Exactly one of the selector pointers must be set for a given peer. If a consumer observes none of its fields are set, they must assume an unknown option has been specified and fail closed.

    Field Description
    namespaces
    Kubernetes meta/v1.LabelSelector
    (Optional)

    Namespaces defines a way to select all pods within a set of Namespaces. Note that host-networked pods are not included in this type of peer.

    Support: Core

    pods
    NamespacedPod
    (Optional)

    Pods defines a way to select a set of pods in a set of namespaces. Note that host-networked pods are not included in this type of peer.

    Support: Core

    nodes
    Kubernetes meta/v1.LabelSelector
    (Optional)

    Nodes defines a way to select a set of nodes in the cluster. This field follows standard label selector semantics; if present but empty, it selects all Nodes.

    Support: Extended

    network-policy-api:experimental

    networks
    []CIDR
    (Optional)

    Networks defines a way to select peers via CIDR blocks. This is intended for representing entities that live outside the cluster, which can’t be selected by pods, namespaces and nodes peers, but note that cluster-internal traffic will be checked against the rule as well. So if you Allow or Deny traffic to "0.0.0.0/0", that will allow or deny all IPv4 pod-to-pod traffic as well. If you don’t want that, add a rule that Passes all pod traffic before the Networks rule.

    Each item in Networks should be provided in the CIDR format and should be IPv4 or IPv6, for example “10.0.0.0/8” or “fd00::/8”.

    Networks can have upto 25 CIDRs specified.

    Support: Extended

    network-policy-api:experimental

    domainNames
    []DomainName
    (Optional)

    DomainNames provides a way to specify domain names as peers.

    DomainNames is only supported for ALLOW rules. In order to control access, DomainNames ALLOW rules should be used with a lower priority egress deny – this allows the admin to maintain an explicit “allowlist” of reachable domains.

    DomainNames can have up to 25 domain names specified in one rule.

    Support: Extended

    network-policy-api:experimental

    AdminNetworkPolicyEgressRule

    (Appears on: AdminNetworkPolicySpec)

    AdminNetworkPolicyEgressRule describes an action to take on a particular set of traffic originating from pods selected by a AdminNetworkPolicy’s Subject field. network-policy-api:experimental:validation

    Field Description
    name
    string
    (Optional)

    Name is an identifier for this rule, that may be no more than 100 characters in length. This field should be used by the implementation to help improve observability, readability and error-reporting for any applied AdminNetworkPolicies.

    Support: Core

    action
    AdminNetworkPolicyRuleAction

    Action specifies the effect this rule will have on matching traffic. Currently the following actions are supported: Allow: allows the selected traffic (even if it would otherwise have been denied by NetworkPolicy) Deny: denies the selected traffic Pass: instructs the selected traffic to skip any remaining ANP rules, and then pass execution to any NetworkPolicies that select the pod. If the pod is not selected by any NetworkPolicies then execution is passed to any BaselineAdminNetworkPolicies that select the pod.

    Support: Core

    to
    []AdminNetworkPolicyEgressPeer

    To is the List of destinations whose traffic this rule applies to. If any AdminNetworkPolicyEgressPeer matches the destination of outgoing traffic then the specified action is applied. This field must be defined and contain at least one item.

    Support: Core

    ports
    []sigs.k8s.io/network-policy-api/apis/v1alpha1.AdminNetworkPolicyPort
    (Optional)

    Ports allows for matching traffic based on port and protocols. This field is a list of destination ports for the outgoing egress traffic. If Ports is not set then the rule does not filter traffic via port.

    Support: Core

    AdminNetworkPolicyIngressPeer

    (Appears on: AdminNetworkPolicyIngressRule, BaselineAdminNetworkPolicyIngressRule)

    AdminNetworkPolicyIngressPeer defines an in-cluster peer to allow traffic from. Exactly one of the selector pointers must be set for a given peer. If a consumer observes none of its fields are set, they must assume an unknown option has been specified and fail closed.

    Field Description
    namespaces
    Kubernetes meta/v1.LabelSelector
    (Optional)

    Namespaces defines a way to select all pods within a set of Namespaces. Note that host-networked pods are not included in this type of peer.

    Support: Core

    pods
    NamespacedPod
    (Optional)

    Pods defines a way to select a set of pods in a set of namespaces. Note that host-networked pods are not included in this type of peer.

    Support: Core

    AdminNetworkPolicyIngressRule

    (Appears on: AdminNetworkPolicySpec)

    AdminNetworkPolicyIngressRule describes an action to take on a particular set of traffic destined for pods selected by an AdminNetworkPolicy’s Subject field.

    Field Description
    name
    string
    (Optional)

    Name is an identifier for this rule, that may be no more than 100 characters in length. This field should be used by the implementation to help improve observability, readability and error-reporting for any applied AdminNetworkPolicies.

    Support: Core

    action
    AdminNetworkPolicyRuleAction

    Action specifies the effect this rule will have on matching traffic. Currently the following actions are supported: Allow: allows the selected traffic (even if it would otherwise have been denied by NetworkPolicy) Deny: denies the selected traffic Pass: instructs the selected traffic to skip any remaining ANP rules, and then pass execution to any NetworkPolicies that select the pod. If the pod is not selected by any NetworkPolicies then execution is passed to any BaselineAdminNetworkPolicies that select the pod.

    Support: Core

    from
    []AdminNetworkPolicyIngressPeer

    From is the list of sources whose traffic this rule applies to. If any AdminNetworkPolicyIngressPeer matches the source of incoming traffic then the specified action is applied. This field must be defined and contain at least one item.

    Support: Core

    ports
    []sigs.k8s.io/network-policy-api/apis/v1alpha1.AdminNetworkPolicyPort
    (Optional)

    Ports allows for matching traffic based on port and protocols. This field is a list of ports which should be matched on the pods selected for this policy i.e the subject of the policy. So it matches on the destination port for the ingress traffic. If Ports is not set then the rule does not filter traffic via port.

    Support: Core

    AdminNetworkPolicyPort

    AdminNetworkPolicyPort describes how to select network ports on pod(s). Exactly one field must be set.

    Field Description
    portNumber
    Port
    (Optional)

    Port selects a port on a pod(s) based on number.

    Support: Core

    namedPort
    string
    (Optional)

    NamedPort selects a port on a pod(s) based on name.

    Support: Extended

    network-policy-api:experimental

    portRange
    PortRange
    (Optional)

    PortRange selects a port range on a pod(s) based on provided start and end values.

    Support: Core

    AdminNetworkPolicyRuleAction (string alias)

    (Appears on: AdminNetworkPolicyEgressRule, AdminNetworkPolicyIngressRule)

    AdminNetworkPolicyRuleAction string describes the AdminNetworkPolicy action type.

    Support: Core

    Value Description

    "Allow"

    AdminNetworkPolicyRuleActionAllow indicates that matching traffic will be allowed regardless of NetworkPolicy and BaselineAdminNetworkPolicy rules. Users cannot block traffic which has been matched by an “Allow” rule in an AdminNetworkPolicy.

    "Deny"

    AdminNetworkPolicyRuleActionDeny indicates that matching traffic will be denied before being checked against NetworkPolicy or BaselineAdminNetworkPolicy rules. Pods will never receive traffic which has been matched by a “Deny” rule in an AdminNetworkPolicy.

    "Pass"

    AdminNetworkPolicyRuleActionPass indicates that matching traffic will bypass further AdminNetworkPolicy processing (ignoring rules with lower precedence) and be allowed or denied based on NetworkPolicy and BaselineAdminNetworkPolicy rules.

    AdminNetworkPolicySpec

    (Appears on: AdminNetworkPolicy)

    AdminNetworkPolicySpec defines the desired state of AdminNetworkPolicy.

    Field Description
    priority
    int32

    Priority is a value from 0 to 1000. Policies with lower priority values have higher precedence, and are checked before policies with higher priority values. All AdminNetworkPolicy rules have higher precedence than NetworkPolicy or BaselineAdminNetworkPolicy rules Every AdminNetworkPolicy should have a unique priority value; if two (or more) policies with the same priority could both match a connection, then the implementation can apply any of the matching policies to the connection, and there is no way for the user to reliably determine which one it will choose.

    Support: Core

    subject
    AdminNetworkPolicySubject

    Subject defines the pods to which this AdminNetworkPolicy applies. Note that host-networked pods are not included in subject selection.

    Support: Core

    ingress
    []AdminNetworkPolicyIngressRule
    (Optional)

    Ingress is the list of Ingress rules to be applied to the selected pods. A total of 100 rules will be allowed in each ANP instance. The relative precedence of ingress rules within a single ANP object (all of which share the priority) will be determined by the order in which the rule is written. Thus, a rule that appears at the top of the ingress rules would take the highest precedence. ANPs with no ingress rules do not affect ingress traffic.

    Support: Core

    egress
    []AdminNetworkPolicyEgressRule
    (Optional)

    Egress is the list of Egress rules to be applied to the selected pods. A total of 100 rules will be allowed in each ANP instance. The relative precedence of egress rules within a single ANP object (all of which share the priority) will be determined by the order in which the rule is written. Thus, a rule that appears at the top of the egress rules would take the highest precedence. ANPs with no egress rules do not affect egress traffic.

    Support: Core

    AdminNetworkPolicyStatus

    (Appears on: AdminNetworkPolicy)

    AdminNetworkPolicyStatus defines the observed state of AdminNetworkPolicy.

    Field Description
    conditions
    []Kubernetes meta/v1.Condition

    AdminNetworkPolicySubject

    (Appears on: AdminNetworkPolicySpec, BaselineAdminNetworkPolicySpec)

    AdminNetworkPolicySubject defines what resources the policy applies to. Exactly one field must be set.

    Field Description
    namespaces
    Kubernetes meta/v1.LabelSelector
    (Optional)

    Namespaces is used to select pods via namespace selectors.

    pods
    NamespacedPod
    (Optional)

    Pods is used to select pods via namespace AND pod selectors.

    BaselineAdminNetworkPolicy

    BaselineAdminNetworkPolicy is a cluster level resource that is part of the AdminNetworkPolicy API.

    Field Description
    metadata
    Kubernetes meta/v1.ObjectMeta
    Refer to the Kubernetes API documentation for the fields of the metadata field.
    spec
    BaselineAdminNetworkPolicySpec

    Specification of the desired behavior of BaselineAdminNetworkPolicy.



    subject
    AdminNetworkPolicySubject

    Subject defines the pods to which this BaselineAdminNetworkPolicy applies. Note that host-networked pods are not included in subject selection.

    Support: Core

    ingress
    []BaselineAdminNetworkPolicyIngressRule
    (Optional)

    Ingress is the list of Ingress rules to be applied to the selected pods if they are not matched by any AdminNetworkPolicy or NetworkPolicy rules. A total of 100 Ingress rules will be allowed in each BANP instance. The relative precedence of ingress rules within a single BANP object will be determined by the order in which the rule is written. Thus, a rule that appears at the top of the ingress rules would take the highest precedence. BANPs with no ingress rules do not affect ingress traffic.

    Support: Core

    egress
    []BaselineAdminNetworkPolicyEgressRule
    (Optional)

    Egress is the list of Egress rules to be applied to the selected pods if they are not matched by any AdminNetworkPolicy or NetworkPolicy rules. A total of 100 Egress rules will be allowed in each BANP instance. The relative precedence of egress rules within a single BANP object will be determined by the order in which the rule is written. Thus, a rule that appears at the top of the egress rules would take the highest precedence. BANPs with no egress rules do not affect egress traffic.

    Support: Core

    status
    BaselineAdminNetworkPolicyStatus
    (Optional)

    Status is the status to be reported by the implementation.

    BaselineAdminNetworkPolicyEgressPeer

    (Appears on: BaselineAdminNetworkPolicyEgressRule)

    BaselineAdminNetworkPolicyEgressPeer defines a peer to allow traffic to. Exactly one of the selector pointers must be set for a given peer. If a consumer observes none of its fields are set, they must assume an unknown option has been specified and fail closed.

    Field Description
    namespaces
    Kubernetes meta/v1.LabelSelector
    (Optional)

    Namespaces defines a way to select all pods within a set of Namespaces. Note that host-networked pods are not included in this type of peer.

    Support: Core

    pods
    NamespacedPod
    (Optional)

    Pods defines a way to select a set of pods in a set of namespaces. Note that host-networked pods are not included in this type of peer.

    Support: Core

    nodes
    Kubernetes meta/v1.LabelSelector
    (Optional)

    Nodes defines a way to select a set of nodes in the cluster. This field follows standard label selector semantics; if present but empty, it selects all Nodes.

    Support: Extended

    network-policy-api:experimental

    networks
    []CIDR
    (Optional)

    Networks defines a way to select peers via CIDR blocks. This is intended for representing entities that live outside the cluster, which can’t be selected by pods, namespaces and nodes peers, but note that cluster-internal traffic will be checked against the rule as well. So if you Allow or Deny traffic to "0.0.0.0/0", that will allow or deny all IPv4 pod-to-pod traffic as well. If you don’t want that, add a rule that Passes all pod traffic before the Networks rule.

    Each item in Networks should be provided in the CIDR format and should be IPv4 or IPv6, for example “10.0.0.0/8” or “fd00::/8”.

    Networks can have upto 25 CIDRs specified.

    Support: Extended

    network-policy-api:experimental

    BaselineAdminNetworkPolicyEgressRule

    (Appears on: BaselineAdminNetworkPolicySpec)

    BaselineAdminNetworkPolicyEgressRule describes an action to take on a particular set of traffic originating from pods selected by a BaselineAdminNetworkPolicy’s Subject field. network-policy-api:experimental:validation

    Field Description
    name
    string
    (Optional)

    Name is an identifier for this rule, that may be no more than 100 characters in length. This field should be used by the implementation to help improve observability, readability and error-reporting for any applied BaselineAdminNetworkPolicies.

    Support: Core

    action
    BaselineAdminNetworkPolicyRuleAction

    Action specifies the effect this rule will have on matching traffic. Currently the following actions are supported: Allow: allows the selected traffic Deny: denies the selected traffic

    Support: Core

    to
    []BaselineAdminNetworkPolicyEgressPeer

    To is the list of destinations whose traffic this rule applies to. If any BaselineAdminNetworkPolicyEgressPeer matches the destination of outgoing traffic then the specified action is applied. This field must be defined and contain at least one item.

    Support: Core

    ports
    []sigs.k8s.io/network-policy-api/apis/v1alpha1.AdminNetworkPolicyPort
    (Optional)

    Ports allows for matching traffic based on port and protocols. This field is a list of destination ports for the outgoing egress traffic. If Ports is not set then the rule does not filter traffic via port.

    BaselineAdminNetworkPolicyIngressRule

    (Appears on: BaselineAdminNetworkPolicySpec)

    BaselineAdminNetworkPolicyIngressRule describes an action to take on a particular set of traffic destined for pods selected by a BaselineAdminNetworkPolicy’s Subject field.

    Field Description
    name
    string
    (Optional)

    Name is an identifier for this rule, that may be no more than 100 characters in length. This field should be used by the implementation to help improve observability, readability and error-reporting for any applied BaselineAdminNetworkPolicies.

    Support: Core

    action
    BaselineAdminNetworkPolicyRuleAction

    Action specifies the effect this rule will have on matching traffic. Currently the following actions are supported: Allow: allows the selected traffic Deny: denies the selected traffic

    Support: Core

    from
    []AdminNetworkPolicyIngressPeer

    From is the list of sources whose traffic this rule applies to. If any AdminNetworkPolicyIngressPeer matches the source of incoming traffic then the specified action is applied. This field must be defined and contain at least one item.

    Support: Core

    ports
    []sigs.k8s.io/network-policy-api/apis/v1alpha1.AdminNetworkPolicyPort
    (Optional)

    Ports allows for matching traffic based on port and protocols. This field is a list of ports which should be matched on the pods selected for this policy i.e the subject of the policy. So it matches on the destination port for the ingress traffic. If Ports is not set then the rule does not filter traffic via port.

    Support: Core

    BaselineAdminNetworkPolicyRuleAction (string alias)

    (Appears on: BaselineAdminNetworkPolicyEgressRule, BaselineAdminNetworkPolicyIngressRule)

    BaselineAdminNetworkPolicyRuleAction string describes the BaselineAdminNetworkPolicy action type.

    Support: Core

    Value Description

    "Allow"

    BaselineAdminNetworkPolicyRuleActionAllow enables admins to allow certain traffic.

    "Deny"

    BaselineAdminNetworkPolicyRuleActionDeny enables admins to deny traffic.

    BaselineAdminNetworkPolicySpec

    (Appears on: BaselineAdminNetworkPolicy)

    BaselineAdminNetworkPolicySpec defines the desired state of BaselineAdminNetworkPolicy.

    Field Description
    subject
    AdminNetworkPolicySubject

    Subject defines the pods to which this BaselineAdminNetworkPolicy applies. Note that host-networked pods are not included in subject selection.

    Support: Core

    ingress
    []BaselineAdminNetworkPolicyIngressRule
    (Optional)

    Ingress is the list of Ingress rules to be applied to the selected pods if they are not matched by any AdminNetworkPolicy or NetworkPolicy rules. A total of 100 Ingress rules will be allowed in each BANP instance. The relative precedence of ingress rules within a single BANP object will be determined by the order in which the rule is written. Thus, a rule that appears at the top of the ingress rules would take the highest precedence. BANPs with no ingress rules do not affect ingress traffic.

    Support: Core

    egress
    []BaselineAdminNetworkPolicyEgressRule
    (Optional)

    Egress is the list of Egress rules to be applied to the selected pods if they are not matched by any AdminNetworkPolicy or NetworkPolicy rules. A total of 100 Egress rules will be allowed in each BANP instance. The relative precedence of egress rules within a single BANP object will be determined by the order in which the rule is written. Thus, a rule that appears at the top of the egress rules would take the highest precedence. BANPs with no egress rules do not affect egress traffic.

    Support: Core

    BaselineAdminNetworkPolicyStatus

    (Appears on: BaselineAdminNetworkPolicy)

    BaselineAdminNetworkPolicyStatus defines the observed state of BaselineAdminNetworkPolicy.

    Field Description
    conditions
    []Kubernetes meta/v1.Condition

    CIDR (string alias)

    (Appears on: AdminNetworkPolicyEgressPeer, BaselineAdminNetworkPolicyEgressPeer)

    CIDR is an IP address range in CIDR notation (for example, “10.0.0.0/8” or “fd00::/8”). This string must be validated by implementations using net.ParseCIDR TODO: Introduce CEL CIDR validation regex isCIDR() in Kube 1.31 when it is available.

    DomainName (string alias)

    (Appears on: AdminNetworkPolicyEgressPeer)

    DomainName describes one or more domain names to be used as a peer.

    DomainName can be an exact match, or use the wildcard specifier ‘*’ to match one or more labels.

    ’, the wildcard specifier, matches one or more entire labels. It does not support partial matches. ‘’ may only be specified as a prefix.

    Examples: - kubernetes.io matches only kubernetes.io. It does not match “www.kubernetes.io”, “blog.kubernetes.io”, “my-kubernetes.io”, or “wikipedia.org”. - blog.kubernetes.io matches only “blog.kubernetes.io”. It does not match “www.kubernetes.io” or “kubernetes.io”. - *.kubernetes.io matches subdomains of kubernetes.io. “www.kubernetes.io”, “blog.kubernetes.io”, and “latest.blog.kubernetes.io” match, however “kubernetes.io”, and “wikipedia.org” do not.

    NamespacedPod

    (Appears on: AdminNetworkPolicyEgressPeer, AdminNetworkPolicyIngressPeer, AdminNetworkPolicySubject, BaselineAdminNetworkPolicyEgressPeer)

    NamespacedPod allows the user to select a given set of pod(s) in selected namespace(s).

    Field Description
    namespaceSelector
    Kubernetes meta/v1.LabelSelector

    NamespaceSelector follows standard label selector semantics; if empty, it selects all Namespaces.

    podSelector
    Kubernetes meta/v1.LabelSelector

    PodSelector is used to explicitly select pods within a namespace; if empty, it selects all Pods.

    Port

    (Appears on: AdminNetworkPolicyPort)

    Field Description
    protocol
    Kubernetes core/v1.Protocol

    Protocol is the network protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP.

    Support: Core

    port
    int32

    Number defines a network port value.

    Support: Core

    PortRange

    (Appears on: AdminNetworkPolicyPort)

    PortRange defines an inclusive range of ports from the the assigned Start value to End value.

    Field Description
    protocol
    Kubernetes core/v1.Protocol

    Protocol is the network protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP.

    Support: Core

    start
    int32

    Start defines a network port that is the start of a port range, the Start value must be less than End.

    Support: Core

    end
    int32

    End defines a network port that is the end of a port range, the End value must be greater than Start.

    Support: Core


    Generated with gen-crd-api-reference-docs.