I've created a postgres cluster using PGO v5.0.3. I wanted to port-forward the service to my local machine to interact directly with the database, but the command failed:
$ oc port-forward service/netbox-primary 5432:5432
error: cannot attach to *v1.Service: invalid service 'netbox-primary': Service is defined without a selector
And indeed, the service has no "selector":
$ oc get service netbox-primary -o yaml
apiVersion: v1
kind: Service
metadata:
labels:
name: netbox-primary
namespace: netbox
spec:
clusterIP: None
clusterIPs:
- None
ipFamilies:
- IPv4
- IPv6
ipFamilyPolicy: RequireDualStack
ports:
- name: postgres
port: 5432
targetPort: postgres
Is that expected? The corresponding -replicas and -pods services have selectors. The -ha service does not.