7

I have multiple MSA on k8s on GKE. Each is on separate subdomain like:

  • msa1.example.com
  • msa2.example.com

I have it in single ingress:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: main-ingress
  annotations:
    kubernetes.io/ingress.global-static-ip-name: lalala-ip-1
    kubernetes.io/ingress.allow-http: "false"
spec:
  tls:
  - hosts:
    - msa1.example.com
    secretName: msa1-tls
  backend:
    serviceName: sink
    servicePort: 80
  rules:
  - host: msa1.example.com
    http:
      paths:
      - path: /.well-known/*
        backend:
          serviceName: letsencrypt
          servicePort: 80
      - path: /*
        backend:
          serviceName: lalala
          servicePort: 80
  - host: msa2.example.com
    http:
      paths:
      - path: /*
        backend:
          serviceName: lalala2
          servicePort: 80

... and all is nice.

The thing is, that I want to have each MSA in separate file.

Problem is this kubernetes.io/ingress.global-static-ip-name: lalala-ip-1 line. If I have it in two ingresses only first started is bounded to IP, but other ones no.

Is there a way, to share IP on GKE ingress controller between two ingresses?

0

3 Answers 3

10

A way around it could be to run your own nginx-ingress controller in your cluster and expose it via LoadBalancer service type. Then you would have 1 IP for your ingress and be able to serve all ingresses via nginx controller by adding annotation kubernetes.io/ingress.class: "nginx"

Reference: https://kubernetes.github.io/ingress-nginx/user-guide/multiple-ingress/

1
  • That is in fact only solution. It's worth to mention that price is requirement to use regional IP instead of global.
    – Mateusz
    Feb 28, 2018 at 16:52
6

Confirmed my comment:

Only one resource at a time can use a static external IP address.

https://cloud.google.com/compute/docs/ip-addresses/reserve-static-external-ip-address

1
  • 1
    that is of course correct answer, but another one has solution.
    – Mateusz
    Feb 28, 2018 at 16:48
2

GKE has recently added support for the new Kubernetes Gateway API. Both the GKE Gateway implementation as well as the Kubernetes Gateway API specification are still in alpha at this point.

The Kubernetes Gateway-API, is intended to support use cases, where you have a central Gateway (with a single IP), but want different Routes (with different hostnames or paths), managed in separate objects or even namespaces.

References:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.