You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
586 B

This file contains ambiguous Unicode characters!

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 }}