⎈ k8s knowledge compiler

NetworkPolicy [page]deterministic

NetworkPolicy describes what network traffic is allowed for a set of Pods

referencenetworkingsecurity

`apiVersion: networking.k8s.io/v1`

`import "k8s.io/api/networking/v1"`

## NetworkPolicy {#NetworkPolicy}

NetworkPolicy describes what network traffic is allowed for a set of Pods

<hr>

<table> <thead><tr><th>Field</th><th>Description</th></tr></thead> <tbody> <tr> <td><code>apiVersion</code><br/><em>string</em></td> <td>APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources</td> </tr> <tr> <td><code>kind</code><br/><em>string</em></td> <td>Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds</td> </tr> <tr> <td><code>metadata</code><br/><em><a href="">ObjectMeta</a></em></td> <td>Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata</td> </tr> <tr> <td><code>spec</code><br/><em><a href="">NetworkPolicySpec</a></em></td> <td>spec represents the specification of the desired behavior for this NetworkPolicy.</td> </tr> </tbody> </table>

## NetworkPolicySpec {#NetworkPolicySpec}

NetworkPolicySpec provides the specification of a NetworkPolicy

<hr>

<table> <thead><tr><th>Field</th><th>Description</th></tr></thead> <tbody> <tr> <td><code>egress</code><br/><em><a href="">NetworkPolicyEgressRule array</a></em></td> <td>egress is a list of egress rules to be applied to the selected pods. Outgoing traffic is allowed if there are no NetworkPolicies selecting the pod (and cluster policy otherwise allows the traffic), OR if the traffic matches at least one egress rule across all of the NetworkPolicy objects whose podSelector matches the pod. If this field is empty then this NetworkPolicy limits all outgoing traffic (and serves solely to ensure that the pods it selects are isolated by default). This field is beta-level in 1.8</td> </tr> <tr> <td><code>ingress</code><br/><em><a href="">NetworkPolicyIngressRule array</a></em></td> <td>ingress is a list of ingress rules to be applied to the selected pods. Traffic is allowed to a pod if there are no NetworkPolicies selecting the pod (and cluster policy otherwise allows the traffic), OR if the traffic source is the pod's local node, OR if the traffic matches at least one ingress rule across all of the NetworkPolicy objects whose podSelector matches the pod. If this field is empty then this NetworkPolicy does not allow any traffic (and serves solely to ensure that the pods it selects are isolated by default)</td> </tr> <tr> <td><code>podSelector</code><br/><em><a href="">LabelSelector</a></em></td> <td>podSelector selects the pods to which this NetworkPolicy object applies. The array of rules is applied to any pods selected by this field. An empty selector matches all pods in the policy's namespace. Multiple network policies can select the same set of pods. In this case, the ingress rules for each are combined additively. This field is optional. If it is not specified, it defaults to an empty selector.</td> </tr> <tr> <td><code>policyTypes</code><br/><em>string array</em></td> <td>policyTypes is a list of rule types that the NetworkPolicy relates to. Valid options are ["Ingress"], ["Egress"], or ["Ingress", "Egress"]. If this field is not specified, it will default based on the existence of ingress or egress rules; policies that contain an egress section are assumed to affect egress, and all policies (whether or not they contain an ingress section) are assumed to affect ingress. If y …(trimmed)

Sources

reference/kubernetes-api/networking/network-policy-v1.md · docNetworkPolicy

Related (21)

part_of NetworkPolicy {#NetworkPolicy}describes conf=1
part_of NetworkPolicySpec {#NetworkPolicySpec}describes conf=1
part_of NetworkPolicyList {#NetworkPolicyList}describes conf=1
part_of IPBlock {#IPBlock}describes conf=1
part_of NetworkPolicyPeer {#NetworkPolicyPeer}describes conf=1
part_of NetworkPolicyPort {#NetworkPolicyPort}describes conf=1
part_of Operations {#Operations}describes conf=1
part_of `post` Createdescribes conf=1
part_of `patch` Patchdescribes conf=1
part_of `put` Replacedescribes conf=1
part_of `delete` Deletedescribes conf=1
part_of `delete` Delete Collectiondescribes conf=1
part_of `get` Readdescribes conf=1
part_of `get` Listdescribes conf=1
part_of `get` List All Namespacesdescribes conf=1
part_of `get` Watchdescribes conf=1
part_of `get` Watch Listdescribes conf=1
part_of `get` Watch List All Namespacesdescribes conf=1
api_for NetworkPolicydocuments API object conf=1

← all Docs