Using a NAT Gateway with Kubernetes Engine

Using a NAT Gateway with Kubernetes Engine

Minutes 5 Credits


Google Cloud Self-Paced Labs


This lab uses the Modular NAT Gateway on Compute Engine for Terraform to automate creation of a NAT gateway managed instance group. You direct traffic from the instances by using tag-based routing, although only instances with matching tags use the NAT gateway route.

Under normal circumstances, Kubernetes Engine nodes route all egress traffic through the internet gateway associated with their node cluster. The internet gateway connection, in turn, is defined by the Compute Engine network associated with the node cluster. Each node in the cluster has an ephemeral external IP address. When nodes are created and destroyed during autoscaling, new node IP addresses are allocated automatically.

The default gateway behavior works well under normal circumstances. However, you might want to modify how ephemeral external IP addresses are allocated in order to:

  • Provide a third-party service with a consistent external IP address.
  • Monitor and filter egress traffic out of the Kubernetes Engine cluster.

In this lab, you will learn how to:

  • Create a NAT gateway instance and configure its routing details for an existing Kubernetes Engine cluster.
  • Create a custom routing rule for the NAT gateway instance.

The following diagram shows an overview of the architecture:


Join Qwiklabs to read the rest of this lab...and more!

  • Get temporary access to the Google Cloud Console.
  • Over 200 labs from beginner to advanced levels.
  • Bite-sized so you can learn at your own pace.
Join to Start This Lab