Deploy ORDS (Oracle Rest Data Services) to Kubernetes Cluster


ords

ORDS is a piece of software that acts as an intermediary between Oracle Database and the layers where business logic is implemented and/or consumed.

NOTE: If your database hasn’t been set up for ORDS just google for it or take a look at this post.

With ORDS you expose database objects as REST. ORDS can be started standalone or in an application server. Deploying ORDS in Kubernetes as stateless pods with several replicas provide an elastic layer of rest exposition, out of the database, with high availability and fault tolerant.

ordsarch.png

First of all, we need a container ready to run ORDS in standalone mode. For this particular case, we are utilising one already done, see yaml file mentioned in next steps.

kuberneteslogo

Let’s start creating a secret for storing the password for the user that makes de connection to the database:

kubectl create secret generic ordspassword --type=string --from-literal=password=[somepassword]
Now, take a look and download this yaml file here and make changes regarding the database connection service and floating IP (SCAN in the case of a RAC or host IP in case of a single instance).
        env:
        - name: DB_HOSTNAME
          value: "example:172.16.0.7"
        - name: DB_PORT
          value: "example:1521"
        - name: DB_SERVICENAME
          value: "example:jsonpdb.xxxxxx.yyyyyy.oraclevcn.com"
        - name: APEX_PUBLIC_USER_NAME
          value: "ORDS_PUBLIC_USER"
        - name: ORDS_PASS
          valueFrom:
After that, issue the following command:
kubectl apply -f my.yaml
That’s it, verify the service is available this way:
kubectl get svc
javiermugueta$ kubectl get svc

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE

eciveci LoadBalancer 10.96.92.19 130.61.15.199 3000:31522/TCP 4d

kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 15d

ordscontainer LoadBalancer 10.96.229.248 130.61.70.73 8080:31523/TCP 2d
Now check whatever URL that you may have enabled in the schema. For more info take a look here or here.
http://serviceip:serviceport/ords/hr/employees/
That’s all!
Enjoy 😉

4 Comments

  1. unsocialsysadm (@unsocialsysadm)

    I have a setup of ords on tomcat, on OKE behind nginx ingress. The login page displays well, but I am running into 403 error hit submit to login. :

    full message :
    403 Forbidden
    The request cannot be processed because this resource does not support Cross Origin Sharing requests, or the request Origin is not authorized to access this resource. If ords is being reverse proxied ensure the front end server is propagating the host name, for mod_proxy ensure ProxyPreserveHost is set to On

    I tried to add proxyPort, proxyName, scheme and secure params to http connector but no effect.
    I added also in my nginx ingress :
    nginx.ingress.kubernetes.io/server-snippet: |
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Host $host:$server_port;
    proxy_set_header X-Forwarded-Server $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Origin “”;
    nginx.ingress.kubernetes.io/enable-cors: “true”
    nginx.ingress.kubernetes.io/cors-allow-methods: “PUT, GET, POST, OPTIONS”
    nginx.ingress.kubernetes.io/cors-allow-origin: “*”
    nginx.ingress.kubernetes.io/cors-allow-credentials: “true”

    Still nothing change.
    exposing ords on tomcat directly as loadbalancer resolves this but I don’t think it is a suitable solution.
    Any idea ?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.