We have deployed a PostgreSQL with crunchydata operator.
We followed the link https://access.crunchydata.com/documentation/postgres-operator/v5/quickstart/#connect-using-a-port-forward
and connected with port-forward successfully to pods. Further, our services works and connect to Databases through Service created.
My question is:
Service that created is with name my-test-db-primary.
This service has no pod selector, however the pods are connecting while port-forward not.
How this works and how it knows the destination?
kind: Service
apiVersion: v1
metadata:
name: my-test-db-primary
namespace: test-databases
labels:
postgres-operator.crunchydata.com/cluster: my-test-db
postgres-operator.crunchydata.com/role: primary
ownerReferences:
- apiVersion: postgres-operator.crunchydata.com/v1beta1
kind: PostgresCluster
name: my-test-db
controller: true
blockOwnerDeletion: true
spec:
ports:
- name: postgres
protocol: TCP
port: 5432
targetPort: postgres
clusterIP: None
clusterIPs:
- None
type: ClusterIP
sessionAffinity: None
ipFamilies:
- IPv4
- IPv6
ipFamilyPolicy: RequireDualStack
internalTrafficPolicy: Cluster
status:
loadBalancer: {}