How do I connect to MongoDB NodePort service from Compass

I have an Mongo deploy on k8s which is exposed as a NodePort. The database is running on a remote Kubernetes cluster and I am trying to connect from my PC using Compass (and my private internet connection).
When I attempt to connect from Compass using the following I am getting an error connect ETIMEDOUT XXX.XXX.XXX.XXX:27017 :

mongodb://root:password@XXX.XXX.XXX.XXX:27017/TestDb?authSource=admin

I have checked the service with:

kubectl -n labs get svc
NAME              TYPE       CLUSTER-IP      EXTERNAL-IP   PORT(S)           AGE
mongodb-service   NodePort   10.XXX.XXX.XXX   <none>        27017:31577/TCP   172m

and using the url mongodb://root:password@XXX.XXX.XXX:31577/TestDb?authSource=admin yields the same connect timeout error also.

The service is defined as :

apiVersion: v1
kind: Service
metadata:
  name: mongodb-service
  namespace: demos
spec:
  type: NodePort
  selector:
    app: mongodb
  ports:
    - protocol: TCP
      port: 27017
      targetPort: 27017 

I have tried using the URL that displays in shell access as :

mongodb://XXX.XX.XX.XX:31577/?compressors=disabled&gssapiServiceName=mongodb

but I get error error-option-gssapiservicename-is-not-supported .

I am able to login and access the database from the command line ( kubectl -n demos exec -it podname -- sh ) and after login I get :

connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb

My understanding is that I should be using the Node IP for my k8s cluster as something like https://XXX.XXX.XXX.XXX:31577/?compressors=disabled&gssapiServiceName=mongodb but this also complains with error Invalid scheme, expected connection string to start with “mongodb://” or “mongodb+srv://”

Using either of these URIs :

mongodb://root:password@mongodb-service:27017/
mongodb://root:password@mongodb-service:31562/

also gives an error getaddrinfo ENOTFOUND mongodb-service

What am I missing ?