Generally you should use K8s services objects to define custom DNS mappings. However some advanced DNS setups might not be possible then, for example if you need to create wildcard DNS aliases.
In this case, you can create custom DNS records in the cluster's internal DNS service (kube-dns) by editing the coredns configmap like below.
Here we are adding the file
plugin to describe an authoritative zone containing a wildcard A record and we also create the required zone file.
apiVersion: v1
kind: ConfigMap
metadata:
name: rke2-coredns-rke2-coredns
(TRUNCATED)
data:
Corefile: |+
.:53 {
errors
health {
lameduck 5s
}
ready
kubernetes cluster.local cluster.local in-addr.arpa ip6.arpa {
pods insecure
fallthrough in-addr.arpa ip6.arpa
ttl 30
}
prometheus 0.0.0.0:9153
forward . /etc/resolv.conf
cache 30
loop
reload
loadbalance
file /etc/coredns/custom-zone.db mcc226.3gppnetwork.org {
upstream
}
}
custom-zone.db: |+
$TTL 3600
*.5gc.mnc123.mcc226.3gppnetwork.org. IN A 17.125.1.124