Hi, a question about the error in question. It's about *moc_3* question *5* The . . .

Frankube:
Hi, a question about the error in question.
It’s about moc_3 question 5
The final error test on the port, my netpolicy is this
Can you make me understand?
Thank you apiVersion: http://networking.k8s.io/v1|networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: ingress-to-nptest
namespace: default
spec:
podSelector:
matchLabels:
run: np-test-1
policyTypes:

Mohamed Ayman:
Create a NetworkPolicy that allows incoming connections to the service over port 80.
Check the following:

apiVersion: <http://networking.k8s.io/v1|networking.k8s.io/v1>
kind: NetworkPolicy
metadata:
  name:  ingress-to-nptest
spec:
  podSelector:
    matchLabels:
      run: np-test-1
  policyTypes:
  - Ingress
  - Egress
  ingress:
  - ports:
    - protocol: TCP
      port: 80

Frankube:
Hi MAyman, thanks for the reply.
Yes I know the solution you indicated, I don’t understand why I can’t enter this info if {} means from any namespace or pod.
It looks like an array problem with -ports:

ingress:

  • {}
  • ports:
    • protocol: TCP
      port: 80