Merge pull request #19962 from AlphaWong/patch-2
add a yaml exmaple for type nodeportpull/20145/head
commit
ec0b8fd56f
|
@ -534,6 +534,25 @@ to just expose one or more nodes' IPs directly.
|
||||||
Note that this Service is visible as `<NodeIP>:spec.ports[*].nodePort`
|
Note that this Service is visible as `<NodeIP>:spec.ports[*].nodePort`
|
||||||
and `.spec.clusterIP:spec.ports[*].port`. (If the `--nodeport-addresses` flag in kube-proxy is set, <NodeIP> would be filtered NodeIP(s).)
|
and `.spec.clusterIP:spec.ports[*].port`. (If the `--nodeport-addresses` flag in kube-proxy is set, <NodeIP> would be filtered NodeIP(s).)
|
||||||
|
|
||||||
|
For example:
|
||||||
|
```yaml
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: my-service
|
||||||
|
spec:
|
||||||
|
type: NodePort
|
||||||
|
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
|
||||||
|
# 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}
|
### Type LoadBalancer {#loadbalancer}
|
||||||
|
|
||||||
On cloud providers which support external load balancers, setting the `type`
|
On cloud providers which support external load balancers, setting the `type`
|
||||||
|
|
Loading…
Reference in New Issue