Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support services of type ExternalName #87

Closed
jasonchester opened this issue Jan 14, 2019 · 9 comments
Closed

Support services of type ExternalName #87

jasonchester opened this issue Jan 14, 2019 · 9 comments
Assignees
Labels
feature New feature or request Needs Clarity Issues that are vague or don't have enough context to make a concrete plan to move forward.

Comments

@jasonchester
Copy link

Add support for App Gateway proxying of ExternalName services.

https://kubernetes.io/docs/concepts/services-networking/service/#externalname
kubernetes/ingress-nginx#629 (comment)

Describe the solution you'd like
External name services defined in k8s should be exposed through app gateway when configured with app gateway ingress annotations.

@asridharan
Copy link
Contributor

asridharan commented Feb 7, 2019

@jasonchester could you elaborate a bit more on the ask here? The links linked to ingress-nginx are extremely cryptic and look very hacky. Would like to see a proposal in the AG context here rather than copying whatever nginx does.

I am trying to see a use-case for this. The whole idea of ExternalName was to expose the external service (running outside k8s) to internal pods running in the k8s cluster. So wondering how AG will even come in play in a such a scenario. A description of the use-case you had in mind would help here.

@asridharan asridharan added feature New feature or request Needs Clarity Issues that are vague or don't have enough context to make a concrete plan to move forward. labels Feb 7, 2019
@asridharan asridharan self-assigned this Feb 7, 2019
@jasonchester
Copy link
Author

jasonchester commented Feb 11, 2019

We have an multitenant (100's of tenant specific hostnames) application that we are in the process of modernizing. The application consists of a an ASP.NET forms monolith and new services we are developing in dotnet core that will run in Kubernetes.

  • The aspnet forms application running on IaaS Windows Virtual Machines and will listen to the be the default route.
    -- https://<tenanturl>.company.co/*
  • New services build in dotnet core will be hosted in cluster and published on the same tenanturls.
    -- https://<tenanturl>.company.co/api/service/v1/*

The use case we are looking to enable is:

  1. Create an external service for the aspnet forms app backend. This is likely a load balancer fronting a handful of IaaS Web Servers.
  2. Configure ingress for tenants exposing both the legacy and kubernetes services on the same app gateway.

here's an example of what resources in kubernetes might look like for this scenario... not tested or complete but for example.

apiVersion: v1
kind: Service
metadata:
  name: svc-legacy-forms-ext
spec:
  type: ExternalName
  externalName: lb.formsapp.company.com

---

apiVersion: v1
kind: Service
metadata:
  name: svc-checkout-api-v1
spec:
  selector:
    app: checkout-api-v1
  ports:
  - name: http
    protocol: TCP
    port: 80
    targetPort: 9376

---

apiVersion: v1
kind: Service
metadata:
  name: svc-notifications-api-v1
spec:
  selector:
    app: notifications-api-v1
  ports:
  - name: http
    protocol: TCP
    port: 80
    targetPort: 9376
    
---

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: hybrid-app-ingress
spec:
  tls:
  - hosts:
    - tenantA.company.com
    - tenantB.company.com
    secretName: wildcard-company-com-tls
  rules:
  - host: tenantA.company.com
    http:
      paths:
      - path: /
        backend:
          serviceName: svc-legacy-forms-ext  #external service
          servicePort: 80
      - path: /api/notifications/v1/
        backend:
          serviceName: svc-notifications-api-v1 #kubernetes service
          servicePort: 80
      - path: /api/checkout/v1/
        backend:
          serviceName: svc-checkout-api-v1 #kubernetes service
          servicePort: 80
  - host: tenantB.company.com
    http:
      paths:
      - path: /
        backend:
          serviceName: svc-legacy-forms-ext  #external service
          servicePort: 80
      - path: /api/notifications/v1/
        backend:
          serviceName: svc-notifications-api-v1 #kubernetes service
          servicePort: 80
      - path: /api/checkout/v1/
        backend:
          serviceName: svc-checkout-api-v1 #kubernetes service
          servicePort: 80

@jasonchester
Copy link
Author

@asridharan is additional clarification needed or can the needs-clarity tag be removed.

thanks

@draychev draychev assigned draychev and unassigned asridharan Jul 12, 2019
@shinji
Copy link

shinji commented Mar 10, 2020

@jasonchester
@draychev

We are temporarily implementing the following workaround using a TCP Proxy, it is a bad practice, but it can help with the tests and understand what we want with the use case:

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: legacy-forms-ext
  labels:
    app: legacy-forms-ext
spec:
  replicas: 4
  selector:
    matchLabels:
      app: legacy-forms-ext
  template:
    metadata:
      labels:
        app: legacy-forms-ext
    spec:
      containers:
        - name: legacy-forms-ext
          imagePullPolicy: Always
          image: tecnativa/tcp-proxy:latest
          env:
            - name: LISTEN
              value: ":443"
            - name: TALK
              value: lb.formsapp.company.com
          ports:
            - containerPort: 443
          livenessProbe:
            httpGet:
              path: /
              port: 443
              host: lb.formsapp.company.com
              scheme: HTTPS
            periodSeconds: 20
          readinessProbe:
            httpGet:
              path: /
              port: 443
              host: lb.formsapp.company.com
              scheme: HTTPS
            periodSeconds: 10



---
apiVersion: v1
kind: Service
metadata:
  name: svc-legacy-forms-ext
spec:
  selector:
    app: legacy-forms-ext
  ports:
    - protocol: TCP
      port: 443
      targetPort: 443



---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: legacy-app-ingress
  annotations:
    kubernetes.io/ingress.class: azure/application-gateway
    appgw.ingress.kubernetes.io/backend-hostname: lb.formsapp.company.com
    appgw.ingress.kubernetes.io/backend-protocol: https
spec:
  tls:
  - hosts:
    - tenantA.company.com
    secretName: wildcard-company-com-tls
  rules:
  - host: tenantA.company.com
    http:
      paths:
      - path: /
        backend:
          serviceName: svc-legacy-forms-ext
          servicePort: 443

@jasonchester
Copy link
Author

@shinji glad to see some activity on this request...

The lack of any progress on this issue from the @Azure team which hasn't even removed the needs-clarity tag has caused me to lose confidence in app-gateway as a serious solution for our ingress needs. We're using the nginx ingress behind a internal azure LoadBalancer service and other than the same namespace service limitations (which to be fair are by design) it has been doing great for us.

@tplive
Copy link

tplive commented Nov 11, 2020

We are in the same situation as @jasonchester where we are migrating a system partly from a legacy system, but need to route certain paths to the legacy system for now. We are solving this by letting AKS and AGIC handle configuring of AG for the moved resources, and then setting up another AG "in front" of that to handle the external legacy routing. It would be of great benefit if AGIC would configure ExternalName and ExternalIP resources for us, as we are looking at having to repeat this extra configuration for multiple clusters for both test and prod environments. So please look into providing this functionality.

@andrejbrummelhuis
Copy link

andrejbrummelhuis commented Aug 2, 2021

also desperately missing this feature as we have the same requirements as mentioned by @jasonchester

@mikedennis
Copy link

Does anyone have a good workaround for this other than the ones already mentioned in the thread?

@akshaysngupta
Copy link
Member

Tracked here #1567

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request Needs Clarity Issues that are vague or don't have enough context to make a concrete plan to move forward.
Projects
None yet
Development

No branches or pull requests

8 participants