Can I point an Ingress controller to an external service like AWS S3

12/14/2018

I want to have a setup where my dns points to my EKS cluster, and my EKS cluster points api.server.com/static

to files on S3 and api.server.com/api to my tomcat deployment.

I'm curious if and how this is possible.

-- Calicoder
amazon-eks
kubernetes

1 Answer

12/14/2018

Yes, you can add a service of "externalName" type pointing to an external domain name. This has to be a FQDN, not a URL though, you need to add routing logic to your ingress.

---
apiVersion: v1
kind: Service
metadata:
  name: external
  namespace: default
  labels:
    app: external
spec:
  type: ExternalName # <-- this is the service type for external resources
  externalName: s3.amazon.fqdn # <-- put your external domain here
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: external
  namespace: default
  nginx.ingress.kubernetes.io/rewrite-target: / # <-- your routing logic?
spec:
  rules:
  - http:
      paths:
      - path: /static # <-- your routing logic
        backend:
          serviceName: external # <-- your service name
          servicePort: 80
-- Markus Dresch
Source: StackOverflow