endpoint指向目标服务的ip和端口,service配置将其映射为集群内部的服务
apiVersion: v1
kind: Service
metadata:
name: demo
namespace: 4dtc
spec:
ports:
- name: tcp-demo(注意:tcp服务,必须要有tcp标识)
port: 80
protocol: TCP
targetPort: 31675
type: ClusterIP
---
apiVersion: v1
kind: Endpoints
metadata:
name: demo
namespace: 4dtc
subsets:
- addresses:
- ip: 10.2.0.101(服务IP)
ports:
- name: tcp-demo
port: 31675
protocol: TCP