Skip to main content

APIs from External URLs

External Services refer to remote APIs that are located outside a Kubernetes cluster.


Introduction

Traefik Hub uses the ExternalName Service of Kubernetes to manage APIs which are running outside the Kubernetes cluster, such as VMs or other systems.

Using an External Domain Name

ExternalName Services don't have selectors, or any defined ports or endpoints, therefore, you can use an ExternalName Service to direct traffic to an external Service.

Using an external domain name service tells the system that the DNS name in the externalName field (api.apis.guru) is the location of the resource that backs the service.

When a DNS request is made against the Kubernetes DNS server, it returns the externalName in a CNAME record, informing the client to look up the returned name to get the IP address.

ExternalName Services are implemented at the DNS level. A CNAME DNS record is created for the service. Therefore, clients connecting to the service will connect to the external service directly.

Managing external URLs Using CRDs

FieldDescriptionRequired
spec.typeThe Kubernetes Service type, for example, ExternalName.Yes
spec.type.externalNameSpecifies the location (FQDN) at which that external Service can be reached at, for example, api.apis.guru.Yes
spec.type.ports.portSpecifies the reachable port of the external Service.No

Examples

Defines ExternalName object
apiVersion: v1
kind: Service
metadata:
name: api-apis-guru
namespace: traefik
spec:
type: ExternalName
# FQDN of the external API
externalName: api.apis.guru
ports:
- port: 443