File tree Expand file tree Collapse file tree 2 files changed +36
-36
lines changed
docs/concepts/services-networking
examples/service/networking Expand file tree Collapse file tree 2 files changed +36
-36
lines changed Original file line number Diff line number Diff line change @@ -121,42 +121,7 @@ An example NetworkPolicy might look like this:
121
121
122
122
下面是一个 NetworkPolicy 的示例:
123
123
124
- ``` yaml
125
- apiVersion : networking.k8s.io/v1
126
- kind : NetworkPolicy
127
- metadata :
128
- name : test-network-policy
129
- namespace : default
130
- spec :
131
- podSelector :
132
- matchLabels :
133
- role : db
134
- policyTypes :
135
- - Ingress
136
- - Egress
137
- ingress :
138
- - from :
139
- - ipBlock :
140
- cidr : 172.17.0.0/16
141
- except :
142
- - 172.17.1.0/24
143
- - namespaceSelector :
144
- matchLabels :
145
- project : myproject
146
- - podSelector :
147
- matchLabels :
148
- role : frontend
149
- ports :
150
- - protocol : TCP
151
- port : 6379
152
- egress :
153
- - to :
154
- - ipBlock :
155
- cidr : 10.0.0.0/24
156
- ports :
157
- - protocol : TCP
158
- port : 5978
159
- ` ` `
124
+ {{< codenew file="service/networking/networkpolicy.yaml" >}}
160
125
161
126
<!--
162
127
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
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