apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: nextcloud-to-mariadb spec: podSelector: matchLabels: name: nextcloud policyTypes: - Egress egress: - to: - namespaceSelector: matchLabels: name: mariadb ports: - protocol: TCP port: 3306 --- apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: nextcloud-to-redis spec: podSelector: matchLabels: name: nextcloud policyTypes: - Egress egress: - to: - namespaceSelector: matchLabels: name: default ports: - protocol: TCP port: 6379