I'm trying to map an external Postgres box into my Kubernetes cluster using the Service
and Endpoint
resources but the service is not detecting the endpoint.
terraform $ kubectl describe services postgres -n infrastructure
Name: postgres
Namespace: infrastructure
Labels: <none>
Annotations: <none>
Selector: <none>
Type: ClusterIP
IP: 10.222.4.128
Port: postgres 5432/TCP
TargetPort: 5432/TCP
Endpoints:
Session Affinity: None
Events: <none>
The service and endpoint were created with:
kind: Service
apiVersion: v1
metadata:
name: postgres
namespace: infrastructure
spec:
type: ClusterIP
ports:
- port: 5432
targetPort: 5432
----
kind: Endpoints
apiVersion: v1
metadata:
name: postgres
namespace: infrastructure
subsets:
- addresses:
- ip: "10.0.0.1"
ports:
- port: 5432
I can connect to the Postgres box from a running container if I use the IP for the instance, but not with the Kubernetes service name (postgres.infrastructure.svc.cluster.local.)