I am testing an kubernetes minikube/influxdb/grafana stack under macos 10.15.3. I am working on the command line.
System environment:
- MacOS 10.15.3 /bin/bash (darwin19)
Minikube 1.7.2, downloaded via
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-darwin-amd64
I start the minikube from a shell script via
minikube start --extra-config=apiserver.service-node-port-range=3000-61616
The minikube responds with
Creating hyperkit VM (CPUs=2, Memory=2000MB, Disk=20000MB) ...
???? Preparing Kubernetes v1.17.2 on Docker 19.03.5 ...
▪ apiserver.service-node-port-range=3000-61616
???? Launching Kubernetes ...
???? Enabling addons: default-storageclass, storage-provisioner
⌛ Waiting for cluster to come online ...
???? Done! kubectl is now configured to use "minikube"
So I assume the the service ports 3000-61616 ARE available in the minikube.
Some shell script lines down the road I create the Grafana service by applying the yaml code:
apiVersion: v1
kind: Service
metadata:
name: grafana
namespace: default
spec:
selector:
app: grafana
type: NodePort
ports:
- protocol: TCP
port: 3000
targetPort: 3000
nodePort: 3000
Which yields:
The Service "grafana" is invalid: spec.ports[0].nodePort: Invalid value: 3000: provided port is not in the valid range. The range of valid ports is 30000-32767
As it seems, the service port range gets reset somehow. The Grafana deployment and other deployments, and influxDB and telegraf services (not of type "NodePort"!) do not cause problems. The same code does not cause these kind of problems on a standard linux-system.
Now some questions:
- How can I display the current status of the service node port range?
- Why/where could the service range be changed?
- As a workaround: how can I update the service port range in a running node/kube-api?
/etc/kubernetes/manifests/kube-apiserver.yaml
and there should be--service-node-port-range
line.minikube logs | grep ServiceNodePortRange
should show you the current status of service node port range, you can check it when editing kube-apiserver yaml too. – Jakub