You can set the type NodePortin your deployment Service. Please note that for your server the API is configured Node Port Rangewith the parameter --service-node-port-range(default 30000-32767). You can also specify a port in this range by specially setting the attribute NodePortbelow the object Port, or the system will select a port in this range for you.
So, an example Servicewith the above NodePortwill look like this:
apiVersion: v1
kind: Service
metadata:
name: nginx
labels:
name: nginx
spec:
type: NodePort
ports:
- port: 80
nodePort: 30080
name: http
- port: 443
nodePort: 30443
name: https
selector:
name: nginx
For more information about NodePort, see this document . To configure the Node API Server Port Range, see this .
source
share