networking.k8s.io/v1 · Namespaced Resource
NetworkPolicy
NetworkPolicy describes what network traffic is allowed for a set of Pods
Click on Property Name to see the description, and Pink Types to expand schema.
Looking for some examples?
There are 6 examples of NetworkPolicy that you can use as a starting point to create your own.
apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: default-deny-ingress namespace: public-api # NetworkPolicy is namespaced resource spec: podSelector: {} policyTypes: - Ingress
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-all-ingress
namespace: public-api # NetworkPolicy is namespaced resource
spec:
podSelector: {}
ingress:
- {}
policyTypes:
- Ingress
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: default-deny-egress
namespace: public-api # NetworkPolicy is namespaced resource
spec:
podSelector: {}
policyTypes:
- Egress
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-all-egress
namespace: public-api # NetworkPolicy is namespaced resource
spec:
podSelector: {}
egress:
- {}
policyTypes:
- Egress
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: default-deny-all
namespace: public-api # NetworkPolicy is namespaced resource
spec:
podSelector: {}
policyTypes:
- Ingress
- Egress
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: test-network-policy
namespace: public-api # NetworkPolicy is namespaced resource
spec:
podSelector:
matchLabels:
role: db
policyTypes:
- Ingress
- Egress
ingress:
- from:
- ipBlock:
cidr: 172.17.0.0/16
except:
- 172.17.1.0/24
- namespaceSelector:
matchLabels:
project: myproject
- podSelector:
matchLabels:
role: frontend
ports:
- protocol: TCP
port: 6379
egress:
- to:
- ipBlock:
cidr: 10.0.0.0/24
ports:
- protocol: TCP
port: 5978
No links for NetworkPolicy yet
You can help us by adding useful links on GitHub