0

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

Mich Talebzadeh
  • 117
  • 2
  • 12
  • Similar thread here https://stackoverflow.com/questions/43354167/minikube-expose-mysql-running-on-localhost-as-service – Mich Talebzadeh Aug 02 '21 at 14:59
  • Which version of Kubernetes did you use? – Mikołaj Głodziak Aug 03 '21 at 10:28
  • kubectl version Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.2", GitCommit:"092fbfbf53427de67cac1e9fa54aaa09a28371d7", GitTreeState:"clean", BuildDate:"2021-06-16T12:59:11Z", GoVersion:"go1.16.5", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.7", GitCommit:"132a687512d7fb058d0f5890f07d4121b3f0a2e2", GitTreeState:"clean", BuildDate:"2021-05-12T12:32:49Z", GoVersion:"go1.15.12", Compiler:"gc", Platform:"linux/amd64"} – Mich Talebzadeh Aug 03 '21 at 14:17
  • minikube v1.21.0 on Redhat 7.6 – Mich Talebzadeh Aug 03 '21 at 21:58

0 Answers0