File tree Expand file tree Collapse file tree 3 files changed +38
-36
lines changed
docs/concepts/services-networking Expand file tree Collapse file tree 3 files changed +38
-36
lines changed Original file line number Diff line number Diff line change @@ -45,42 +45,7 @@ See the [NetworkPolicy](/docs/reference/generated/kubernetes-api/{{< param "vers
45
45
46
46
An example NetworkPolicy might look like this:
47
47
48
- ``` yaml
49
- apiVersion : networking.k8s.io/v1
50
- kind : NetworkPolicy
51
- metadata :
52
- name : test-network-policy
53
- namespace : default
54
- spec :
55
- podSelector :
56
- matchLabels :
57
- role : db
58
- policyTypes :
59
- - Ingress
60
- - Egress
61
- ingress :
62
- - from :
63
- - ipBlock :
64
- cidr : 172.17.0.0/16
65
- except :
66
- - 172.17.1.0/24
67
- - namespaceSelector :
68
- matchLabels :
69
- project : myproject
70
- - podSelector :
71
- matchLabels :
72
- role : frontend
73
- ports :
74
- - protocol : TCP
75
- port : 6379
76
- egress :
77
- - to :
78
- - ipBlock :
79
- cidr : 10.0.0.0/24
80
- ports :
81
- - protocol : TCP
82
- port : 5978
83
- ` ` `
48
+ {{< codenew file="service/networking/networkpolicy.yaml" >}}
84
49
85
50
{{< note >}}
86
51
POSTing this to the API server for your cluster will have no effect unless your chosen networking solution supports network policy.
Original file line number Diff line number Diff line change @@ -647,6 +647,7 @@ func TestExampleObjectSchemas(t *testing.T) {
647
647
"service/networking" : {
648
648
"curlpod" : {& apps.Deployment {}},
649
649
"custom-dns" : {& api.Pod {}},
650
+ "default-ingressclass" : {& networking.IngressClass {}},
650
651
"dual-stack-default-svc" : {& api.Service {}},
651
652
"dual-stack-ipfamilies-ipv6" : {& api.Service {}},
652
653
"dual-stack-ipv6-svc" : {& api.Service {}},
@@ -662,6 +663,7 @@ func TestExampleObjectSchemas(t *testing.T) {
662
663
"name-virtual-host-ingress" : {& networking.Ingress {}},
663
664
"name-virtual-host-ingress-no-third-host" : {& networking.Ingress {}},
664
665
"namespaced-params" : {& networking.IngressClass {}},
666
+ "networkpolicy" : {& networking.NetworkPolicy {}},
665
667
"network-policy-allow-all-egress" : {& networking.NetworkPolicy {}},
666
668
"network-policy-allow-all-ingress" : {& networking.NetworkPolicy {}},
667
669
"network-policy-default-deny-egress" : {& networking.NetworkPolicy {}},
Original file line number Diff line number Diff line change
1
+ apiVersion : networking.k8s.io/v1
2
+ kind : NetworkPolicy
3
+ metadata :
4
+ name : test-network-policy
5
+ namespace : default
6
+ spec :
7
+ podSelector :
8
+ matchLabels :
9
+ role : db
10
+ policyTypes :
11
+ - Ingress
12
+ - Egress
13
+ ingress :
14
+ - from :
15
+ - ipBlock :
16
+ cidr : 172.17.0.0/16
17
+ except :
18
+ - 172.17.1.0/24
19
+ - namespaceSelector :
20
+ matchLabels :
21
+ project : myproject
22
+ - podSelector :
23
+ matchLabels :
24
+ role : frontend
25
+ ports :
26
+ - protocol : TCP
27
+ port : 6379
28
+ egress :
29
+ - to :
30
+ - ipBlock :
31
+ cidr : 10.0.0.0/24
32
+ ports :
33
+ - protocol : TCP
34
+ port : 5978
35
+
You can’t perform that action at this time.
0 commit comments