Search code examples
web-applicationsopenshift

Running two applications on Openshift 4.5 cluster


I have to run two web applications on Openshift cluster. But only the one which is brought up first is accessible, the other one gives Application is not available error. I have used two different services for them and used oc expose service servicename command to make them publicly available. The route is using reencrypt tls termination type.

apiVersion: v1
kind: Service
metadata:
   annotations:
     service.alpha.openshift.io/serving-cert-secret-name: service-certs
   name: webapp1
   labels:
   app: webapp1
spec:
  ports:
  - name: 8443-tcp
    port: 8443
    protocol: TCP
    targetPort: 8443
 selector:
   app: webapp1
---
kind: Route
apiVersion: route.openshift.io/v1
metadata:
  name: webapp1
  labels:
    app: webapp1
spec:
  port:
    targetPort: 8443-tcp
    tls:
      termination: reencrypt
    to:
      kind: Service
      name: webapp1

Replacing webapp1 with webapp2 to create the service and route for application webapp2. Only the one which is run first is working. This is on AWS cloud. I can access the failed one if I use edge tls, for this I have to make the webapp http.

What has to be done to access both of them, with reencrypt routing type or any other way by not changing to http?


Solution

  • I have fixed it by using a different name for the secret in annotation. The same secret name service-certs was the problem. I am using the key and certificate stored in the container to generate the keystore, which was used from the webapp.