Add explanation for Pod IP addresses.

This commit is contained in:
Tom Alexander
2025-03-15 16:25:25 -04:00
parent fbb8376ccc
commit f3c22c18e5
8 changed files with 159 additions and 48 deletions

View File

@@ -72,7 +72,12 @@ variable "cluster_exists" {
variable "routes_based" {
description = "Set to true to create a routes-based cluster instead of VPC Native. This is mostly for testing."
type = bool
default = true
default = false
}
variable "enable_snat" {
description = "Whether we should enable source network address translation to the node IP address."
type = bool
}
output "gke_connect_command" {

View File

@@ -35,5 +35,6 @@ module "workload" {
dns_managed_zone = var.dns_managed_zone
public_ingress = var.public_ingress
ingress_type = var.ingress_type
enable_snat = var.enable_snat
main_k8s_namespace = var.main_k8s_namespace
}

View File

@@ -0,0 +1,14 @@
resource "kubernetes_config_map" "ip_masq_agent" {
count = var.enable_snat ? 1 : 0
metadata {
name = "ip-masq-agent"
namespace = "kube-system"
}
data = {
config = "nonMasqueradeCIDRs:\n - 100.64.0.0/19\n - 240.10.0.0/17\nmasqLinkLocal: false\nresyncInterval: 60s\n"
}
depends_on = [var.node_pool]
}

View File

@@ -29,6 +29,11 @@ variable "main_k8s_namespace" {
type = string
}
variable "enable_snat" {
description = "Whether we should enable source network address translation to the node IP address."
type = bool
}
# Provide time for Service cleanup
resource "time_sleep" "wait_service_cleanup" {
depends_on = [var.cluster]