Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multi-network for Pods (already exists in TF google provider) #2027

Open
anatanna opened this issue Aug 6, 2024 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@anatanna
Copy link

anatanna commented Aug 6, 2024

TL;DR

Support for multi-network feature is needed in module.
enable_multi_networking argument is available in google_container_cluster resource
Description : (Optional) Whether multi-networking is enabled for this cluster.

Terraform Resources

https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster
https://registry.terraform.io/providers/hashicorp/google-beta/latest/docs/resources/container_cluster

https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#additional_node_network_configs
https://registry.terraform.io/providers/hashicorp/google-beta/latest/docs/resources/container_node_pool#additional_node_network_configs

Detailed design

Multi-network feature is available in GKE as described here https://cloud.google.com/kubernetes-engine/docs/how-to/setup-multinetwork-support-for-pods.

According to gcloud cli the following configuration is available for node_pool
--additional-node-network network=NETWORK_NAME,subnetwork=SUBNET_NAME
--additional-pod-network subnetwork=subnet-dp,pod-ipv4-range=POD_IP_RANGE,max-pods-per-node=NUMBER_OF_PODS

Which is implemented in terraform provider here for resource container_node_pool https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_node_pool#additional_node_network_configs

So the possible design can be (under dedicated node_pool) as multiple blocks:

  additional_pod_net_config {
     network = "NETWORK_NAME"
     subnetwork = "SUBNETWORK-NAME"
     }
  additional_pod_network_config {
     subnetwork = "SUBNETWORK-NAME"
     secondary_pod_range = POD_IP_RANGE
     max_pods_per_node=NUMBER_OF_PODS
     }

Please note that every additional_pod_network_config can have its own max_pods_per_node that differs from node_pool.max_pods_per_node.

Additional information

From Documentation
To specify additional node-network and Pod-network interfaces, define the --additional-node-network and --additional-pod-network parameters multiple times as shown in the following example:

--additional-node-network network=dataplane,subnetwork=subnet-dp \
--additional-pod-network subnetwork=subnet-dp,pod-ipv4-range=sec-range-blue,max-pods-per-node=8 \
--additional-pod-network subnetwork=subnet-dp,pod-ipv4-range=sec-range-green,max-pods-per-node=8 \
--additional-node-network network=managementdataplane,subnetwork=subnet-mp \
--additional-pod-network subnetwork=subnet-mp,pod-ipv4-range=sec-range-red,max-pods-per-node=4

No response

@anatanna anatanna added the enhancement New feature or request label Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant