Minikube accessing Oracle database on another host as a service from PySpark code

Solution for Minikube accessing Oracle database on another host as a service from PySpark code
is Given Below:

I am running PySpark inside minikube and works fine. I also added a config.yaml file when building the image so I can define oracle_url as follows:

oracle_url: "jdbc:oracle:thin:@50.140.197.230:1521:orasource"

I have created a service without selector called orasource_service.yaml as below:

apiVersion: v1
kind: Service
metadata:
    name: orasource
spec:
    ports:
        - protocol: TCP
          port: 1443
          targetPort: 1521

And relative Endpoint object called orasource_endpoints.yaml

apiVersion: v1
kind: Endpoints
metadata:
    name: orasource
subsets:
    - addresses:
        - ip: 50.140.197.230
      ports:
        - port: 1521

Getting service IP

kubectl get svc orasource
NAME        TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE
orasource   ClusterIP   10.101.173.254   <none>        1443/TCP   4h52m

and endpoints

kubectl get endpoints orasource
NAME        ENDPOINTS             AGE
orasource   50.140.197.230:1521   4h53m

So far so good so in my PySpark code I refer to oracle_url as below printed out from the code

jdbc:oracle:thin:@10.101.173.254:1443:orasource

However, I do not want to use IP address I want to use orasource as shown below

kubectl get svc orasource
NAME        TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE
orasource   ClusterIP   10.101.173.254   <none>        1443/TCP   5h6m

So instead of CLUSTER-IP I want to use Name –> orasource. How can I achieve that in PySpark code?

Thanks