crc-org / crc

CRC is a tool to help you run containers. It manages a local OpenShift 4.x cluster, Microshift or a Podman VM optimized for testing and development purposes
https://crc.dev
Apache License 2.0
1.26k stars 241 forks source link

CRC 1.33.1 Discussion on configuring resolv.conf #2784

Closed rupeshad81 closed 3 years ago

rupeshad81 commented 3 years ago

Hi,

Please can you suggest, how can we configure the /etc/resolv.conf

We need to have below setting in the file, which is not happening

ssh -i ~/.crc/machines/crc/id_ecdsa -o StrictHostKeyChecking=no core@$(crc ip) sudo sed -i '/search/s/$/" corp.amdocs.com"/' /etc/resolv.conf

[crc@eaas-crc ~]$ ssh -i ~/.crc/machines/crc/id_ecdsa -o StrictHostKeyChecking=no core@$(crc ip)
Red Hat Enterprise Linux CoreOS 48.84.202109100857-0
  Part of OpenShift 4.8, RHCOS is a Kubernetes native operating system
  managed by the Machine Config Operator (`clusteroperator/machine-config`).

WARNING: Direct SSH access to machines is not recommended; instead,
make configuration changes via `machineconfig` objects:
  https://docs.openshift.com/container-platform/4.8/architecture/architecture-rhcos.html

---
Last login: Mon Oct  4 11:37:04 2021 from 192.168.130.1
[core@crc-scmfr-master-0 ~]$ ping ilvpbg1943
ping: ilvpbg1943: Name or service not known

Thanks


Copied from https://github.com/code-ready/crc/issues/2784#issuecomment-933406329

rupeshad81 commented 3 years ago

Hi,

Please can you suggest, how can we configure the /etc/resolv.conf

We need to have below setting in the file, which is not happening

ssh -i ~/.crc/machines/crc/id_ecdsa -o StrictHostKeyChecking=no core@$(crc ip) sudo sed -i '/search/s/$/" corp.amdocs.com"/' /etc/resolv.conf

[crc@eaas-crc ~]$ ssh -i ~/.crc/machines/crc/id_ecdsa -o StrictHostKeyChecking=no core@$(crc ip)
Red Hat Enterprise Linux CoreOS 48.84.202109100857-0
  Part of OpenShift 4.8, RHCOS is a Kubernetes native operating system
  managed by the Machine Config Operator (`clusteroperator/machine-config`).

WARNING: Direct SSH access to machines is not recommended; instead,
make configuration changes via `machineconfig` objects:
  https://docs.openshift.com/container-platform/4.8/architecture/architecture-rhcos.html

---
Last login: Mon Oct  4 11:37:04 2021 from 192.168.130.1
[core@crc-scmfr-master-0 ~]$ ping ilvpbg1943
ping: ilvpbg1943: Name or service not known

Thanks

cfergeau commented 3 years ago

This is a generic OpenShift question, not something specific to crc, so this really is not a great place to discuss this. And it's also not clear why you need to do this, can't you use full hostnames, or deal with it differently?

rupeshad81 commented 3 years ago

Hi,

No we cannot use the full name.

In older version of CRC , we is to fix this and so we were able to ping the server.

So i was not able to configure this on the new crc 1.33.1

Can please suggest.

praveenkumar commented 3 years ago

Agree this is not crc specific but around openshift side (check with docs ) or better to use full hostname like ilvpbg1943.corp.amdocs.com

cfergeau commented 3 years ago

In older version of CRC , we is to fix this and so we were able to ping the server.

For what it's worth, direct changes to the node configuration through ssh is unsupported both by us and by OpenShift.

rupeshad81 commented 3 years ago

Hi, Again , do we have other different configuration for this CRC.

[crc@eaas-crc ~]$ ssh -i ~/.crc/machines/crc/id_ecdsa -o StrictHostKeyChecking=no core@$(crc ip) sudo sed -i '/search/s/$/" corp.amdocs.com"/' /etc/resolv.conf
[crc@eaas-crc ~]$
[crc@eaas-crc ~]$
[crc@eaas-crc ~]$ ssh -i ~/.crc/machines/crc/id_ecdsa -o StrictHostKeyChecking=no core@$(crc ip) sudo cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.130.1

