kubectl api-versions to view the apiVersion of the current resource object. apiVersion: networking.k8s.io/v1kind: NetworkPolicymetadata:name: npanamespace: nsaspec:ingress:- from:- podSelector: {}podSelector: {}policyTypes:- Ingress
apiVersion: networking.k8s.io/v1kind: NetworkPolicymetadata:name: npanamespace: nsaspec:podSelector: {}policyTypes:- Ingress
apiVersion: networking.k8s.io/v1kind: NetworkPolicymetadata:name: npanamespace: nsaspec:ingress:- from:- namespaceSelector:matchLabels:app: nsbports:- protocol: TCPport: 6379podSelector: {}policyTypes:- Ingress
apiVersion: networking.k8s.io/v1kind: NetworkPolicymetadata:name: npanamespace: nsaspec:egress:- to:- ipBlock:cidr: 14.215.0.0/16ports:- protocol: TCPport: 5978podSelector: {}policyTypes:- Egress
apiVersion: networking.k8s.io/v1kind: NetworkPolicymetadata:name: npdnamespace: defaultspec:ingress:- from:- ipBlock:cidr: 14.215.0.0/16ports:- protocol: TCPport: 80podSelector: {}policyTypes:- Ingress
NetworkPolicy Feature | Supported |
should support a default-deny policy | Yes |
should enforce policy to allow traffic from pods within server namespace based on PodSelector | Yes |
should enforce policy to allow traffic only from a different namespace, based on NamespaceSelector | Yes |
should enforce policy based on PodSelector with MatchExpressions | Yes |
should enforce policy based on NamespaceSelector with MatchExpressions | Yes |
should enforce policy based on PodSelector or NamespaceSelector | Yes |
should enforce policy based on PodSelector and NamespaceSelector | Yes |
should enforce policy to allow traffic only from a pod in a different namespace based on PodSelector and NamespaceSelector | Yes |
should enforce policy based on Ports | Yes |
should enforce multiple, stacked policies with overlapping podSelectors | Yes |
should support allow-all policy | Yes |
should allow ingress access on one named port | Yes |
should allow ingress access from namespace on one named port | Yes |
should allow egress access on one named port | No |
should enforce updated policy | Yes |
should allow ingress access from updated namespace | Yes |
should allow ingress access from updated pod | Yes |
should deny ingress access to updated pod | Yes |
should enforce egress policy allowing traffic to a server in a different namespace based on PodSelector and NamespaceSelector | Yes |
should enforce multiple ingress policies with ingress allow-all policy taking precedence | Yes |
should enforce multiple egress policies with egress allow-all policy taking precedence | Yes |
should stop enforcing policies after they are deleted | Yes |
should allow egress access to server in CIDR block | Yes |
should enforce except clause while egress access to server in CIDR block | Yes |
should enforce policies to check ingress and egress policies can be controlled independently based on PodSelector | Yes |
apiVersion: networking.k8s.io/v1kind: NetworkPolicymetadata:name: npdnamespace: defaultspec:ingress:- from:- ipBlock:cidr: 14.215.0.0/16ports:- protocol: TCPport: 9090- from:- ipBlock:cidr: 14.215.0.0/16ports:- protocol: TCPport: 8080- from:- ipBlock:cidr: 14.215.0.0/16ports:- protocol: TCPport: 80podSelector: {}policyTypes:- Ingress

Feedback