For a while, I've used a NodePort service in my kubernetes in docker desktop on an M3 macbook. It's worked fine until today.
Now, it's stopped working, giving me an error when trying to connect:
(venv) jwatte@Jons-MacBook-Pro dir % psql postgresql://postgres:[email protected]:30032/postgres psql: error: connection to server at "127.0.0.1", port 30032 failed: Connection refused Is the server running on that host and accepting TCP/IP connections? (lkctl is an alias for kubectl --context=docker=desktop)
The service is listening:
(venv) jwatte@Jons-MacBook-Pro dir % lkctl get service graph-postgres-local -n sandbox -o wide NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR graph-postgres-local NodePort 10.104.142.18 <none> 30032:30032/TCP 7m41s app=graph-postgres The target pod exists:
(venv) jwatte@Jons-MacBook-Pro dir % lkctl get pod -n sandbox -l app=graph-postgres NAME READY STATUS RESTARTS AGE graph-postgres-8449bf8697-t8kht 1/1 Running 0 5m51s There are no processes listning on port 30032 locally:
(venv) jwatte@Jons-MacBook-Pro dir % netstat -nal | grep LISTEN | grep 32 (venv) jwatte@Jons-MacBook-Pro dir % Here's the service:
(venv) jwatte@Jons-MacBook-Pro dir % lkctl get service graph-postgres-local -o yaml -n sandbox apiVersion: v1 kind: Service metadata: annotations: kubectl.kubernetes.io/last-applied-configuration: | {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"name":"graph-postgres-local","namespace":"sandbox"},"spec":{"ports":[{"name":"postgres","nodePort":30032,"port":5432,"protocol":"TCP","targetPort":5432}],"selector":{"app":"graph-postgres"},"type":"NodePort"}} creationTimestamp: "2024-07-02T22:35:04Z" name: graph-postgres-local namespace: sandbox resourceVersion: "2154965" uid: c5f3036e-a6b6-4f31-9fea-5c8657f9b929 spec: clusterIP: 10.104.142.18 clusterIPs: - 10.104.142.18 externalTrafficPolicy: Cluster internalTrafficPolicy: Cluster ipFamilies: - IPv4 ipFamilyPolicy: SingleStack ports: - name: postgres nodePort: 30032 port: 30032 protocol: TCP targetPort: 5432 selector: app: graph-postgres sessionAffinity: None type: NodePort status: loadBalancer: {} FWIW, I've also tried with port: 5432 in the service specification, with no change.
I understand that docker has to run a VM internally to host these containers, but this used to work, and today it stopped working. I updated to the latest version as of today as well, but no change.