Let me clarify some misconceptions:
You cannot change the nodePort port range for a managed Kubernetes cluster like GKE.
A word about nodePort from official Kubernetes documentation:
NodePort: Exposes the Service on each Node’s IP at a static port (the NodePort). A ClusterIP Service, to which the NodePort Service routes, is automatically created. You’ll be able to contact the NodePort Service, from outside the cluster, by requesting <NodeIP>:<NodePort>.
-- Kubernetes.io: Services
nodePort port ranges from 30000 to 32767.
What you see here:
when I list the services on kubernetes I see this :
service/countly-frontend NodePort 10.xx.xx.12 ><none> 6001:31145/TCP 110s
Specifically: 6001:31145/TCP is correct.
Example:
Assume that there is a pod with an application running on port 50001.
This is a service.yaml of above application:
apiVersion: v1
kind: Service
metadata:
name: hello-service
spec:
selector:
app: hello
ports:
- name: hello-port
port: 5678 # CLUSTER-IP PORT
targetPort: 50001 # PORT WHICH YOUR APPLICATION IS RUNNING ON
nodePort: 30051 # NODEPORT PORT
type: NodePort
Output of $ kubectl get services:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello-service NodePort 10.86.1.195 <none> 5678:30051/TCP 25h
You will have an access to your application by:
NodeIP:NodePort(30051) (external access)
ClusterIP:port(5678) (internal access)
PodIP:targetPort(50001) (internal access)
If you would like to expose your application on port 6001 for external use you can try a service type of LoadBalancer.
There are answers on StackOverflow that are going deeper in this topic:
Please take a look on official documentation about exposing applications on a GKE cluster:
Cloud.google.com: Kubernetes engine: Exposing apps
Please let me know if you have any questions to that.