Hey everyone, I'm trying to get some local host entries integrated into the CoreDNS of my Kubernetes setup. I've drafted a YAML to add custom DNS entries but when I boot a Fedora container, I can't see these entries in the host table. Here's what I've got:
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: coredns-custom
namespace: kube-system
data:
# The key name can be anything, but must end with .override
local-containers.override: |
hosts {
192.168.12.6 oracle.fedora.local broker01.fedora.local broker02.fedora.local broker03.fedora.local oracle broker01 broker02 broker03
fallthrough
}
```
I noticed the config map seems to expect files in `etc/coredns/custom/*.override`, but I'm not sure if what I've created fits that requirement. I briefly experimented with adding a custom host block, but that broke DNS in the containers. Plus, a block for Docker hosts didn't persist. Ultimately, I'm just looking for a way to set up custom name resolution without going through the hassle of setting up a full DNS server. For what it's worth, after implementing the above configuration, my CoreDNS pod fails to start. Any insights would be greatly appreciated!
2 Answers
It looks like you might be missing some details in your setup. Check out this guide that talks about adding custom hosts to Kubernetes. The `local-containers.override` might not be recognized as part of the Kubernetes standard, which could be why you're not seeing those entries. Here's the link: [How to add custom hosts](https://hjrocha.medium.com/add-a-custom-host-to-kubernetes-a06472cedccb).
Another approach you could consider is using the `hostAlias` feature directly in your deployment definitions. This allows you to specify hostnames right in the deployment file, which might be easier than messing with CoreDNS directly. You can find more info about it here: [Customize Hosts File for Pods](https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/).

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically