Kubernetes typically allocates NodePort Service ports from
30000–32767. Cluster administrators can configure a different range on the API server when network policy requires it.Plan the change
Check for collisions with host services and firewall rules, and inventory existing NodePort Services. Choose a range that accommodates existing allocations and operational requirements. Changing control-plane configuration can interrupt API availability; use a maintenance plan and a tested backup.
Configure a kubeadm control plane
For a self-managed kubeadm cluster, the API server is normally a static Pod with a manifest at
/etc/kubernetes/manifests/kube-apiserver.yaml. Its command can include an argument such as:plain text_snippet
Plain Text · 1 line|
| --service-node-port-range=20000-22767 |
Use a range appropriate to your cluster, and ensure the effective configuration is consistent across all API servers. Follow your cluster's supported configuration and upgrade process; changes to static Pod manifests cause kubelet to recreate the affected API server. In an HA cluster, roll changes one control-plane node at a time and verify health after each change. Managed services may not expose this setting.
Verify
Inspect the effective API server configuration and create a test Service in the intended range using your normal deployment workflow. Check existing Services and connectivity afterward. Do not delete and recreate existing Services without first assessing allocation, downtime, and client impact.
✦ 卷终 · 柯航存卷 ✦