Hosting multiple domains in GKE Ingress

In this article we will go through how you can point multiple domains to Single ingress on Google Cloud.

For this article we are going to assume that you already understand how to host a website or service on GKE. You can also follow our one of the older post on it.

Step 1: Reserve static ip address

You should reserve an static ip address for your ingress. Follow official doc

Step 2: Generate Google managed certificates for each domain

You should create certificates for each domain. Follow the official document

Step 3: Define the ingress with the domains and certificates

In the below we have used example-ip-address as the static ip address of the ingress.

Three certificates for three domains which we are going to host on this ingress.

example-domain1-cert,example-domain2-cert,example-domain3-cert”

And finally we map these domains to a backend service.

In the above example i am using same service as a backend for all the domains. You can change them to different backend services. Also you can change the port information to the values which you are using.

Once you apply your ingress changes. You can see your ingress showing 3 endpoints in the GKE console.

There could be multiple reasons when you would like to have multiple domains pointing to same backend service. An example would be having a single service to different country specific domains etc.

Let me know if this was helpful. You can follow us on twitter

https://twitter.com/k8scaleio

Simplifying writing cloud connected Apps.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store