How to use ClusterNetworkPolicy in GKE to secure network access across your cluster — Transcript
Full transcript
- 0:00In Kubernetes, standard network policies
- 0:03control pod communication at the
- 0:05namespace level. However, this is not
- 0:07enforced across the entire cluster. This
- 0:10is where cluster network policies come
- 0:13in.
- 0:14Welcome to Networking Everything, where
- 0:16we discuss networking everything. My
- 0:19name is Ahmed and joining me today is
- 0:21Harika. Today we'll be covering the
- 0:23topic of cluster network policies in
- 0:26Google Kubernetes Engine. Let's get
- 0:29started.
- 0:30[music]
- 0:36While standard network policies apply to
- 0:38pods in a single namespace, cluster
- 0:40network policies let administrators
- 0:43configure global traffic rules across an
- 0:45entire cluster. These rules can match
- 0:48and filter protocols like TCP, UDP, and
- 0:51SCTP. To understand the concept better,
- 0:54let's look at three personas. So first
- 0:57up, the cluster administrator. They
- 0:59protect cluster infrastructure and set
- 1:01baseline guard rails working in both
- 1:04admin and baseline tiers.
- 1:06Second, the namespace administrator.
- 1:09They manage security for specific
- 1:11namespaces using standard network
- 1:14policy. And third, the application
- 1:17developer.
- 1:18They secure individual application
- 1:20workloads also using standard network
- 1:23policy.
- 1:25Now, let me pass you over to Harika to
- 1:27take a deeper dive into this topic. Over
- 1:30to you, Harika.
- 1:31>> Thanks, Ahmed. Let me dive into the
- 1:33flow. Every packet in your cluster is
- 1:36evaluated top to bottom through distinct
- 1:38steps. [music]
- 1:38First is the admin tier powered by
- 1:40cluster network policy. This is where
- 1:43platform admins set non-negotiable rules
- 1:45like isolating sensitive namespaces
- 1:47[music]
- 1:48or guaranteeing cluster DNS access.
- 1:50Second is a network policy tier. This is
- 1:53the developer playground and home to
- 1:54standard namespace network policies and
- 1:57fully qualified domain name policies.
- 1:59Third is baseline tier, which is another
- 2:02cluster network policy layer [music]
- 2:04used by admins to set default fallbacks
- 2:06like a cluster wide default deny. And
- 2:09fourth, if no policy in any of these
- 2:12three tier makes a decision, Kubernetes
- 2:14[music] falls back to its default
- 2:16behavior, which implicitly allows all
- 2:18traffic.
- 2:19Unlike standard network policy which can
- 2:21only allow traffic, cluster network
- 2:23policy introduces [music] three explicit
- 2:25actions, accept, deny and pass.
- 2:29When a rule triggers accept or deny, the
- 2:31decision is final. [music] The traffic
- 2:33is immediately allowed or dropped and no
- 2:35further evaluation happens in any
- 2:37[music] lower tier.
- 2:39But pass is like a secret weapon for
- 2:41platform teams. If an admin tier rule
- 2:44matches traffic with action pass, it
- 2:46skips all remaining admin rules and
- 2:49immediately delegates the decision down
- 2:51to the network policy tier.
- 2:54This lets admin says I am not blocking
- 2:56certain port. For example, [music] I am
- 2:58explicitly handing control over to the
- 3:01namespace owners. Let's see how this
- 3:03solves real world cluster security.
- 3:05[music] Imagine you want a zero trust
- 3:07cluster. First, in the admin tier you
- 3:10create two high priority rules. Priority
- 3:1210 completely isolates your sensitive
- 3:14namespace with an explicit deny [music]
- 3:17and priority 20 uses accept to ensure
- 3:19every pod can always reach kube-dns on
- 3:22port 53 [music] so developers can never
- 3:25accidentally break any DNS.
- 3:28Next, instead of forcing every developer
- 3:30to write boilerplate deny rules, you
- 3:32drop a single policy into the baseline
- 3:35tier at priority 100 that denies all
- 3:38ingress traffic across the entire
- 3:40cluster, [music]
- 3:41instant zero trust. Now, how does a
- 3:44developer expose their front end app?
- 3:46They just deploy a standard Kubernetes
- 3:48network policy in their own namespace
- 3:51[music] allowing ingress nginx.
- 3:53Because the network policy tier is
- 3:55evaluated before the baseline tier, the
- 3:58developers rule succeeds and overrides
- 4:01your baseline deny without ever being
- 4:03able to bypass your admin tiered guard
- 4:06rails.
- 4:07Before you write your first policy, keep
- 4:09three pro tips in mind.
- 4:11Number one, priority number runs from
- 4:13zero to 1000. A lower number means
- 4:16higher precedence. If policy A has
- 4:18priority 10 and policy B has priority 50
- 4:21in the same tier, policy A is evaluated
- 4:24first. [music] Within a single policy,
- 4:26rules are evaluated top to bottom. Once
- 4:29a rule matches like allowing traffic,
- 4:32the evaluation stops. Number two, use
- 4:35name ports instead of hardcoding ports
- 4:37like 8080 in your security policies.
- 4:40[music]
- 4:40Match on destination name port HTTP web.
- 4:44If an app team changes their container
- 4:46port for any reason, your security
- 4:49policies keep working without a single
- 4:51edit.
- 4:52And three, external CIDR egress. Need to
- 4:56control access to corporate intranets
- 4:58outside the cluster? Use the networks
- 5:01peer type in your egress rules to allow
- 5:03or block specific [music] IP ranges.
- 5:06To recap, use the admin tier for
- 5:08non-negotiable guard rails and DNS. Use
- 5:11the baseline tier for a cluster wide
- 5:13default deny and let developers
- 5:16self-serve [music] in the middle using
- 5:18standard network policies.
- 5:22>> Wow, that was awesome. Thank you so
- 5:24much, Harika. Now it's time for you to
- 5:27explore and learn more about cluster
- 5:29network policy. Please check the links
- 5:31in the description. And thank you so
- 5:33much for watching this episode of
- 5:35Networking Everything where we discuss
- 5:37networking everything.
- 5:40Bye.
- 5:43>> [music]
- 5:52[music]
About this transcript
This page contains the full transcript of How to use ClusterNetworkPolicy in GKE to secure network access across your cluster by Google Cloud Tech, generated from the public captions YouTube serves with the video. The transcript has 808 words across 147 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.