-
Notifications
You must be signed in to change notification settings - Fork 97
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
When upgrading through suc the hosts file get extra entries from the pod #2934
Comments
yep, confirmed. Built with master, k3s image, set a single node k8s, upgrade with system-upgrade-controller, result sin duplicated lines in /etc/hosts
Not sure whats going on, lol |
can be reproduced by running the initramfs stage several times with Seem like yip is not picking up or checking that the line exists? |
using yip directly seems to work though?? |
ah seems that its the 31_host file from system/oem and its only run in initramfs.before |
yes, somehow the check is failing so it recreates the hostname.. |
Could it be just the check in 31_host? Seems a bit strange that it would add the extra comment as well from the container then as in the example under describe the bug? 🤔 |
Went and tested in a vm, and seems like it's like you're saying and the extra Set up a pod that is about equal to the suc-container and there it is:
I guess the second problem could be solved by dropping comments in the hosts file in yip (unless that's something you guys aim to not modify) somewhere in this loop 🤔 |
This patch seems to alleviate it, after 2 upgrades I no longer get the duplicated entries: kairos-io/packages#1113 I do get duplicated comments though. I still dont get why. If k8s mounts stuff under /etc/hosts from the host into the container, thats ok but the upgrade should just ignore that and copy it. Plus, /etc is ephemeral so after a reboot it should go away? The only thing I can see touching that file is that yaml file... No idea where the duplication comes from, could it be that the plugin is adding extra lines somehow? But maybe the underlying /etc in the image does have the /etc/hosts duplication ?? Im really confused over this one |
Looking at the Kairos-container available in the kairos registries it contains an etc/hosts file, but this is empty so that explains why it is reset once you upgrade with On the other hand when it's ran as pod in kubernetes, then kubernetes will give it a hosts file based on either cluster-network or node (host-network). This seems to be what is causing problems here, I don't really have a good solution for this though as long as the pod-fs is mounted and used to upgrade. Not sure how you could get around this? I assume the upgrade command when provided the kubernetes doc: https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/ |
Yep, it does. Maybe we should either skip the hosts file or overwrite it on each boot before filling the hostname? so we start from initramfs with a clean hosts file that we know its "clean" on each boot? |
mmmh, going into the upgrade container I can see this:
so its storing the hosts file in the persistent partition. But only on the running container, outside in the host the /etc/hosts is not persistent... |
somehow somewhere, with the patch this suddenly seems to be fixed. There is also another patch that may affect this, that changes the config read paths as we were not reading the current system paths for configs (kairos-io/kairos-agent#579) I could not reproduce it anymore with framework 2.14.1 (latest agent and cloud configs). I need to try it again tomorrow freom a clean image though, but it may have gone away. |
So I think this is fixed. Im closing it, please reopen if it happens again :D |
Kairos version:
PRETTY_NAME="Ubuntu 24.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04.1 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo
KAIROS_ID_LIKE="kairos-standard-ubuntu-24.04"
KAIROS_IMAGE_LABEL="24.04-standard-amd64-generic-v3.2.1-k3sv1.31.1-k3s1"
KAIROS_ARTIFACT="kairos-ubuntu-24.04-standard-amd64-generic-v3.2.1-k3sv1.31.1+k3s1"
KAIROS_FLAVOR="ubuntu"
KAIROS_FLAVOR_RELEASE="24.04"
KAIROS_FAMILY="ubuntu"
KAIROS_MODEL="generic"
KAIROS_NAME="kairos-standard-ubuntu-24.04"
KAIROS_BUG_REPORT_URL="https://github.com/kairos-io/kairos/issues"
KAIROS_SOFTWARE_VERSION="v1.31.1+k3s1"
KAIROS_TARGETARCH="amd64"
KAIROS_GITHUB_REPO="kairos-io/kairos"
KAIROS_VERSION="v3.2.1-v1.31.1-k3s1"
KAIROS_REGISTRY_AND_ORG="quay.io/kairos"
KAIROS_HOME_URL="https://github.com/kairos-io/kairos"
KAIROS_ID="kairos"
KAIROS_PRETTY_NAME="kairos-standard-ubuntu-24.04 v3.2.1-v1.31.1-k3s1"
KAIROS_IMAGE_REPO="quay.io/kairos/ubuntu:24.04-standard-amd64-generic-v3.2.1-k3sv1.31.1-k3s1"
KAIROS_VARIANT="standard"
KAIROS_RELEASE="v3.2.1"
KAIROS_SOFTWARE_VERSION_PREFIX="k3s"
KAIROS_VERSION_ID="v3.2.1-v1.31.1-k3s1"
CPU architecture, OS, and Version:
Linux localhost 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Describe the bug
When upgrading using the routine documented for system-upgrade-controller, the containers /etc/hosts file seemingly gets merged with the hosts file and ends up with more and more entries.
This is after two upgrades using suc since provisioning:
To Reproduce
using the plan shown in documentation here, apply and upgrade a cluster. After reboot, check the /etc/hosts file:
Expected behavior
It should work the same way as when upgrading using the
kairos-agent ugrade
command directly, so result in a hostsfile equal to the one we started with:Logs
Not been able to find any logs indicating what's gone wrong here
Additional context
Does not seem to affect upgrades using
kairos-agent upgrade
directly.My guess is that it's related to the suc upgrade using the containers root as a source, but haven't yet found how it could be prevented. Not aware of any other files being affected in a similar way.
The text was updated successfully, but these errors were encountered: