Camunda page is not loading with K8s nginx rewrite annotation

Hi,
I have camunda spring boot application deployed as K8s deployment and have 2 replicas running. To enable session affinity, have configured K8s nginx. i am using rewrite annotation to to differentiate multiple microservices running. Below is my ingress resource definition and the url that am using to access the camunda page - http://:/sample/camunda/app/welcome/default/

    apiVersion: extensions/v1beta1
    kind: Ingress
   metadata:
   name: myservice
  annotations:
     nginx.ingress.kubernetes.io/affinity: "cookie"
     nginx.ingress.kubernetes.io/session-cookie-name: "sample"
     nginx.ingress.kubernetes.io/session-cookie-expires: "172800"
     nginx.ingress.kubernetes.io/session-cookie-max-age: "172800"
     nginx.ingress.kubernetes.io/use-port-in-redirects: "false"
     nginx.ingress.kubernetes.io/rewrite-target: /camunda/app/welcome/default/
    spec:
     rules:
    - http:
       paths:
       - backend:
           serviceName: myservice-service
           servicePort: 61055
         path: /sample

if I dont use rewrite annotation and use the below definition , it works fine with the url - http://:/camunda/app/welcome/default/

       apiVersion: extensions/v1beta1
       kind: Ingress
      metadata:
         name: myservice
         annotations:
           nginx.ingress.kubernetes.io/affinity: "cookie"
           nginx.ingress.kubernetes.io/session-cookie-name: "sample"
           nginx.ingress.kubernetes.io/session-cookie-expires: "172800"
           nginx.ingress.kubernetes.io/session-cookie-max-age: "172800"
           nginx.ingress.kubernetes.io/use-port-in-redirects: "false"    
       spec:
         rules:
         - http:
           paths:
            - backend:
              serviceName: myservice-service
              servicePort: 61055
             path: /

As I need to use different paths for different services, I had to go for rewrite annotation. But the camunda page is not loading if I use rewrite rule. Could you please suggest a solution?

You need to the change the base URL by using Camunda 7.13 feature . As a few microservices will be deployed in the k8s and the ask to access the microservice(camunda cockpit) using the context path . To do that you need to inject below parameter .
-Dcamunda.bpm.webapp.application-path=/

Hello, did you come up with a solution to this? I’ve tried both camunda.bpm.webapp.application-path=/sample and server.servlet.context-path=/sample and was not successful. @Revathi

I’ve ended up solving the issue by looking at the Camunda Keycload Kubernetes example https://github.com/camunda/camunda-bpm-identity-keycloak/tree/master/examples/sso-kubernetes it was a combination of the ingress configuration and the camunda.bpm.webapp.application-path= + server.servlet.context-path=/sample

I learn from you that the solution is enabling sticky-sessions using cookies to ingress controller (K8s nginx). This would ensure that all requests from a given user are directed to the same instance over a configurable period of time.

It’s a good solution and resolve the login cookpit.

But i’ve a important question:

into my architecture there are:

  1. 1 microservices camunda with 2 POD
  2. Others microservices that call api rest camunda fecthAndLock.

if i enable sticky-sessions, lose the benefit of scaling pod? All requests from a microservice A to Camunda are directed to the same POD?

Hi @giosefer, welcome to the forums! This thread is almost three years old! I would recommend starting a new topic with your questions about your architecture; not only is this topic very old, but the questions aren’t directly related to the original issue.