From 07fd1c617f534c174ed4f3e9482f45c71cdb7c9a Mon Sep 17 00:00:00 2001 From: Alpha Date: Mon, 30 Mar 2020 11:51:12 +0800 Subject: [PATCH 1/4] 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` From ff4ebc4fea0e2a22fa9c0224058eda62eeb5400b Mon Sep 17 00:00:00 2001 From: Alpha Date: Mon, 30 Mar 2020 13:28:22 +0800 Subject: [PATCH 2/4] update the yaml example based on review --- content/en/docs/concepts/services-networking/service.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/en/docs/concepts/services-networking/service.md b/content/en/docs/concepts/services-networking/service.md index da9d922b92..7908f8836d 100644 --- a/content/en/docs/concepts/services-networking/service.md +++ b/content/en/docs/concepts/services-networking/service.md @@ -546,11 +546,11 @@ spec: 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 + # By default and for convenience, the `targetPort` is set to the same value as the `port` field. + nodePort: 30007 + # Optional field + # By default and for convenience, the Kubernetes control plane will allocates a port from a range (default: 30000-32767) ``` ### Type LoadBalancer {#loadbalancer} From 1fda1272a572f9643d7fe568f633d4fe48a751ed Mon Sep 17 00:00:00 2001 From: Alpha Date: Mon, 30 Mar 2020 13:31:08 +0800 Subject: [PATCH 3/4] Update service.md --- content/en/docs/concepts/services-networking/service.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/docs/concepts/services-networking/service.md b/content/en/docs/concepts/services-networking/service.md index 7908f8836d..63f7fff957 100644 --- a/content/en/docs/concepts/services-networking/service.md +++ b/content/en/docs/concepts/services-networking/service.md @@ -550,7 +550,7 @@ spec: # By default and for convenience, the `targetPort` is set to the same value as the `port` field. nodePort: 30007 # Optional field - # By default and for convenience, the Kubernetes control plane will allocates a port from a range (default: 30000-32767) + # By default and for convenience, the Kubernetes control plane will allocate a port from a range (default: 30000-32767) ``` ### Type LoadBalancer {#loadbalancer} From 94ec519f6342c32acfb7306dfe5c8ea19e588435 Mon Sep 17 00:00:00 2001 From: Alpha Date: Mon, 30 Mar 2020 23:21:25 +0800 Subject: [PATCH 4/4] Update service.md --- content/en/docs/concepts/services-networking/service.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/en/docs/concepts/services-networking/service.md b/content/en/docs/concepts/services-networking/service.md index 63f7fff957..65891d3ccb 100644 --- a/content/en/docs/concepts/services-networking/service.md +++ b/content/en/docs/concepts/services-networking/service.md @@ -545,12 +545,12 @@ spec: selector: app: MyApp ports: + # By default and for convenience, the `targetPort` is set to the same value as the `port` field. - port: 80 targetPort: 80 - # By default and for convenience, the `targetPort` is set to the same value as the `port` field. - nodePort: 30007 # Optional field # By default and for convenience, the Kubernetes control plane will allocate a port from a range (default: 30000-32767) + nodePort: 30007 ``` ### Type LoadBalancer {#loadbalancer}