Menu

Zero-Trust Pod Networking on GKE: Parameterizing Kubernetes NetworkPolicies with Helm
📰

Zero-Trust Pod Networking on GKE: Parameterizing Kubernetes NetworkPolicies with Helm

DEV Community: kubernetes·PUNITH YADAV·3 days ago
#kbzuBmJ4
#devtokubernetes#devto#dev#name#release
Reading 0:00
15s threshold

{{ if .Values.defaultDeny.enabled }}

apiVersion: networking.k8s.io/v1

kind: NetworkPolicy

metadata:

name: {{ .Release.Name }}-default-deny

namespace: {{ .Release.Namespace }}

spec:

podSelector: {}

policyTypes:

- Ingress

- Egress

{{ end }}

apiVersion: networking.k8s.io/v1

kind: NetworkPolicy

metadata:

name: {{ .Release.Name }}-allow-dns

namespace: {{ .Release.Namespace }}

spec:

podSelector: {}

policyTypes:

- Egress

egress:

- to:

- namespaceSelector:

matchLabels:

kubernetes.io/metadata.name: kube-system

ports:

- protocol: UDP

port: 53

- protocol: TCP

port: 53

{{ range .Values.policies }}

apiVersion: networking.k8s.io/v1

kind: NetworkPolicy

metadata:

name: {{ $.Release.Name }}-{{ .name }}-policy

namespace: {{ $.Release.Namespace }}

spec:

podSelector:

matchLabels:

app: {{ .targetApp }}

policyTypes:

- Ingress

ingress:

{{ range .allowedClients }}

- from:

- podSelector:

matchLabels:

app: {{ .app }}

ports:

- protocol: TCP

port: {{ .port }}

{{ end }}

{{ end…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.