apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: frontend-policy labels: app: rxminder component: frontend spec: podSelector: matchLabels: component: frontend policyTypes: - Ingress - Egress ingress: - from: - podSelector: matchLabels: component: frontend ports: - protocol: TCP port: 80 egress: - to: - podSelector: matchLabels: component: database ports: - protocol: TCP port: 5984 - to: - podSelector: matchLabels: component: frontend ports: - protocol: TCP port: 80 --- apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: database-policy labels: app: rxminder component: database spec: podSelector: matchLabels: component: database policyTypes: - Ingress - Egress ingress: - from: - podSelector: matchLabels: component: frontend ports: - protocol: TCP port: 5984 egress: - to: - podSelector: matchLabels: component: database ports: - protocol: TCP port: 5984