Skip to content

Commit a7ea4d5

Browse files
author
Steven Smith
committed
Updates egress netpol docs
1 parent a813968 commit a7ea4d5

17 files changed

+50
-55
lines changed

modules/nw-networkpolicy-allow-application-all-namespaces.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Follow this procedure to configure a policy that allows traffic from all pods in
2727

2828
.Prerequisites
2929
ifndef::microshift[]
30-
* Your cluster uses a network plugin that supports `NetworkPolicy` objects, such as the OVN-Kubernetes network plugin, with `mode: NetworkPolicy` set.
30+
* Your cluster uses a network plugin that supports `NetworkPolicy` objects, such as the OVN-Kubernetes network plugin.
3131
endif::microshift[]
3232
* You installed the OpenShift CLI (`oc`).
3333
ifndef::microshift[]

modules/nw-networkpolicy-allow-application-particular-namespace.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Follow this procedure to configure a policy that allows traffic to a pod with th
3030
3131
.Prerequisites
3232
ifndef::microshift[]
33-
* Your cluster uses a network plugin that supports `NetworkPolicy` objects, such as the OVN-Kubernetes network plugin, with `mode: NetworkPolicy` set.
33+
* Your cluster uses a network plugin that supports `NetworkPolicy` objects, such as the OVN-Kubernetes network plugin.
3434
endif::microshift[]
3535
* You installed the OpenShift CLI (`oc`).
3636
ifndef::microshift[]

modules/nw-networkpolicy-allow-external-clients.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Follow this procedure to configure a policy that allows external service from th
3434

3535
.Prerequisites
3636
ifndef::microshift[]
37-
* Your cluster uses a network plugin that supports `NetworkPolicy` objects, such as the OVN-Kubernetes network plugin, with `mode: NetworkPolicy` set.
37+
* Your cluster uses a network plugin that supports `NetworkPolicy` objects, such as the OVN-Kubernetes network plugin.
3838
endif::microshift[]
3939
* You installed the OpenShift CLI (`oc`).
4040
ifndef::microshift[]

modules/nw-networkpolicy-allow-internet.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
[id="nw-networkpolicy-allow-ingress_{context}"]
77
= Creating an allow ingress access network policy
88

9-
With the `deny-by-default` network policy in place, no pods can talk to each other or receive traffic from external sources. One option to enable communication is to allow some pods to receive traffic. To do so, you can create the following `ingress-access` network policy. With this network policy, pods with the `networking/allow-ingress-access=true` label can receive network traffic.
9+
With the `deny-by-default` network policy that denies both ingress and egress traffic in place, no pods can talk to each other or receive traffic from external sources. One option to enable communication is to allow some pods to receive traffic. To do so, you can create the following `ingress-access` network policy. With this network policy, pods with the `networking/allow-ingress-access=true` label can receive network traffic.
1010

1111
.Prerequisites
1212

13-
* You have created the `deny-by-default` network policy and applied it to the necessary namespaces.
13+
* You have created the `deny-by-default` network policy and applied it to the necessary namespaces. The policy denies ingress traffic to pods in the project.
1414
1515
.Procedure
1616

@@ -31,7 +31,7 @@ spec:
3131
ingress:
3232
- {}
3333
----
34-
<1> Apply this label to pods to enable the pod to receive traffic from outside sources.
34+
<1> Apply this label to pods to enable the pods to receive traffic from outside sources.
3535

3636
. Apply the network policy to the `project-a` namespace by entering the following command:
3737
+
@@ -74,11 +74,11 @@ busybox-pod-a 1/1 Running 0 13m 10.132.0.38 ip-10-0-132-187
7474
test-pod-a 1/1 Running 0 13m 10.132.0.40 ip-10-0-132-187.ec2.internal <none> <none>
7575
----
7676

