Skip to content

Commit 3a49ff3

Browse files
author
abhisbyk
committed
Readme changes for TCPS and custom ports
Signed-off-by: abhisbyk <[email protected]>
1 parent ea48a4e commit 3a49ff3

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

docs/sidb/README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Oracle Database Operator for Kubernetes (`OraOperator`) includes the Single Inst
2121
* [Advanced Database Configurations](#advanced-database-configurations)
2222
* [Run Database with Multiple Replicas](#run-database-with-multiple-replicas)
2323
* [Setup Database with LoadBalancer](#setup-database-with-loadbalancer)
24+
* [Enabling TCPS Connections](#enabling-tcps-connections)
25+
* [Specifying Custom Ports](#specifying-custom-ports)
2426
* [OracleRestDataService Resource](#oraclerestdataservice-resource)
2527
* [REST Enable a Database](#rest-enable-a-database)
2628
* [Provision ORDS](#provision-ords)
@@ -504,6 +506,62 @@ $ kubectl --type=merge -p '{"spec":{"loadBalancer": true}}' patch singleinstance
504506
singleinstancedatabase.database.oracle.com/sidb-sample patched
505507
```
506508

509+
### Enabling TCPS Connections
510+
You can enable TCPS connections in the database by setting the `enableTCPS` field to `true` in the [config/samples/sidb/singleinstancedatabase.yaml](../../config/samples/sidb/singleinstancedatabase.yaml) file, and applying it using `kubectl apply` command.
511+
512+
Alternatively, you can use the following command:
513+
```bash
514+
kubectl patch --type=merge singleinstancedatabases.database.oracle.com sidb-sample -p '{"spec": {"enableTCPS": true}}'
515+
```
516+
517+
When TCPS connections are enabled, a Kubernetes event is published notifying the same. This event can be seen by any one of the following commands:
518+
```bash
519+
kubectl describe singleinstancedatabases.database.oracle.com sidb-sample
520+
521+
kubectl get events
522+
```
523+
524+
Once TCPS connections are enabled, the database connect string will change accordingly. The TCPS connections status can also be queried by the following command:
525+
```bash
526+
kubectl get singleinstancedatabase sidb-sample -o "jsonpath={.status.isTcpsEnabled}"
527+
true
528+
```
529+
530+
The following steps are required to connect the Database using TCPS:
531+
- You need to download the wallet from the Persistent Volume(PV) attached with the database pod. You can use the following command to get the list of pod:
532+
```bash
533+
kubectl get po
534+
NAME READY STATUS RESTARTS AGE
535+
sidb-sample-gaqoe 1/1 Running 0 3d14h
536+
```
537+
- The location of the wallet inside the pod is as `/opt/oracle/oradata/clientWallet/$ORACLE_SID`. **Let us assume the `ORACLE_SID` is `ORCL1` for the upcoming example commands**. The sample command to download the wallet is as follows:
538+
```bash
539+
kubectl cp sidb-sample-gaqoe:/opt/oracle/oradata/clientWallet/ORCL1 <Destination directory>
540+
```
541+
- This wallet includes the sample `tnsnames.ora` and `sqlnet.ora` files. All the TNS entries for the database (corresponding to the CDB and PDB) resides in `tnsnames.ora` file. You need to go inside the downloaded wallet directory and set the `TNS_ADMIN` environment variable to point to the current directory as follows:
542+
```bash
543+
# After going inside the downloaded wallet directory
544+
export TNS_ADMIN=$(pwd)
545+
```
546+
After this, you can connect using SQL\*Plus using the following sample commands:
547+
```bash
548+
sqlplus sys@ORCL1 as sysdba
549+
550+
sqlplus system@ORCL1
551+
```
552+
**NOTE:**
553+
- Only database server authentication is supported (no mTLS).
554+
- When TCPS is enabled, a self-signed certificate is generated and stored inside the wallets. For users' convenience, a client-side wallet is generated and stored at `/opt/oracle/oradata/clientWallet/$ORACLE_SID` location.
555+
- The self-signed certificate used with TCPS has validity for 3 years. After the certificate is expired, it will be renewed by the `OraOperator` automatically. You need to download the wallet again after the auto-renewal.
556+
557+
### Specifying Custom Ports
558+
As mentioned in the section [Setup Database with LoadBalancer](#setup-database-with-loadbalancer), there are two kubernetes services possible for the database: NodePort and LoadBalancer. You can specify which port to use with these services by editing the `servicePort` field of the [config/samples/sidb/singleinstancedatabase.yaml](../../config/samples/sidb/singleinstancedatabase.yaml) file.
559+
560+
If the `LoadBalancer` is enabled, the `servicePort` will be the opened load balancer port for database connections.
561+
562+
In case of `NodePort` service, the `servicePort` will be the opened port on the Kubernetes nodes for database connections. In this case, the allowed range for the `servicePort` is 30000-32767.
563+
564+
507565
## OracleRestDataService Resource
508566
509567
The Oracle Database Operator creates the `OracleRestDataService` as a custom resource. We will refer `OracleRestDataService` as ORDS from now onwards. Creating ORDS as a custom resource enables the RESTful API access to the Oracle Database in K8s and enables it to be managed as a native Kubernetes object.

0 commit comments

Comments
 (0)