Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubernetes ExternalName Services

Tags:

kubernetes

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.

like image 770
Kunal Malhotra Avatar asked Jan 23 '19 12:01

Kunal Malhotra


1 Answers

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

like image 90
coolinuxoid Avatar answered Sep 17 '22 17:09

coolinuxoid