Is this the right use case for Service Entry?

I have a very particular requirement I have to implement and I’m not sure if a Service Entry helps me achieve it.

I have a dns name and an IP address.
DNS: DNS_NAME.com
IP: 1.1.1.1

If I try to resolve that DNS name (Public domain) using nslookup it comes back with 2.2.2.2.

My goal is to have DNS_NAME.com resolve with 1.1.1.1

The only way I was able to achieve this was to add those parameters into hostAliases as part of the deployment shown below, however I was hoping to not use Host Aliases and create something on a global or namespace level.

  hostAliases:
  - ip: "1.1.1.1"
    hostnames:
    - "DNS_NAME.com"

Here is an example on what I tried so far

apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
  name: DNS
spec:
  addresses:
  - 1.1.1.1/32
  endpoints:
  - address: 1.1.1.1
    ports:
      https: 443
  hosts:
  - DNS_NAME.com
  location: MESH_EXTERNAL
  ports:
  - name: https
    number: 443
    protocol: TLS
  resolution: STATIC

What I expect to happen:
nslookup DNS_NAME.com ----> (1.1.1.1)

What happens:
nslookup DNS_NAME.com ----> (2.2.2.2)

Istio ServiceEntries do not control DNS resolution at all

Though, you can control the request to DNS_NAME.com is proxied to 1.1.1.1

Did you find any solution? I am looking for something similar

As said by others DNS resolution is not provided by Istio…by default.

If you want DNS resolution via ServiceEntries then see this:

On separate note, your example with the k8s spec.hostAliases should work to resolve it. Check your /etc/hosts file, you should have entry in there.