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

/etc/hostname no longer present on OpenShift workers #415

Open
thanusiak opened this issue Sep 9, 2022 · 6 comments
Open

/etc/hostname no longer present on OpenShift workers #415

thanusiak opened this issue Sep 9, 2022 · 6 comments

Comments

@thanusiak
Copy link

thanusiak commented Sep 9, 2022

Testing agent-resources-openshift.yaml
with:
Server Version: 4.10.18

I got the following error:

Events:
  Type     Reason          Age              From               Message
  ----     ------          ----             ----               -------
  Normal   Scheduled       8s               default-scheduler  Successfully assigned ibm-observe/logdna-agent-test-znlr2 to worker12.test.com
  Normal   AddedInterface  7s               multus             Add eth0 [10.254.60.102/22] from openshift-sdn
  Normal   Pulled          5s               kubelet            Successfully pulled image "icr.io/ext/logdna-agent:3.5.2" in 1.319768025s
  Normal   Pulling         4s (x2 over 6s)  kubelet            Pulling image "icr.io/ext/logdna-agent:3.5.2"
  Warning  Failed          3s (x2 over 5s)  kubelet            Error: Cannot mount /etc/hostname: path does not exist and will cause issues as a directory
  Normal   Pulled          3s               kubelet            Successfully pulled image "icr.io/ext/logdna-agent:3.5.2" in 1.282495926s

due to

- name: logdnahostname
          hostPath:
            path: /etc/hostname

Not sure when the change happened in OCP, but workers in fact don't have the hostname file by default.

Replacing path: /etc/hostname with :
path: /proc/sys/kernel/hostname

seems to resolve the problem.

@dkhokhlov
Copy link
Contributor

dkhokhlov commented Sep 9, 2022

that hostname line has not been touched for very long time and that file should exist in Linux.

I see that file when I run the image:

~$ docker run -it icr.io/ext/logdna-agent:3.5.2 bash
Unable to find image 'icr.io/ext/logdna-agent:3.5.2' locally
3.5.2: Pulling from ext/logdna-agent
54e56e6f8572: Pull complete
4f8ddd7f5a75: Pull complete
769927f5652f: Pull complete
1e852efbf2ff: Pull complete
Digest: sha256:1bb082da732c6e2d6bda583832c4f4dd3f2891cd824682b61c80988d52dc0dcb
Status: Downloaded newer image for icr.io/ext/logdna-agent:3.5.2

[root@ec6a9b7c3744 work]# cat /etc/hostname
ec6a9b7c3744

@thanusiak
Copy link
Author

thanusiak commented Sep 9, 2022

If you run it via docker locally or on standard Linux box it will be present, however it will not be present when run off a CoreOs worker (Openshift).
See similar discussion (it does not seem to be specific to FCOS):
https://ask.fedoraproject.org/t/location-of-etc-hostname-on-coreos/13426

@dkhokhlov
Copy link
Contributor

ic, you are using FCOS.

Probably something todo with FCOS vs RHCOS.

Red Hat Enterprise Linux CoreOS (RHCOS) is the only operating system supported on the OpenShift control plane nodes.
https://cloud.redhat.com/blog/red-hat-enterprise-linux-coreos-customization

@c-nixon ?

@thanusiak
Copy link
Author

@dkhokhlov Im referring to RHCOS, just couldnt find any discussion specific to it.

@dkhokhlov
Copy link
Contributor

dkhokhlov commented Sep 9, 2022

ic. might be OCP 4 vs OCP 3.
some search on RH portal:
https://access.redhat.com/search/#/?q=%22%2Fetc%2Fhostname%22%20openshift

@thanusiak
are you happy with proc/sys/kernel/hostname solution?

@thanusiak
Copy link
Author

It seems to works as expected, so Im good with this solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants