Access and Expose Oracle DB service using external IP

5 views
Skip to first unread message

Sunny Anthony

unread,
Jul 9, 2021, 8:53:52 AMJul 9
to okd-wg
Hi,

I'm trying to expose Oracle database deployed as container  and run database load on the DB. I'm trying using Nodeport but unable to access the service using a VIP.  All ny Master and Worker nodes behind a private network and only OCP-Service node has access to external world and act as router/IP forwarding for OCP env. 

Please guide how I can access Oracle service from my laptop.

[root@ocp-svc ~]# oc get node -o wide
NAME                   STATUS   ROLES    AGE   VERSION           INTERNAL-IP      EXTERNAL-IP   OS-IMAGE                                                       KERNEL-VERSION                 CONTAINER-RUNTIME
ocp-cp-1.lab.ocp.lan   Ready    master   16d   v1.20.0+87cc9a4   192.168.22.201   <none>        Red Hat Enterprise Linux CoreOS 47.83.202106200838-0 (Ootpa)   4.18.0-240.22.1.el8_3.x86_64   cri-o://1.20.3-4.rhaos4.7.gitbaade70.el8
ocp-cp-2.lab.ocp.lan   Ready    master   16d   v1.20.0+87cc9a4   192.168.22.202   <none>        Red Hat Enterprise Linux CoreOS 47.83.202106200838-0 (Ootpa)   4.18.0-240.22.1.el8_3.x86_64   cri-o://1.20.3-4.rhaos4.7.gitbaade70.el8
ocp-cp-3.lab.ocp.lan   Ready    master   16d   v1.20.0+87cc9a4   192.168.22.203   <none>        Red Hat Enterprise Linux CoreOS 47.83.202106200838-0 (Ootpa)   4.18.0-240.22.1.el8_3.x86_64   cri-o://1.20.3-4.rhaos4.7.gitbaade70.el8
ocp-w-1.lab.ocp.lan    Ready    worker   16d   v1.20.0+87cc9a4   192.168.22.211   <none>        Red Hat Enterprise Linux CoreOS 47.83.202106200838-0 (Ootpa)   4.18.0-240.22.1.el8_3.x86_64   cri-o://1.20.3-4.rhaos4.7.gitbaade70.el8
ocp-w-2.lab.ocp.lan    Ready    worker   16d   v1.20.0+87cc9a4   192.168.22.212   <none>        Red Hat Enterprise Linux CoreOS 47.83.202106200838-0 (Ootpa)   4.18.0-240.22.1.el8_3.x86_64   cri-o://1.20.3-4.rhaos4.7.gitbaade70.el8
ocp-w-3.lab.ocp.lan    Ready    worker   16d   v1.20.0+87cc9a4   192.168.22.213   <none>        Red Hat Enterprise Linux CoreOS 47.83.202106200838-0 (Ootpa)   4.18.0-240.22.1.el8_3.x86_64   cri-o://1.20.3-4.rhaos4.7.gitbaade70.el8
[root@ocp-svc ~]#
[root@ocp-svc ~]# oc get statefulset
NAME              READY   AGE
oracle-db-app02   1/1     24h
[root@ocp-svc ~]# oc describe statefulset oracle-db-app02
Name:               oracle-db-app02
Namespace:          default
CreationTimestamp:  Thu, 08 Jul 2021 17:23:09 +0530
Selector:           app=oracledb,tier=oracle
Labels:             app=oracledb
Annotations:        <none>
Replicas:           1 desired | 1 total
Update Strategy:    RollingUpdate
  Partition:        0
Pods Status:        1 Running / 0 Waiting / 0 Succeeded / 0 Failed
Pod Template:
  Labels:  app=oracledb
           tier=oracle
  Containers:
   oracle-app:
    Port:       1521/TCP
    Host Port:  0/TCP
    Environment:
      DB_SID:     ocpins02
      DB_PDB:     OraPdb02
      DB_PASSWD:  oracle123
      DB_DOMAIN:  my.domain02.com
      DB_BUNDLE:  basic
      DB_MEMORY:  8g
    Mounts:
      /opt/oracle/oradata_vxfs02 from data (rw)
  Volumes:
   data:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  sdsqa-oracle-pvc02
    ReadOnly:   false
Volume Claims:  <none>
Events:         <none>
[root@ocp-svc ~]#

[root@ocp-svc ~]# oc exec -ti oracle-db-app02-0 -- bash
[oracle@oracle-db-app02-0 ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Fri Jul 9 12:52:31 2021
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> quit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@oracle-db-app02-0 ~]$ lsnrctl status

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 09-JUL-2021 12:52:38

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                08-JUL-2021 11:53:15
Uptime                    1 days 0 hr. 59 min. 23 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/product/19c/dbhome_1/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/oracle-db-app02-0/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=oracle-db-app02-0.oracle-svc02.default.svc.cluster.local)(PORT=5500))(Security=(my_wallet_directory=/opt/oracle/admin/ORCLCDB/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "ORCLCDB" has 1 instance(s).
  Instance "ORCLCDB", status READY, has 1 handler(s) for this service...
Service "ORCLCDBXDB" has 1 instance(s).
  Instance "ORCLCDB", status READY, has 1 handler(s) for this service...
Service "c69c7769d81b0b41e053a700830a9788" has 1 instance(s).
  Instance "ORCLCDB", status READY, has 1 handler(s) for this service...
Service "orclpdb1" has 1 instance(s).
  Instance "ORCLCDB", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@oracle-db-app02-0 ~]$
[root@ocp-svc ~]# oc get svc
NAME                 TYPE           CLUSTER-IP       EXTERNAL-IP                            PORT(S)          AGE
kubernetes           ClusterIP      172.30.0.1       <none>                                 443/TCP          16d
openshift            ExternalName   <none>           kubernetes.default.svc.cluster.local   <none>           16d
sdsqa-oracle-svc02   NodePort       172.30.111.211   10.221.92.160                          1521:31864/TCP   24h
[root@ocp-svc ~]# ping 10.221.92.160
PING 10.221.92.160 (10.221.92.160) 56(84) bytes of data.
From 10.221.92.146 icmp_seq=1 Destination Host Unreachable
From 10.221.92.146 icmp_seq=2 Destination Host Unreachable
From 10.221.92.146 icmp_seq=3 Destination Host Unreachable
From 10.221.92.146 icmp_seq=4 Destination Host Unreachable
From 10.221.92.146 icmp_seq=5 Destination Host Unreachable
From 10.221.92.146 icmp_seq=6 Destination Host Unreachable
^C
--- 10.221.92.160 ping statistics ---
7 packets transmitted, 0 received, +6 errors, 100% packet loss, time 136ms
pipe 4
[root@ocp-svc ~]# curl 10.221.92.160:1521
curl: (7) Failed to connect to 10.221.92.160 port 1521: No route to host
[root@ocp-svc ~]# curl 10.221.92.160:31864
curl: (7) Failed to connect to 10.221.92.160 port 31864: No route to host
[root@ocp-svc ~]#
Reply all
Reply to author
Forward
0 new messages