77-
. Ensure that pods with the `networking/allow-ingress-access=true` label can receive traffic by entering the following command. If you followed these instructions, the `busybox-pod-a` pod in `project-a` can receive traffic from another pod. For example:
77+
. Ensure that pods with the `networking/allow-ingress-access=true` label can receive two ICMP packets by entering the following command. If you followed these instructions, the `busybox-pod-a` pod in `project-a` can receive traffic from another pod. For example:
7878
+
7979
[source,terminal]
8080
----
81-
$ oc exec -it test-pod-b -n project-b -- ping 10.132.0.44
81+
$ oc exec -it test-pod-b -n project-b -- ping -c 2 10.132.0.44
8282
----
8383
+
8484
.Example output
@@ -94,7 +94,7 @@ PING 10.132.0.44 (10.132.0.44): 56 data bytes
9494
+
9595
[source,terminal]
9696
----
97-
$ oc exec -it busybox-pod-a -n project-a -- ping 10.132.0.40
97+
$ oc exec -it busybox-pod-a -n project-a -- ping -c 2 10.132.0.40
9898
----
9999
+
100100
.Example output

modules/nw-networkpolicy-configuring-ingress-new-deployment.adoc

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,15 @@ kind: NetworkPolicy
5959
metadata:
6060
name: allow-ingress-from-new
6161
spec:
62-
podSelector: {}
63-
policyTypes:
64-
- Ingress
6562
ingress:
6663
- from:
67-
- podSelector:
64+
- namespaceSelector: {}
65+
podSelector:
6866
matchLabels:
6967
networking/allow-all-connections: "true"
68+
podSelector: {}
69+
policyTypes:
70+
- Ingress
7071
----
7172

7273
.. Apply the network policy by entering the following command:
@@ -83,23 +84,24 @@ $ oc apply -f allow-ingress-from-new.yaml -n project-a
8384
apiVersion: networking.k8s.io/v1
8485
kind: NetworkPolicy
8586
metadata:
86-
name: allow-ingress-to-new
87+
name: allow-ingress-from-new
8788
spec:
88-
podSelector:
89-
matchLabels:
90-
networking/allow-all-connections: "true"
91-
policyTypes:
92-
- Ingress
9389
ingress:
9490
- from:
95-
- podSelector: {}
91+
- namespaceSelector: {}
92+
podSelector:
93+
matchLabels:
94+
networking/allow-all-connections: "true"
95+
podSelector: {}
96+
policyTypes:
97+
- Ingress
9698
----
9799

98100
.. Apply the network policy by entering the following command:
99101
+
100102
[source,terminal]
101103
----
102-
$ oc apply -f allow-ingress-tp-new.yaml -n project-a
104+
$ oc apply -f allow-ingress-to-new.yaml -n project-a
103105
----
104106

105107
.. Apply the `networking/allow-all-connections=true` to pods in `project-a` that you want to be able to communicate with pods in `project-c` by running the following command:
@@ -160,7 +162,7 @@ spec:
160162
+
161163
[source,terminal]
162164
----
163-
$ oc apply -f allow-ingress-tp-new.yaml -n project-c
165+
$ oc apply -f allow-ingress-to-new.yaml -n project-c
164166
----
165167

166168
.. Apply the `networking/allow-all-connections=true` to pods in `project-c` that you want to be able to communicate with pods in `project-a` by running the following command:

modules/nw-networkpolicy-configuring-internet-egress-pods.adoc

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
// * networking/network_security/network_policy/nw-networkpolicy-full-multitenant-isolation.adoc
44

55
:_mod-docs-content-type: PROCEDURE
6-
[id="nw-networkpolicy-configuring-internet-egress-pods_{context}"]
7-
= Configuring internet egress for pods
6+
[id="nw-networkpolicy-configuring-external-egress-pods_{context}"]
7+
= Configuring external egress for pods
88

9-
With the deny all egress network policy created in a namespace, pods within that namespace are made incapable of reaching _out_ to the internet. In most cases, at least some pods within a namespace need to reach external traffic.
9+
With the deny all egress network policy created in a namespace, pods within that namespace are made incapable of reaching _out_ to the internet. In most cases, at least some pods within a namespace need to reach external destinations.
1010

1111
The following procedure shows you how to designate labels to pods that require internet egress.
1212

