Here we are asked to create external service to route traffic to an external IP address 10.0.0.3
The service can be created successfully, but the concept of using ExternalName to map external IPs seems wrong as per k8s documentation.
ExternalName will generate CNAME dns record which is an alias dns name, it should not be used with IPs. additionally, we won’t get a proxy when using ExternalName type
Either headless services or normal services with custom Endpoints/EndpointSlices are the right type to use, as per my understanding,
The service can be created without errors, but this is a discussion on the given question itself
I don’t think the mock question uses the ExternalName service type; it instead uses a documented characteristic of a service – if you don’t supply a selector, the system assumes that you have an external process that is creating an endpoint for that service. So you manually create an EndPoint (or EndPointSlice) that has the same name as the service, and you set up the IP for the service there. The solution for the problem will show you how to do this.
Hi @rob_kodekloud ,
The question I am talking about asks for ExternalName indeed.
I am referring to the one below
The solution from the “End Exam” page strikes me as a reasonable way to create an external service, although I’d agree that the docs page suggests that this service type creates a CNAME, and an IP address would be correct for an AA record, and not a CNAME:
Note:
A Service of type: ExternalName
accepts an IPv4 address string, but treats that string as a DNS name comprised of digits, not as an IP address (the internet does not however allow such names in DNS). Services with external names that resemble IPv4 addresses are not resolved by DNS servers.
If you want to map a Service directly to a specific IP address, consider using headless Services.
I’ll raise this with the team and see if they agree with you.
They in fact agree with you! The question has been changed according.