0

I have a fairly simple (SpringBoot) app that listens on the following port:

I'm trying to deploy this app on OpenShift cluster. The configuration looks like below:

Here are the YAMLs I have:

Deployment config:

apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
  labels:
    app: pricing-sim-depl
  name: pricing-sim-deployment
  namespace: my-namespace
spec:
  replicas: 1
  selector:
    app: pricing-sim-depl
  strategy:
    resources:
      limits:
        cpu: 200m
        memory: 1024Mi
      requests:
        cpu: 100m
        memory: 512Mi
    type: Recreate
  template:
    metadata:
      labels:
        app: pricing-sim-depl
    spec:
      containers:
        - image: >-
            my-docker-registry/alex/pricing-sim:latest
          name: pricing-sim-pod
          ports:
            - containerPort: 8080
              protocol: TCP
            - containerPort: 1141
              protocol: TCP
          tty: true
          resources:
            limits:
              cpu: 200m
              memory: 1024Mi
            requests:
              cpu: 100m
              memory: 512Mi

Then I created a ClusterIP service for accessing the HTTP Swagger page:

apiVersion: v1
kind: Service
metadata:
  labels:
    app: pricing-sim-sv
  name: pricing-sim-service
  namespace: my-namespace
spec:
  ports:
    - name: swagger-port
      port: 8080
      protocol: TCP
      targetPort: 8080
  selector:
    app: pricing-sim-depl
  type: ClusterIP

and also the Router for accessing it:

apiVersion: route.openshift.io/v1
kind: Route
metadata:
  labels:
    app: pricing-sim-tn-swagger
  name: pricing-sim-tunnel-swagger
  namespace: my-namespace
spec:
  host: pricing-sim-swagger-my-namespace.apps.cpaas.service.test
  port:
    targetPort: swagger-port
  to:
    kind: Service
    name: pricing-sim-service
    weight: 100
  wildcardPolicy: None

The last component is a NodePort service to access the FIX port:

apiVersion: v1
kind: Service
metadata:
  labels:
    app: pricing-sim-esp-service
  name: pricing-sim-esp-service
  namespace: my-namespace
spec:
  type: NodePort
  ports:
    - port: 1141
      protocol: TCP
      targetPort: 1141
      nodePort: 30005
  selector:
    app: pricing-sim-depl

So far, the ClusterIP & Router works fine. I can access the swagger page at http://fxc-fix-engine-swagger-my-namespace.apps.cpaas.service.test

However, I'm not sure how I can access the FIX port (defined by NodePort service above). First, I cant use Router - as it is not a HTTP endpoint (and thats why I defined it as NodePort). Looking at OpenShift page, I can see the following for 'pricing-sim-esp-service':

Selectors:
app=pricing-sim-depl
Type: NodePort
IP: 172.30.11.238
Hostname: pricing-sim-esp-service.my-namespace.svc.cluster.local 
Session affinity: None

Traffic (one row)
Route/Node Port: 30005
Service Port: 1141/TCP
Target Port: 1141
Hostname: none
TLS Termination: none

BTW.. i'm following the suggestion on this StackOverflow post: OpenShift :: How do we enable traffic into pod on a custom port (non-web / non-http)

I've also tried using LoadBalancer service type. Which actually gives external IP on the service page above. But that 'external IP' doesnt seem to be accessible from my local PC either.

The version of openshift we are running is:

  1. OpenShift Master: v3.11.374
  2. Kubernetes Master: v1.11.0+d4cacc0
  3. OpenShift Web Console: 3.11.374-1-3365aaf

Thank you in advance!

caffeine_inquisitor
  • 617
  • 1
  • 9
  • 21
  • "But that 'external IP doesnt seem to be accessible from my local PC either" - what does "doesnt seem to be accessible" mean to you? what do you exactly see? any error messages? – Matt Mar 24 '21 at 14:26
  • What i meant was.. when i tried to telnet using external IP + port.. it hangs. – caffeine_inquisitor Mar 24 '21 at 23:06
  • If hangs then check firewall. If you were getting some errors (e.g. conn refused) issue would be somewhere else. – Matt Mar 25 '21 at 08:54
  • Can you confirm that this was indeed firewall? or maybe you have managed to find some other reason of droppping packets? – Matt Apr 06 '21 at 14:00

0 Answers0