<p>I have the following <code>deployment</code></p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    app: redis
  name: redis
spec:
  replicas: 1
  selector:
    matchLabels:
      app: redis
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: redis
    spec:
      containers:
      - image: redis:alpine
        name: redis
        resources: {}
status: {}
</code></pre>
<p><strong>Question 1 :</strong> How do you expose this deployment via a <code>ClusterIP</code> service on port 8080.</p>
<p><strong>Question 2 :</strong> How would I create a new Ingress Type <code>NetworkPolicy</code> to allows only the pods with label <code>access=redis</code> to access the deployment.</p>

JumbledCode
<p>Service</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  selector:
    app: redis
  ports:
    - protocol: TCP
      port: 8080
      targetPort: 6379
</code></pre>
<p>Network Policy</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: test-network-policy
spec:
  podSelector:
    matchLabels:
      app: redis
  policyTypes:
  - Ingress
  ingress:
  - from:
    - podSelector:
        matchLabels:
          access: redis
    ports:
    - protocol: TCP
      port: 6379
</code></pre>
