From d32b5a3f9e9655fbc3cda9380db94a032cf7ab53 Mon Sep 17 00:00:00 2001 From: Alpha Date: Mon, 30 Mar 2020 11:51:12 +0800 Subject: [PATCH] add a yaml exmaple for type nodeport --- .../concepts/services-networking/service.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/content/en/docs/concepts/services-networking/service.md b/content/en/docs/concepts/services-networking/service.md index a62faf1e0f..da9d922b92 100644 --- a/content/en/docs/concepts/services-networking/service.md +++ b/content/en/docs/concepts/services-networking/service.md @@ -534,6 +534,25 @@ to just expose one or more nodes' IPs directly. Note that this Service is visible as `:spec.ports[*].nodePort` and `.spec.clusterIP:spec.ports[*].port`. (If the `--nodeport-addresses` flag in kube-proxy is set, would be filtered NodeIP(s).) +For example: +```yaml +apiVersion: v1 +kind: Service +metadata: + name: my-service +spec: + type: NodePort + selector: + app: MyApp + ports: + - port: 80 + # By default and for convenience, the targetPort is set to the same value as the port field. + targetPort: 80 + # `targetPort` is the port of pod, you would like to expose + NodePort: 30007 + # `NodePort` is the port of node, you would like to expose +``` + ### Type LoadBalancer {#loadbalancer} On cloud providers which support external load balancers, setting the `type`