我使用OS Centos 7。 我的Pod:
forloop.index0
我的服务:
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
和Pods:
# 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
当我运行Curl:
# kubectl get pod
NAME READY STATUS RESTARTS AGE
tomcat 1/1 Running 0 13h
当时的Kube代理日志显示如下:
curl 10.254.206.26
curl: (56) Recv failure: Connection reset by peer
但是当我直接将curl运行到pod ip地址和端口8080时 - 它运行正常。
当我运行命令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
kubectl get endpoints
此输出中的字段ENDPOINTS使用&#34; none&#34;看起来很奇怪 怎么了?
答案 0 :(得分:0)
服务通过匹配标签来工作。您正尝试根据您的广告连播的名称进行匹配。尝试将您的广告连播的元数据更改为
metadata:
name: tomcat
labels:
name: tomcat
看看是否有帮助。