@@ -41,13 +41,6 @@ spec:
4141
$ oc apply -f internet-egress.yaml -n project-a
4242
----
4343

44-
. Apply the network policy to the `project-b` namespace by entering the following command:
45-
+
46-
[source,terminal]
47-
----
48-
$ oc apply -f internet-egress.yaml -n project-b
49-
----
50-
5144
. Apply the `networking/allow-internet-egress=true` label to pods that require egress by entering the following command:
5245
+
5346
[source,terminal]
@@ -61,7 +54,7 @@ $ oc label pod busybox-pod-a networking/allow-internet-egress=true -n project-a
6154
+
6255
[source,terminal]
6356
----
64-
$ oc exec -it <pod_name> -n project-a -- nslookup google.com
57+
$ oc exec -it busybox-pod-a -n project-a -- nslookup google.com
6558
----
6659
+
6760
.Example output

modules/nw-networkpolicy-create-cli.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ endif::multi,microshift[]
2828

2929
.Prerequisites
3030
ifndef::microshift[]
31-
* Your cluster uses a network plugin that supports `NetworkPolicy` objects, such as the OVN-Kubernetes network plugin, with `mode: NetworkPolicy` set.
31+
* Your cluster uses a network plugin that supports `NetworkPolicy` objects, such as the OVN-Kubernetes network plugin.
3232
endif::microshift[]
3333
* You installed the OpenShift CLI (`oc`).
3434
ifndef::microshift[]

modules/nw-networkpolicy-cross-namespace-communication.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,21 @@ $ oc apply -f allow-n1-a-to-n2-b.yaml -n project-b
5252
+
5353
[source,terminal]
5454
----
55-
$ oc label namespace project-a networking/namespace=n1 --overwrite
55+
$ oc label namespace project-a networking/namespace=n1
5656
----
5757

5858
. Label the `project-b` namespace with the `networking/namespace=n2` label by entering the following command:
5959
+
6060
[source,terminal]
6161
----
62-
$ oc label namespace project-b networking/namespace=n2 --overwrite
62+
$ oc label namespace project-b networking/namespace=n2
6363
----
6464

6565
. If it is not already labeled, label the `busybox-pod` in `project-a` with the `send-data` label by entering the following command:
6666
+
6767
[source,terminal]
6868
----
69-
$ oc label pod busybox-pod-a app=send-data -n project-a
69+
$ oc label pod busybox-pod-a app=send-data -n project-a --overwrite
7070
----
7171

7272
. If it is not already labeled, label the `test-pod` in `project-b` with the `receive-data` label by entering the following command:

modules/nw-networkpolicy-delete-cli.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ endif::multi,microshift[]
2727

2828
.Prerequisites
2929
ifndef::microshift[]
30-
* Your cluster uses a network plugin that supports `NetworkPolicy` objects, such as the OVN-Kubernetes network plugin, with `mode: NetworkPolicy` set.
30+
* Your cluster uses a network plugin that supports `NetworkPolicy` objects, such as the OVN-Kubernetes network plugin.
3131
endif::microshift[]
3232
* You installed the OpenShift CLI (`oc`).
3333
ifndef::microshift[]

modules/nw-networkpolicy-deny-all-allowed.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ This policy blocks all cross-pod networking other than network traffic allowed b
2121

2222
[WARNING]
2323
====
24-
Without configuring a `NetworkPolicy` custom resource (CR) that allows traffic communication, the following policy might cause communication problems across your cluster.
24+
Without configuring a network policy that allows traffic communication, the following policy might cause communication problems across your cluster.
2525
====
2626

2727
.Prerequisites
2828
ifndef::microshift[]
29-
* Your cluster uses a network plugin that supports `NetworkPolicy` objects, such as the OVN-Kubernetes network plugin, with `mode: NetworkPolicy` set.
29+
* Your cluster uses a network plugin that supports `NetworkPolicy` objects, such as the OVN-Kubernetes network plugin.
3030
endif::microshift[]
3131
* You installed the OpenShift CLI (`oc`).
3232
ifndef::microshift[]

0 commit comments

Comments
 (0)