This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
apiVersion: v1
kind: Service
metadata:
name: {{ .ObjectMeta.Name }}
namespace: {{ .ObjectMeta.Namespace }}
spec:
type: NodePort
selector:
app: {{ .ObjectMeta.Name }}
ports:
# 默认情况下,为了方便起见,`targetPort` 被设置为与 `port` 字段相同的值。
- port: {{ .Spec.Expose.ServicePort }}
targetPort: {{ .Spec.Port }}
# 可选字段
# 默认情况下,为了方便起见,Kubernetes 控制平面会从某个范围内分配一个端口号(默认:30000-32767)
nodePort: {{ .Spec.Expose.NodePort }}