27 lines
1.1 KiB
YAML
27 lines
1.1 KiB
YAML
# --- NodePort Service Definition ---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: derper-service # Service 的名称
|
|
namespace: tailscale-derp
|
|
labels:
|
|
app: derper # Service 的标签(可选)
|
|
spec:
|
|
type: NodePort # --- 关键:指定 Service 类型为 NodePort ---
|
|
# --- 核心修改:设置外部流量策略为 Local ---
|
|
externalTrafficPolicy: Local
|
|
selector:
|
|
app: derper # --- 关键:选择带有 app=derper 标签的 Pod ---
|
|
# 这个必须匹配 DaemonSet template 中的 Pod 标签
|
|
ports:
|
|
- name: derp-udp-nodeport
|
|
protocol: UDP
|
|
port: 3478 # Service 在集群内部暴露的端口 (ClusterIP 端口)
|
|
targetPort: derp-stun
|
|
nodePort: 30478 # 可选:指定固定的 NodePort (需要在 30000-32767 范围内且未被占用),不指定则自动分配
|
|
- name: derp-tcp-nodeport
|
|
protocol: TCP
|
|
port: 3478 # Service 在集群内部暴露的端口 (ClusterIP 端口)
|
|
targetPort: derp-addr
|
|
nodePort: 30478 # 可选:指定固定的 NodePort
|