kubectl api-versions
命令查看当前资源对象的 apiVersion。 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 | 是否支持 |
should support a 'default-deny' policy | 支持 |
should enforce policy to allow traffic from pods within server namespace based on PodSelector | 支持 |
should enforce policy to allow traffic only from a different namespace, based on NamespaceSelector | 支持 |
should enforce policy based on PodSelector with MatchExpressions | 支持 |
should enforce policy based on NamespaceSelector with MatchExpressions | 支持 |
should enforce policy based on PodSelector or NamespaceSelector | 支持 |
should enforce policy based on PodSelector and NamespaceSelector | 支持 |
should enforce policy to allow traffic only from a pod in a different namespace based on PodSelector and NamespaceSelector | 支持 |
should enforce policy based on Ports | 支持 |
should enforce multiple, stacked policies with overlapping podSelectors | 支持 |
should support allow-all policy | 支持 |
should allow ingress access on one named port | 支持 |
should allow ingress access from namespace on one named port | 支持 |
should allow egress access on one named port | 不支持 |
should enforce updated policy | 支持 |
should allow ingress access from updated namespace | 支持 |
should allow ingress access from updated pod | 支持 |
should deny ingress access to updated pod | 支持 |
should enforce egress policy allowing traffic to a server in a different namespace based on PodSelector and NamespaceSelector | 支持 |
should enforce multiple ingress policies with ingress allow-all policy taking precedence | 支持 |
should enforce multiple egress policies with egress allow-all policy taking precedence | 支持 |
should stop enforcing policies after they are deleted | 支持 |
should allow egress access to server in CIDR block | 支持 |
should enforce except clause while egress access to server in CIDR block | 支持 |
should enforce policies to check ingress and egress policies can be controlled independently based on PodSelector | 支持 |
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
本页内容是否解决了您的问题?