Create ExternalName Service¶
An ExternalName
service is a type of service in kubernetes that allows you to create a service that simply points to an external service by its DNS name, rather than routing traffic to a set of pods.
Let's see this in action!
Step 1: Create ExternalName Service¶
Let's create an ExternalName service as follows:
Please note that we do not have selectors
available for ExternalName
services as they do not route traffic directly to pods but rather use an external DNS to resolve the service.
Let's apply the manifest to create the service:
Step 2: Verify the Service¶
Note the EXTERNAL-IP
field in the output. You'll see the external DNS the service resolves to.
Step 3: Access the Service¶
Let's see what happens when you access the service.
-
Create a simple pod that has ping Linux utility:
-
Start a shell session inside busybox container of the pod:
-
Ping the service:
You'll notice that it resolves to google.com
which is the external DNS name configured for the service.