kube-proxy 找不到 default/tomcat:http 的端点:缺少服务条目
kube-proxy Couldn't find an endpoint for default/tomcat:http: missing service entry
我用的是OS Centos 7。
我的播客:
apiVersion: v1
kind: Pod
metadata:
name: tomcat
spec:
containers:
- image: ec2-73-99-254-8.eu-central-1.compute.amazonaws.com:5000/tom
name: tomcat
command: ["sh","-c","/opt/tomcat/bin/deploy-and-run.sh"]
volumeMounts:
- mountPath: /maven
name: app-volume
ports:
- containerPort: 8080
volumes:
- name: app-volume
hostPath:
path: /maven
我的服务:
apiVersion: v1
kind: Service
metadata:
name: tomcat
spec:
ports:
- name: http
port: 80
targetPort: 8080
protocol: TCP
selector:
name: tomcat
服务看起来像:
# kubectl get svc
NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE
kubernetes 10.254.0.1 <none> 443/TCP <none> 14h
tomcat 10.254.206.26 <none> 80/TCP name=tomcat 13h
和Pods:
# kubectl get pod
NAME READY STATUS RESTARTS AGE
tomcat 1/1 Running 0 13h
当我 运行 卷曲时:
curl 10.254.206.26
curl: (56) Recv failure: Connection reset by peer
当时的 Kube-proxy 日志显示如下:
kube-proxy[22273]: Couldn't find an endpoint for default/tomcat:http: missing service entry
kube-proxy[22273]: Failed to connect to balancer: missing service entry
但是当我 运行 直接 curl 到 pod 的 ip 地址和端口 8080 - 它工作正常。
当我 运行 命令 kubectl get endpoints
NAME ENDPOINTS AGE
kubernetes 195.234.109.11:6443 14h
tomcat <none> 14h
此输出中带有 "none" 的端点字段看起来很奇怪。
怎么了?
服务通过匹配标签工作。您正在尝试根据您的广告连播名称进行匹配。尝试将您的广告连播的元数据更改为
metadata:
name: tomcat
labels:
name: tomcat
看看是否有帮助。
我用的是OS Centos 7。 我的播客:
apiVersion: v1
kind: Pod
metadata:
name: tomcat
spec:
containers:
- image: ec2-73-99-254-8.eu-central-1.compute.amazonaws.com:5000/tom
name: tomcat
command: ["sh","-c","/opt/tomcat/bin/deploy-and-run.sh"]
volumeMounts:
- mountPath: /maven
name: app-volume
ports:
- containerPort: 8080
volumes:
- name: app-volume
hostPath:
path: /maven
我的服务:
apiVersion: v1
kind: Service
metadata:
name: tomcat
spec:
ports:
- name: http
port: 80
targetPort: 8080
protocol: TCP
selector:
name: tomcat
服务看起来像:
# kubectl get svc
NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE
kubernetes 10.254.0.1 <none> 443/TCP <none> 14h
tomcat 10.254.206.26 <none> 80/TCP name=tomcat 13h
和Pods:
# kubectl get pod
NAME READY STATUS RESTARTS AGE
tomcat 1/1 Running 0 13h
当我 运行 卷曲时:
curl 10.254.206.26
curl: (56) Recv failure: Connection reset by peer
当时的 Kube-proxy 日志显示如下:
kube-proxy[22273]: Couldn't find an endpoint for default/tomcat:http: missing service entry
kube-proxy[22273]: Failed to connect to balancer: missing service entry
但是当我 运行 直接 curl 到 pod 的 ip 地址和端口 8080 - 它工作正常。
当我 运行 命令 kubectl get endpoints
NAME ENDPOINTS AGE
kubernetes 195.234.109.11:6443 14h
tomcat <none> 14h
此输出中带有 "none" 的端点字段看起来很奇怪。 怎么了?
服务通过匹配标签工作。您正在尝试根据您的广告连播名称进行匹配。尝试将您的广告连播的元数据更改为
metadata:
name: tomcat
labels:
name: tomcat
看看是否有帮助。