ori-edge / k8s_gateway

A CoreDNS plugin to resolve all types of external Kubernetes resources
Apache License 2.0
295 stars 63 forks source link

Support services with ExternalIPs using `coredns.io/hostname` #185

Closed onedr0p closed 1 year ago

onedr0p commented 1 year ago

Hi 👋🏼 I have a loadbalancer service with using external IPs instead of a load balancer IP. It would be great if I could use the coredns.io/hostname annotation on this service.

apiVersion: v1
kind: Service
metadata:
  annotations:
    coredns.io/hostname: postgres.domain.tld
  labels:
    app.kubernetes.io/instance: postgres
    app.kubernetes.io/name: postgres
  name: postgres
  namespace: default
spec:
  externalIPs:
  - 192.168.69.113
  externalTrafficPolicy: Local
  ports:
  - name: postgres
    port: 5432
    protocol: TCP
    targetPort: 5432
  selector:
    postgresql: postgres
    role: primary
  type: LoadBalancer
# Status is not being populated on viewing the status of this service
# status:
#   loadBalancer: {}
haraldkoch commented 1 year ago

As an example, kubernetes-sigs/external-dns will read the spec.externalIPs section of a Service: https://github.com/kubernetes-sigs/external-dns/blob/master/README.md#note

onedr0p commented 1 year ago

@networkop thanks! confirmed working in the latest version