Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a path based Ingress on a GKE cluster

So I am in the process of migrating my bare metal cluster onto GKE and ran into an issue with the ingress. On my bare metal cluster, I used the ingress controller from nginxinc which worked fine. Below is a sample of an Ingress file of a particular deployment:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
namespace: mynamespace
name: app-ingress
annotations: 
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
    nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
rules:
- host: myhost
    http:
    paths:
    - path: /dev/appname(/|$)(.*)
        backend:
          serviceName: app
          servicePort: 80

Basically, when a user types in myhost/dev/appname, myhost is resolved to a HAProxy server. The proxy then routes the request to the NodePort that the ingress service is running on.

I tried to do the same thing on my GKE cluster with the only exception being that the Ingress controller on the GKE cluster is exposed using a LoadBalancer as per the documentation

However I get a 502 error if I try to access the URL.

TL;DR: Looking for the best way to access various applications (deployments) deployed on a GKE cluster using URL's like: myhost/dev/firstapp and myhost/dev/secondapp etc.

like image 500
user538578964 Avatar asked Dec 06 '25 18:12

user538578964


1 Answers

You can use Kong Ingress as your ingress controller on GKE for your path based ingresses. You can install Kong Ingress from GCP Marketplace. It is easy to integrate and also supports various plugins for authenticating, monitoring etc.

You'll get detailed information and installation instructions from https://github.com/Kong/google-marketplace-kong-app#basic-usage

like image 152
Shahed Mehbub Avatar answered Dec 08 '25 10:12

Shahed Mehbub



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!