1

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: {}

1 Answer 1

0

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 that you have read and understand our privacy policy and code of conduct.

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