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
  name: my-test-db-primary
  namespace: test-databases
    postgres-operator.crunchydata.com/cluster: my-test-db
    postgres-operator.crunchydata.com/role: primary
    - apiVersion: postgres-operator.crunchydata.com/v1beta1
      kind: PostgresCluster
      name: my-test-db
      controller: true
      blockOwnerDeletion: true
    - name: postgres
      protocol: TCP
      port: 5432
      targetPort: postgres
  clusterIP: None
    - None
  type: ClusterIP
  sessionAffinity: None
    - IPv4
    - IPv6
  ipFamilyPolicy: RequireDualStack
  internalTrafficPolicy: Cluster
  loadBalancer: {}

1 Answer 1


Further reading the k8s documentation Documentation

Quoting from Documentation:

When you create an EndpointSlice object for a Service, you can use any name for the EndpointSlice.

Each EndpointSlice in a namespace must have a unique name. You link an EndpointSlice to a Service by setting the kubernetes.io/service-name label on that EndpointSlice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.