I have created a Kubernetes Service with type ExternalName, I understand this service act as a proxy and redirect the request to the external service sitting outside the cluster. I am able to create the service but not able to curl it i.e I get 500 error. I wanna understand how this ExternalName Kubernetes service work.
Services with type ExternalName
work as other regular services, but when you want to access to that service name, instead of returning cluster-ip of this service, it returns CNAME record with value that mentioned in externalName:
parameter of service.
As example mentioned in Kubernetes Documentation:
kind: Service
apiVersion: v1
metadata:
name: my-service
spec:
type: ExternalName
externalName: my.database.example.com
When you want to do curl -v http://my-service
or curl -v http://my-service.default.svc.cluster.local
according your namespace(in this example it is default), it will redirect you at the DNS level to http://my.database.example.com
I hope it was useful