配置了Kubernetes服务,但是get连接被拒绝



我在kubertes集群上配置了服务,但是当我尝试curl ip:port时,我得到连接拒绝配置如下服务:

apiVersion: v1
kind: Service
metadata:
name: frontend
namespace: production
spec:
type: NodePort
selector:
app: frontend
ports:
- name: control-center-web
port: 8008
protocol: TCP
targetPort: 8008

$ kubectl description SVC frontend

Name:                    frontend
Namespace:                production
Labels:                   <none>
Annotations:              kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"name":"frontend","namespace":"production"},"spec":{"ports":[{"name":...
Selector:                 app=frontend
Type:                     NodePort
IP:                       <ip>
Port:                     control-center-web  8008/TCP
TargetPort:               8008/TCP
NodePort:                 control-center-web  7851/TCP
Endpoints:                <none>
Session Affinity:         None
External Traffic Policy:  Cluster
Events:
Type    Reason  Age   From                Message
----    ------  ----  ----                -------
Normal  Type    14m   service-controller  LoadBalancer -> NodePort

为什么我一直从svc获得ip和端口的连接拒绝?

使用的Endpoints已获得None,而不是pod的ip。当服务app: frontend中的选择器与pod spec中的选择器不匹配时,

相关内容

最新更新