Service
我正在尝试使用and资源将外部 Postgres 框映射到我的 Kubernetes 集群中,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>
服务和端点是通过以下方式创建的:
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
如果我使用实例的 IP,但不能使用 Kubernetes 服务名称(postgres.infrastructure.svc.cluster.local.)