Skip to Content
Cluster Component ManagementMaster component managementNodePort Parameter Modification

NodePort Parameter Modification

1. API Server NodePort Range Modification

In the UK8S cluster, the APIServer related parameters are stored in the /etc/kubernetes/apiserver file on the Master node. Please perform the following operations on each Master node.

Backup this configuration file and modify the --service-node-port-range to the desired parameter in the file.

KUBE_API_ARGS=" --... \ --... \ --service-node-port-range=30000-32767 \ --... \ --..."

After the modification is completed, restart the APIServer through systemctl restart kube-apiserver.

⚠️ If the Service in the cluster has been assigned a port outside the target NodePort Range, after modification, check the cluster events through kubectl get event -A, there will be a warning event similar to the following The warning event does not affect the use of this port. If you want to avoid this warning, you need to rebuild the Service.

# kubectl get event -A NAMESPACE LAST SEEN TYPE REASON OBJECT MESSAGE uk8s-monitor 79s Warning PortOutOfRange service/grafana Port 34840 is not within the port range 30000-32767; please recreate service uk8s-monitor 78s Warning PortNotAllocated service/grafana Port 34840 is not allocated; repairing

2. Modify the node ip_local_port_range

Check the current system open port range, as follows:

# cat /proc/sys/net/ipv4/ip_local_port_range 12000 65535

If you need to modify it, please change the net.ipv4.ip_local_port_range field in the /etc/sysctl.conf file.

net.ipv4.ip_local_port_range = 32768 60999

After the modification is completed, execute sysctl -p to take the configuration into effect, and verify again:

# cat /proc/sys/net/ipv4/ip_local_port_range 32768 60999