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

BZ:1924176 - Replacing DNS name servers #30283

Closed
wants to merge 1 commit into from
Closed

BZ:1924176 - Replacing DNS name servers #30283

wants to merge 1 commit into from

Conversation

mikemckiernan
Copy link
Contributor

@mikemckiernan mikemckiernan commented Mar 9, 2021

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1924176

Updates are at the following heading: https://deploy-preview-30283--osdocs.netlify.app/openshift-enterprise/latest/post_installation_configuration/machine-configuration-tasks.html#machineconfig-modify-dns-nameservers_post-install-machine-configuration-tasks

Note to self: This PR applies to 4.8 and 4.7. The Ignition config file version is 3.1 for 4.6.

@openshift-ci-robot openshift-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 9, 2021
@netlify
Copy link

netlify bot commented Mar 9, 2021

Deploy preview for osdocs ready!

Built with commit 4f20586

https://deploy-preview-30283--osdocs.netlify.app

Copy link
Contributor

@jboxman jboxman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mikemckiernan this is looking good, thanks!

= Modifying the DNS name servers

You can override the DNS name servers and search list in the `/etc/resolv.conf` file.
Some operating systems use `NetworkManager` to manage network interfaces.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this applies to RHEL and Red Hat Core OS, so for our purposes, this is probably always true.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other text on the page mentioned "operating systems" generally more often that RHEL or RHCOS specifically, so I went with the more frequent use so this new topic would blend.


You can override the DNS name servers and search list in the `/etc/resolv.conf` file.
Some operating systems use `NetworkManager` to manage network interfaces.
When `NetworkManager` manages some interfaces, it also manages the contents of the `/etc/resolv.conf` file.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth checking RHEL docs, but I think it goes by just NetworkManager without italics.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using backticks based on the guidance for a daemon, service, or software package.

modules/machineconfig-modify-dns-nameservers.adoc Outdated Show resolved Hide resolved
+
[source,terminal]
----
$ oc debug node/${ONE_HOST} -- chroot /host cat /etc/resolv.conf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if it's helpful to users or not, but I've always defined any variables used in a command, even if it ought to be obvious:

[source,terminal]
----
$ oc debug node/${ONE_HOST} -- chroot /host cat /etc/resolv.conf
----
+
where:
+
`ONE_HOST`:: Specifies the host name captured in the previous command.

Copy link
Member

@mike-nguyen mike-nguyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. Just a minor helpful tip for base64 encoding.

+
[source,terminal]
----
$ cat << EOF | base64
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

base64 with no options will cause line breaks every 77 characters to appear when the user copies and pastes it into their machine config which will cause errors. The user will have to delete the line breaks in order to remedy the errors. I prefer base64 -w0 which will not word wrap. The only caveat is that there is no line break at in the output before the next shell prompt. You can opt to do base64 -w99999999999999 which will add a line break at the very end as long as the base64 encoded output is not longer than 99999999999999 characters but this looks a little hacky.

Example: Without Option

[mnguyen@pet32 ~]$ cat << EOF | base64    
# Custom resolv.conf added with Machine Config Operator
# and the override-etc-resolv-conf.yaml file.
search c.openshift-gce-devel-ci.internal google.internal c.openshift-gce-devel-ci.inte
nameserver 169.254.169.254                                                            
nameserver 8.8.8.8                                                            
EOF                                                                           
IyBDdXN0b20gcmVzb2x2LmNvbmYgYWRkZWQgd2l0aCBNYWNoaW5lIENvbmZpZyBPcGVyYXRvcgoj
IGFuZCB0aGUgb3ZlcnJpZGUtZXRjLXJlc29sdi1jb25mLnlhbWwgZmlsZS4Kc2VhcmNoIGMub3Bl
bnNoaWZ0LWdjZS1kZXZlbC1jaS5pbnRlcm5hbCBnb29nbGUuaW50ZXJuYWwgYy5vcGVuc2hpZnQt
Z2NlLWRldmVsLWNpLmludGUKbmFtZXNlcnZlciAxNjkuMjU0LjE2OS4yNTQKbmFtZXNlcnZlciA4
LjguOC44Cg==
[mnguyen@pet32 ~]$ 

Example: With -w0 Option

[mnguyen@pet32 ~]$ cat << EOF | base64 -w0
# Custom resolv.conf added with Machine Config Operator
# and the override-etc-resolv-conf.yaml file.
search c.openshift-gce-devel-ci.internal google.internal c.openshift-gce-devel-ci.inte
nameserver 169.254.169.254                                                            
nameserver 8.8.8.8                                                            
EOF                                                                           
IyBDdXN0b20gcmVzb2x2LmNvbmYgYWRkZWQgd2l0aCBNYWNoaW5lIENvbmZpZyBPcGVyYXRvcgojIGFuZCB0aGUgb3ZlcnJpZGUtZXRjLXJlc29sdi1jb25mLnlhbWwgZmlsZS4Kc2VhcmNoIGMub3BlbnNoaWZ0LWdjZS1kZXZlbC1jaS5pbnRlcm5hbCBnb29nbGUuaW50ZXJuYWwgYy5vcGVuc2hpZnQtZ2NlLWRldmVsLWNpLmludGUKbmFtZXNlcnZlciAxNjkuMjU0LjE2OS4yNTQKbmFtZXNlcnZlciA4LjguOC44Cg==[mnguyen@pet32 ~]$ 

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to you,@mike-nguyen.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1924176

* From https://access.redhat.com/solutions/7412, configure
  NetworkManager not to update `/etc/resolv.conf`.

* Follow the general guidance for replacing a file with
  the Machine Config Operator.

* Feedback from jboxman and mike-nguyen.
@mikemckiernan
Copy link
Contributor Author

Engineering wants to take a different approach to this work. Abandoning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants