We want to have 1 k8s cluster and to enable each developer to deploy their environment by separating developer's env by URI "/developerName", and an NS where every deployment of the app will be deployed on different NS.
The application is a legacy tomcat based web app.
I'm looking for a good approach where I can route the traffic of every developer based on URL to different deployments.
There is 1 restriction, where the application is expecting only the app name in the URL. i.e example.com/username/appname isn't working since the app is expecting only example.com/appname
I have deployed successfully Nginx ingress controller and checked it's working whenever I'm not using the "/developername" in the path
You can use an ingress resource. Configure each environment with different hostname:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress
namespace: developer1
spec:
rules:
- host: developer1.mytestdomain.com
http:
paths:
- backend:
serviceName: my-tomcat-service
servicePort: 8080
path: /
tls:
- hosts:
- developer1.mytestdomain.com
secretName: mysslsecret
Then setup a wildcard domain on *.mytestdomai.com
. So you don't have to add a subdomain each time and environment is built. Skip the tls
part if you don't need https
.