I have an app running in Kubernetes clusters which is accessing to a public API URL for e.g. api.server123.com
. The app is accessing it within its code itself
I want to resolve that public UZRL to an internal IP like how we can do it in /etc/host
i.e. an entry like 1.2.3.4 api.server123.com
where that IP belongs to one of our internal servers. This is for me to see the payload sent out and some internal checks.
Can I do this via the CoreDNS?
I did it like this but does not seems to work.
Corefile: |-
.:53 {
errors
health
kubernetes cluster.local. in-addr.arpa ip6.arpa {
pods insecure
upstream
fallthrough in-addr.arpa ip6.arpa
}
hosts {
1.2.3.4 api.server123.com
fallthrough
}
prometheus :9153
forward . /etc/resolv.conf
cache 30
reload
loadbalance
}
Is this the correct way to resolve a public URL to an internal IP within Kubernetes?