add a yaml exmaple for type nodeport
This commit is contained in:
@@ -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`
|
||||
|
||||
Reference in New Issue
Block a user