Configure /etc/hosts Entries in CoreDNS for Cloud Connector
Configure custom /etc/hosts entries to be propagated into the CoreDNS NodeHosts
ConfigMap in the Cloud Connector (K3s-based and K3d-based). This ensures that hostnames
defined on the host machine /etc/hosts files are resolvable from within
pods running in the K3s cluster.
Note: For new installations, this configuration is applied
automatically during the installation process.
Before configuring the existing cloud connectors after upgrade, ensure you have:
- SSH access to the host machine running Cloud Connector
- Necessary access permissions
- kubectl access configured to the K3s cluster
- Understanding of /etc/hosts file format and structure
- Custom hostname entries already configured in the host machine's /etc/hosts file
- Network connectivity between host machine and K3s cluster.
Important: Custom host entries added to /etc/hosts must be non-localhost entries (not 127.0.0.1). Localhost-related entries are automatically filtered out during the propagation process.
-
Verify current /etc/hosts entries on the host machine.
-
Execute the host entries propagation script.
-
Verify the CoreDNS ConfigMap update.
-
Monitor CoreDNS pod rollout restart.
-
Test hostname resolution from within a pod.
-
Configure automatic host entry propagation on system boot.
-
Handle issues and troubleshooting.
Configuring hostAliases Entries for the Platform Pod
- Log in to the Helm Cloud Connector bastion host.
-
Edit the Platform deployment by executing the following command:
kubectl edit deploy avx-mid-server-platform -n <namespace>
-
Add the
hostAliasessection under the pod specification. Ensure thathostAliasesis aligned at the same indentation level ascontainers, as shown below:spec: hostAliases: - hostnames: - external.service.local ip: 192.168.5.6 containers: - Save and exit the deployment file.
-
Verify that the entry was added successfully. List the Platform pods:
kubectl get pods -n <namespace> -
Log in to any Platform pod whose name starts with
avx-mid-server-platform:
kubectl exec -it <platform-pod-name> -n <namespace> -- bashReplace <platform-pod-name> with the actual Platform pod name.
-
Inside the pod, verify the /etc/hosts entries:
cat /etc/hosts -
Confirm that the
/etc/hostsfile contains the entry added throughhostAliases.
