Skip to content

Commit ec0b8fd

Browse files
authored
Merge pull request #19962 from AlphaWong/patch-2
add a yaml exmaple for type nodeport
2 parents de07e4a + 94ec519 commit ec0b8fd

File tree

1 file changed

+19
-0
lines changed
  • content/en/docs/concepts/services-networking

1 file changed

+19
-0
lines changed

content/en/docs/concepts/services-networking/service.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,25 @@ to just expose one or more nodes' IPs directly.
534534
Note that this Service is visible as `<NodeIP>:spec.ports[*].nodePort`
535535
and `.spec.clusterIP:spec.ports[*].port`. (If the `--nodeport-addresses` flag in kube-proxy is set, <NodeIP> would be filtered NodeIP(s).)
536536

537+
For example:
538+
```yaml
539+
apiVersion: v1
540+
kind: Service
541+
metadata:
542+
name: my-service
543+
spec:
544+
type: NodePort
545+
selector:
546+
app: MyApp
547+
ports:
548+
# By default and for convenience, the `targetPort` is set to the same value as the `port` field.
549+
- port: 80
550+
targetPort: 80
551+
# Optional field
552+
# By default and for convenience, the Kubernetes control plane will allocate a port from a range (default: 30000-32767)
553+
nodePort: 30007
554+
```
555+
537556
### Type LoadBalancer {#loadbalancer}
538557
539558
On cloud providers which support external load balancers, setting the `type`

0 commit comments

Comments
 (0)