When an NDB operator deploys a database solution, a Kubernetes service is automatically deployed, configuring the deployed database as the endpoint.
However, it is not currently possible to specify the port on which the service will listen, and port 80 is set by default.
It should be feasible, when setting up the resources of type 'Database', to specify the port on which the Kubernetes service would listen. The Custom Resource Definition (CRD) should provide the option to define something similar:
The actual result is
apiVersion: v1
kind: Service
metadata:
name: demoappdb02-svc
spec:
clusterIP: 172.19.94.227
clusterIPs:
- 172.19.94.227
internalTrafficPolicy: Cluster
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
ports:
- port: 80
protocol: TCP
targetPort: 5432
We should be able to create resources like this
apiVersion: ndb.nutanix.com/v1alpha1
kind: Database
metadata:
# This name that will be used within the kubernetes cluster
name: demoappdb02
spec:
# Name of the NDBServer resource created earlier
ndbRef: gdb
isClone: false
servicePort : 5432
exposedPort : 5432
Then we should get similar result:
apiVersion: v1
kind: Service
metadata:
name: demoappdb02-svc
spec:
clusterIP: 172.19.94.227
clusterIPs:
- 172.19.94.227
internalTrafficPolicy: Cluster
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
ports:
- port: 5432
protocol: TCP
targetPort: 5432