Please check older crc version, it was able to do modification.

[crc@eaas-crc ~]$ crc version
WARN A new version (1.33.1) has been published on https://developers.redhat.com/content-gateway/file/pub/openshift-v4/clients/crc/1.33.1/crc-linux-amd64.tar.xz
CodeReady Containers version: 1.29.1+bc5f4409
OpenShift version: 4.7.18 (embedded in executable)
[crc@eaas-crc ~]$ ssh -i ~/.crc/machines/crc/id_ecdsa -o StrictHostKeyChecking=no core@$(crc ip) sudo cat /etc/resolv.conf
# Generated by CRC
search crc.testing corp.amdocs.com
nameserver 10.88.0.8
nameserver 192.168.130.1
rupeshad81 commented 3 years ago

HI,

[crc@eaas-crc ~]$ crc version
WARN A new version (1.33.1) has been published on https://developers.redhat.com/content-gateway/file/pub/openshift-v4/clients/crc/1.33.1/crc-linux-amd64.tar.xz
CodeReady Containers version: 1.29.1+bc5f4409
OpenShift version: 4.7.18 (embedded in executable)

[crc@eaas-crc ~]$ ssh -i ~/.crc/machines/crc/id_ecdsa -o StrictHostKeyChecking=no core@$(crc ip) sudo cat /etc/resolv.conf
# Generated by CRC
search crc.testing corp.amdocs.com
nameserver 10.88.0.8
nameserver 192.168.130.1
[crc@eaas-crc ~]$
[crc@eaas-crc ~]$
[crc@eaas-crc ~]$ ssh -i ~/.crc/machines/crc/id_ecdsa -o StrictHostKeyChecking=no core@$(crc ip) ping ilvpbg1943
PING ilvpbg1943.corp.amdocs.com (10.234.112.151) 56(84) bytes of data.
64 bytes from ilvpbg1943.corp.amdocs.com (10.234.112.151): icmp_seq=1 ttl=61 time=1.10 ms
64 bytes from ilvpbg1943.corp.amdocs.com (10.234.112.151): icmp_seq=2 ttl=61 time=1.24 ms
64 bytes from ilvpbg1943.corp.amdocs.com (10.234.112.151): icmp_seq=3 ttl=61 time=1.37 ms
Killed by signal 2.
rupeshad81 commented 3 years ago

Hi,

How can we configure in this new CRC 1.33.1 , Do we have changes made in it ?

So please let us know, we will configure it.

Thanks

cfergeau commented 3 years ago

Once again, this was never a supported change to be done in the VM. Since it's unsupported, it could have broken at any time, which apparently finally happened with OpenShift 4.8. How to deal with this really is outside of crc's scope, especially if you don't give details regarding why you need to do this. Just one note, the resolv.conf content that you pasted has no search line, so I think it's expected your sed comment does not make any changes. And this is totally unrelated to crc/OpenShift/..., just basic shell usage.

rupeshad81 commented 3 years ago

Hi,

We do not have the server name will full name , it has been name like "ilvpbg1943" with different name.

Also in pervious version the /etc/resolv.conf look like below :

 cat /etc/resolv.conf
# Generated by CRC
search crc.testing corp.amdocs.com
nameserver 10.88.0.8

And now the new crc 1.33.1 looks to be different ?

[core@crc-scmfr-master-0 ~]$ sudo cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.130.1
cfergeau commented 3 years ago

Once again, system files on the VM file system are a private implementation detail, they can change at any time. Any modifications you make to them is unsupported. It's normal you need to rework these modifications after a major OpenShift upgrade.

praveenkumar commented 3 years ago

This is really an issue with openshift side https://bugzilla.redhat.com/show_bug.cgi?id=1944805 and not CRC specific. It worked before because we didn't enabled the MCO and with MCO enabled we are much more closer to real openshift cluster.

gbraad commented 3 years ago

Unrelated to CRC. These are DNS and environment specific settings. use FQDN instead of just the hostnames.