fix: add instruction to restart CoreDNS

This commit is contained in:
kurokobo 2021-07-19 12:15:57 -04:00
parent 43e08250d1
commit 97b1e45633

View file

@ -32,7 +32,7 @@ An example implementation of AWX on single node K3s using AWX Operator, with eas
- [Use Ansible Runner](#use-ansible-runner)
- [Additional Configuration for AWX](#additional-configuration-for-awx)
- [Configure AWX to use Git Repository with Self-Signed Certificate](#configure-awx-to-use-git-repository-with-self-signed-certificate)
- [Expose your /etc/hosts to K3s](#expose-your-etchosts-to-k3s)
- [Expose your /etc/hosts to Pods on K3s](#expose-your-etchosts-to-pods-on-k3s)
## Environment
@ -365,7 +365,7 @@ See [📝`runner/README.md`](runner) for instructions.
- Press `Edit` and scroll down to `Extra Environment Variables`, then add `"GIT_SSL_NO_VERIFY": "True"` in `{}`
- Press `Save`
### Expose your /etc/hosts to K3s
### Expose your /etc/hosts to Pods on K3s
If we don't have a DNS server and are using `/etc/hosts`, we will need to do some additional tasks to get the Pods on K3s to resolve names according to `/etc/hosts`.
@ -376,9 +376,11 @@ One easy way to do this is to use `dnsmasq`.
1. Add entries to `/etc/hosts` on your K3s host. Note that the IP addresses have to be replaced with your K3s host's one.
```bash
sudo echo "192.168.0.100 awx.example.com" >> /etc/hosts
sudo echo "192.168.0.100 registry.example.com" >> /etc/hosts
sudo echo "192.168.0.100 git.example.com" >> /etc/hosts
sudo tee -a /etc/hosts <<EOF
192.168.0.100 awx.example.com
192.168.0.100 registry.example.com
192.168.0.100 git.example.com
EOF
```
2. Install and start `dnsmasq` with default configuration.
@ -407,8 +409,27 @@ One easy way to do this is to use `dnsmasq`.
'/etc/rancher/k3s/resolv.conf' \ 👈👈👈
```
5. Restart K3s.
5. Restart K3s and CoreDNS. The K3s service can be safely restarted without affecting the running resources.
```bash
sudo systemctl restart k3s
kubectl -n kube-system delete pod -l k8s-app=kube-dns
```
6. Ensure that your hostname can be resolved as defined in `/etc/hosts`.
```bash
$ kubectl run -it --rm --restart=Never busybox --image=busybox:1.28 -- nslookup git.example.com
Server: 10.43.0.10
Address 1: 10.43.0.10 kube-dns.kube-system.svc.cluster.local
Name: git.example.com
Address 1: 192.168.0.100
pod "busybox" deleted
```
7. If you update your `/etc/hosts`, restarting `dnsmasq` is required.
```bash
sudo systemctl restart dnsmasq
```