0

I am migrating my current service to Kubernetes. Currently back end services are resolved via mod_cluster. mod cluster manager runs on httpd and mod_cluster clients auto register their web contexts with httpd/mod_cluster manager on startup

user-->ingress-rule--> httpd [running mod_cluster manager]--> Jboss[mod_cluster clients]

I resolve my UI via the following ingress rule

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: httpd
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/ssl-passthrough: "true"
spec:
  rules:
  - host: myk8s.myath.myserv.com
    http:
      paths:
      - path: /
        backend:
          serviceName: httpd
          servicePort: 443
  tls:
  - hosts:
    - myk8s.myath.myserv.com

This works well, resolves UI, can log in and resolve all static content etc.

Mod cluster exposes services such as myservice. I disabled mod_cluster and created a Kubernetes service myservice that resolved to the back-end Pod thinking that the Ingress rule would get the request as far as httpd and then httpd would be able to resolve the backend service via Kubernetes but i get 404s as I am unable to resolve myservice

Service can be resolved via Reverse proxy rules such as below, but this is not preferred solution

# Redirect to myjbossserv
ProxyPass /myservice/services/command/  http://myjbossserv:8080/myservice/services/command/          <-----myjbossserv is a service registered in kubernetes
ProxyPassReverse /myservice/services/command/  http://myjbossserv:8080/myservice/services/command/

Any help much appreciated

user1843591
  • 1,074
  • 3
  • 17
  • 37
  • 404 means backend successfully processed your request but did not find the data. You may have miss-configured something inside your jboss paths, or requests are different from what was expected by jboss. – Nick Rak Jun 14 '18 at 09:46
  • Could you also provide list of services and describe your `httpd` service is all is fine with it? – Nick Rak Jun 14 '18 at 10:00
  • Have you deployed an ingress controller? – Nicola Ben Jun 14 '18 at 12:04
  • Hi @NickRak 1. yes I have deployed ingress controller, ingress rule deployed above 2. If i leave mod cluster enabled I can see request getting to httpd. then httpd/mod_cluster manager resolves the back-end service such as myservice 3. If I disable modcluster manager I can see request getting to httpd and then httpd tries to resolve static content /var/www/myservice but cannot. It does not try to resolve a service. 4. if i use revers proxy rules instead of mod_cluster it works! but this is not very "cloud-native" – user1843591 Jun 14 '18 at 15:35
  • @NickRak addeddum: i've added working Revers proxy rules to the main qn... – user1843591 Jun 14 '18 at 15:37
  • @NicolaBenaglia Yes... ingress rule above and ingress controller is nginx. This part appears to work fine but when request gets to apache it does not try to resolve a Kubernetes service instead it looks for static content on file system – user1843591 Jun 14 '18 at 15:38

1 Answers1

0

The simplest way to solve this...catering for all HA and robustness use cases was to use reverse proxy rules. There are multiple ways to configure these such as at image build time or via config maps...

# Redirect to myjbossserv
ProxyPass /myservice/services/command/  http://myjbossserv:8080/myservice/services/command/          <-----myjbossserv is a service registered in kubernetes
ProxyPassReverse /myservice/services/command/  http://myjbossserv:8080/myservice/services/command/
user1843591
  • 1,074
  • 3
  • 17
  • 37