add a yaml exmaple for type nodeport

This commit is contained in:
Alpha
2020-03-30 11:51:12 +08:00
committed by bryan
parent 9cffb779de
commit d32b5a3f9e
@@ -534,6 +534,25 @@ to just expose one or more nodes' IPs directly.
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).)
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`