【问题标题】:vSphere Cloud-Init not keeping the static IPvSphere Cloud-Init 不保留静态 IP
【发布时间】:2021-09-19 02:01:59
【问题描述】:

在处理 vSphere 和 Terraform 时,我遇到了一些我不理解的奇怪行为。我的 terraform 代码在 vSphere 中为主机提供了静态网络配置(网络、IP、掩码、网关等),并且在第一次启动时,它似乎是正确的。应用 IP 和相关网络设置。

但是在重新启动时,网络配置回退到 DHCP,这会失败。

我在/var/log/cloud-init.log 文件中看到,在第一次启动时,它能够成功应用配置:

但是在那之后,在重新启动时,它会恢复为 DHCP?

我在尝试在主机上启动 Consul 时注意到了这个问题,Consul 抱怨说没有要绑定的 IPv4 地址。所以,当我重新启动时,IP消失了。所以我认为地址应用不正确。

terraform 代码适用于基于 DHCP 的网络,但由于某种原因,当我应用静态配置时,它添加了一次,然后似乎不再保留。

有人遇到过类似的问题吗?

编辑:

通过阅读 cloud-init 调试进一步排除故障:

这是第一次启动,应该是基础模板。

第二次启动,应该是从 terraform 接收配置的已部署主机 -> cloud-init:

【问题讨论】:

    标签: terraform centos7 cloud-init


    【解决方案1】:

    ...这是 vSphere 中的错误。

    https://kb.vmware.com/s/article/71264

     Symptoms
    Virtual Machine has cloud-init customization enabled and a static IP
    After reboot the virtual machine is configured with DHCP
    
     Cause
    This issue occurs due to cloud-init considering the virtual machine as a new instance. This instance can not retrieve data from the datasource when there is no customization, and will have DatasourceNone applied defaulting to DHCP.
    
     Resolution
    Currently there is no resolution.
    
     Workaround
    To workaround this issue apply one of the following.workarounds:
    Add the setting manual_cache_clean: True to the /etc/cloud/cloud.cfg for the customized virtual machine.
    Uninstall cloud-init from the virtual machine
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-14
      • 1970-01-01
      • 1970-01-01
      • 2020-11-02
      • 2021-03-12
      • 2018-03-23
      • 1970-01-01
      • 2017-11-04
      相关资源
      最近更新 更多