I need to create a NetwrokPolicy for my pod which from the network aspects needs
to access to only one specific endpoint outside the cluster, only this endpoint.
The endpoint looks like following. https://140.224.232.236:8088
Before apply the following network policy I've exec to the pod (the image is based on alpine) and run ping www.google.com and it works as expected,
However when I apply the network policy I and I try to ping google.com I got ping: bad address 'www.google.com' but when I ping to the ip like
ping 140.224.232.236ping 140.224.232.236:8080
it get stuck and before I was able to see something like this
64 bytes from 140.224.232.236: seq=518 ttl=245 time=137.603 ms
64 bytes from 140.224.232.236: seq=519 ttl=245 time=137.411 ms
64 bytes from 140.224.232.236: seq=520 ttl=245 time=137.279 ms
64 bytes from 140.224.232.236: seq=521 ttl=245 time=137.138 ms
....
Now its just stuck on this, any idea?
ping 140.224.232.236
PING 140.224.232.236 (140.224.232.236): 56 data bytes
and nothing more, what does it mean?
What I did is the following
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: test-network-policy
namespace: dev
spec:
podSelector:
matchLabels:
app.kubernetes.io/name: foo
policyTypes:
- Egress
egress:
- to:
- ipBlock:
cidr: 140.224.232.236/32
ports:
- protocol: TCP
port: 8088
- I've applied it on the same ns of the pod.
- the name of the pod selector label has taken from the pod which I want to apply the network policy and have the following.
app.kubernetes.io/name: foo
