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

bootstrap_env is not working as expected. DNS_CLUSTER_IP env var is not honored by bootstrap.sh script #1726

Closed
kkapoor1987 opened this issue Dec 21, 2021 · 3 comments · Fixed by #1680

Comments

@kkapoor1987
Copy link

kkapoor1987 commented Dec 21, 2021

Description

While using Managed NodeGroups with create_launch_template: true and passing bootstrap_env it seems like DNS_CLUSTER_IP is not honored in the bootstrap.sh script.

I see values being set in user-data in AWS console

DNS_CLUSTER_IP="192.168.0.10"
SERVICE_IPV4_CIDR="192.168.0.0/24"
bootstrap_env = {
  DNS_CLUSTER_IP = local.DNS_CLUSTER_IP
  SERVICE_IPV4_CIDR = var.ClusterServiceIpv4Cidr
}

Versions

  • Terraform: 1.0.8
  • Provider(s): 3.63.0
  • Module: 17.24.0

Reproduction

Steps to reproduce the behavior:

  1. Create a cluster with ClusterService CIDR : 192.168.0.0/24
  2. Now check kubelet-config.json on the host or /etc/resolv.conf in pod expected DNS entry should be 192.168.0.10 but will be 10.100.0.10

Code Snippet to Reproduce

Set following in MNG
bootstrap_env = {
DNS_CLUSTER_IP = "192.168.0.10"
}
Create cluster with cluster_service_ipv4_cidr: 192.168.0.0/24

Expected behavior

bootstrap.sh script should set DNS_CLUSTER_IP: 192.168.0.10 in /etc/kubernetes/kubelet/kubelet-config.json

Actual behavior

bootstrap.sh script is setting default DNS_CLUSTER_IP: 10.100.0.10" in kubelet-config.json which is one of the default value in bootstrap.sh
clusterDNS": [
"10.100.0.10"
],

Additional context

TF version 1.0.8
Module version : 17.24.0

@fascenvi
Copy link

fascenvi commented Jan 3, 2022

Maybe I have a similar problem when I tried to change the container_runtime of a custom_ami. The "bootstrap_env" wasn't honored
Just need add the "export" parameter to change the scope of variables to Global and now the bootstrap.sh could read it.

22 %{ for k, v in bootstrap_env ~}
23 export ${k}="${v}"
24 %{ endfor ~}

@antonbabenko
Copy link
Member

This issue has been resolved in version 18.0.0 🎉

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants