Closed twingate-blee closed 1 month ago
Not a Google employee, but I did add this feature. The setting can be set in a bunch of places. While I agree this behavior is confusing and not ideal, see the notes in the provider docs about node_config
.
Generally, this field should not be used at the same time as a google_container_node_pool or a node_pool block; this configuration manages the default node pool, which isn't recommended to be used with Terraform
Also, looking at your example, you're looking for nodeConfigDefaults
, which is in the node_pool_defaults
block, not the node_config.kubelet_config
block.
So, if you're using remove_default_node_pool = true
, you will need to set it for each pool separately. This may not line up with your exact use case, but basically:
resource "google_container_cluster" "app_cluster" {
...
remove_default_node_pool = true
node_pool_defaults {
node_config_defaults {
insecure_kubelet_readonly_port_enabled = "FALSE"
}
}
}
resource "google_container_node_pool" "your_node_pool" {
name = "your-node-pool"
cluster = google_container_cluster.app_cluster.id
node_count = 1
node_config {
kubelet_config {
insecure_kubelet_readonly_port_enabled = "FALSE"
}
}
}
HTH
All that said, it might be a good idea (if it's possible) for the provider team to add some kind of provider level validation / erroring if someone tries to set node_config
when remove_default_node_pool
is set, but I suspect that removing it should resolve the issue.
Thank you. I was trying to set the insecure_kubelet_readonly_port_enabled at the cluster level as suggested in: https://cloud.google.com/kubernetes-engine/docs/how-to/disable-kubelet-readonly-port "We recommend that you set the read-only port setting at the cluster level in all cases."
I will remove any kubelet_config from the cluster level.
I think theyβre suggesting setting it on any node pools, as well as in the defaults. But there are a lot of different places it can be set.
If you use the CLI to check the values as in their howto, and they all have the right setting, you should be good.
Community Note
Terraform Version & Provider Version(s)
Terraform v1.9.2 on darwin_arm64
Affected Resource(s)
google_container_cluster
Terraform Configuration
Debug Output
No response
Expected Behavior
Terraform should not error and insecureKubeletReadonlyPortEnabled should be set to False
Actual Behavior
We do not use the "default-pool". Node pools created using
google_container_node_pool
Steps to reproduce
terraform apply
Important Factoids
No response
References
No response