github.com/nginxinc/kubernetes-ingress@v1.12.5/examples/externalname-services/README.md (about)

     1  # Support for Type ExternalName Services
     2  The Ingress Controller supports routing requests to services of the type [ExternalName](https://kubernetes.io/docs/concepts/services-networking/service/#externalname).
     3   
     4  An ExternalName service is defined by an external DNS name that is resolved into the IP addresses, typically external to the cluster. This enables to use the Ingress Controller to route requests to the destinations outside of the cluster. 
     5  
     6  **Note:** This feature is only available in NGINX Plus.
     7  
     8  
     9  ## Prerequisites
    10  To use ExternalName services, first you need to configure one or more resolvers using the ConfigMap. NGINX Plus will use those resolvers to resolve DNS names of the services.
    11  
    12  For example, the following ConfigMap configures one resolver:
    13  
    14  ```yaml
    15  kind: ConfigMap
    16  apiVersion: v1
    17  metadata:
    18    name: nginx-config
    19    namespace: nginx-ingress
    20  data:
    21    resolver-addresses: "10.0.0.10"
    22  ```
    23  
    24  Additional resolver parameters, including the caching of DNS records, are available. Check the corresponding [ConfigMap](https://docs.nginx.com/nginx-ingress-controller/configuration/global-configuration/configmap-resource/) section.
    25  
    26  
    27  ## Example
    28  In the following yaml file we define an ExternalName service with the name my-service:
    29  
    30  ```yaml
    31  kind: Service
    32  apiVersion: v1
    33  metadata:
    34    name: my-service
    35  spec:
    36    type: ExternalName
    37    externalName: my.service.example.com
    38  ```
    39  
    40  In the following Ingress resource we use my-service:
    41  
    42  ```yaml
    43  apiVersion: networking.k8s.io/v1beta1
    44  kind: Ingress
    45  metadata:
    46    name: example-ingress
    47    annotations:
    48      kubernetes.io/ingress.class: "nginx"
    49  spec:
    50    rules:
    51    - host: example.com
    52      http:
    53        paths:
    54        - path: /
    55          backend:
    56            serviceName: my-service
    57            servicePort: 80
    58  
    59  ```
    60  
    61  As a result, NGINX Plus will route requests for “example.com” to the IP addresses behind the DNS name my.service.example.com.