Hi team, Please help me in finding the root cause Form the Mock exam#1, second . . .

Mayur Sharma:
Hi team, Please help me in finding the root cause

Form the Mock exam#1, second last question, I am not able to test from temporary pod. It is giving following error:

/ # wget -o- redis:6379
Connecting to redis:6379 (10.106.142.131:6379)
wget: error getting response: Resource temporarily unavailable
Screen shot attached**

Please note that answer is correct as per evaluation when I end the exam.

Question for reference:
Create a redis deployment using the image redis:alpine
with 1 replica and label app=redis.
Expose it via a ClusterIP service called redis on port 6379.
Create a new Ingress Type NetworkPolicy called redis-access
which allows only the pods with label access=redis to access
the deployment.

Mohamed Ayman:
You should add label access=redis to match it in netpolicy.

kubectl create deployment redis  --image=redis:alpine -o yaml > redis.yml   
## add the required label
kubectl create -f redis.yml kubectl expose deployment redis --port=6379 --labels=app=redis

Mohamed Ayman:
then, create the NetworkPoicy

apiVersion: <http://networking.k8s.io/v1|networking.k8s.io/v1>
kind: NetworkPolicy
metadata:
  name: redis-access
  namespace: default
spec:
  podSelector:
    matchLabels:
      app: redis
  policyTypes:
  - Ingress
  ingress:
  - from:
    - podSelector:
        matchLabels:
          access: redis

Mohamed Ayman:
Check this GIF: