Multi cname about ExternalName

kind: Service
apiVersion: v1
  name: my-service
  namespace: prod
  type: ExternalName

this could be create ,what real happen  when  using this service ?

the two cname can be resolve ? loadbalance?

An externalName service can only point to a single external address. It does not support multiple entries.

what cat I do to ?

I have two read only databases

thanks for reply

Not sure I understand your question, so please please correct me.

But what is the problem of connecting to two different endpoints?

Your best bet would probably be to setup a dns entry for them outside of your cluster.

Either an external DNS entry like @mrbobbytables said (because they can point to multiple hosts like you want), or a very simple HAProxy Pod with a configuration that does load balancing on a TCP level for you. You can then configure how much traffic should go to each of the database replicas.

I would probably go for the DNS solution, since it is just plain easier.

1 Like

ExternalName is specifically like CNAME, which can’t have multiple records. You can set up an external service (no selector) with manual Endpoints of the IPs of your database.

1 Like