ExternalName in managed kubernetes; Host not resolve

Asking for help? Comment out what you need so we can get more information to help you!

Cluster information:

Kubernetes version: 1.28
Cloud being used: bare-metal
Installation method: Kubeadm init
Host OS: Ubuntu
CNI and version:
CRI and version: CRIO on proxy

Hi everyone, As in above image , I have a managed k8s v 1.28 running on a Ubuntu PC. I have some web api available in another machine. This is a intranet network. Typicaly i modify /etc/hosts file and api are able to connect to IIS via custom domain.

In this senario, I created below external service

apiVersion: v1
kind: Service
metadata:
  name: external-api
  namespace: demo
spec:
  type: ExternalName
  externalName: 10.12.0.1

I also created a ConfigMap, Now i removed this

apiVersion: v1
kind: ConfigMap
metadata:
  name: custom-dns-config
  namespace: demo
data:
  Corefile: |
    .:53 {
        errors
        health
        kubernetes cluster.local in-addr.arpa ip6.arpa {
          pods insecure
          upstream /etc/resolv.conf
          fallthrough in-addr.arpa ip6.arpa
        }
        prometheus :9153
        forward . /etc/resolv.conf
        cache 30
        loop
        reload
        loadbalance
        hosts {
            nodea.dev 10.12.0.1
            fallthrough
        }
    }

still when in do kubectl exec -it poda -- nslookup nodea.dev It is not able to resolve. Since this is a managed K8s, do i need to modify coredns directly, but how can i automate later ?

This is how it used in code

  "auth":{
        "clientId":"WebClient",
        "authority":"https://external-api/auth-server",
        "authenticationServerUrl":"https://external-api/auth-server",
        "signInType":"redirect",
        }

I expect https://nodea.dev should be resolved inside pod

Since external IP and domain name are dynamic depends on env, I want to convert this total solution to a helm chart eventualy and read the external ip and custom domain from values.yaml file.

Thank you for time and consideration. Any comments are helpfull. Thank you

Hi,
Have you considered below option?

It should do the trick