karthi Mahadev:
Can someone help me in clearing this question:
Hard part
Easy part: 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.
Hard Part:
Create a new Ingress Type NetworkPolicy called redis-access which allows only the pods with label access=redis to access the deployment.
karthi Mahadev:
controlplane $ cat netpo.yaml
apiVersion: <http://networking.k8s.io/v1|networking.k8s.io/v1>
kind: NetworkPolicy
metadata:
name: redis-access
spec:
podSelector:
matchLabels:
access: redis
ingress:
- from:
- podSelector:
matchLabels:
access: redis
ports:
- protocol: TCP
port: 6379
policyTypes:
- Ingress
karthi Mahadev:
The above netpolicy seems incorrect.
Sandeep Kumar:
I think label under spec section should be app=redis
karthi Mahadev:
you are correct, How did I not see it
Tej_Singh_Rana:
Don’t worry. Do Practice, Practice.