Allocate more nodeports - #739
Open
kraney wants to merge 4 commits into
Open
Conversation
kraney
force-pushed
the
kne-nodeports
branch
3 times, most recently
from
August 13, 2026 22:19
56c3235 to
01a9fc3
Compare
DUTs set up nodeports for their service ports. That's a scarce resource; the default K8s config allocates range 30000-32767 which limits to 2768 services total. Lemming has two services, as an example, so that leaves a max of 1384 instances possible, if nothing else is using nodeports. This boosts the range by starting at 10000, giving more room for more nodes in the KNE topology.
1. Fixed errcheck & Lint Issue:
• Updated defer os.RemoveAll(f.Name()) in kubeadm.go
• Fixed pre-existing codespell finding on "dne" in kubeadm_test.go.
2. Fixed 2.B (Temp File Handle Leak):
• Added explicit f.Close() after writes and before sudo cp in both kubeadm.go and kubeadm.go.
3. Fixed 2.C (Root Permissions on kube-apiserver manifest):
• Added fallback to read via sudo cat using kubeadm.go when direct file reading encounters permission errors on root-owned manifests.
4. Added Unit Tests:
• **kubeadm_test.go**: Added kubeadm_test.go covering:
• Target matching on --service-cluster-ip-range=
• Fallback matching on kube-apiserver
• Non-existent manifest handling (returns nil)
• Pre-existing --service-node-port-range= (no-op, returns nil)
• Unmatched insertion point error
• Copy command failure
• **deploy_test.go**: Added a test case in deploy_test.go verifying deployment with custom ServiceNodePortRange.
• In kubeadm.go: kubeadm.go
• In kubeadm.go: kubeadm.go
• Updated unit tests in kubeadm_test.go to expect "-f".
2. Added -f flags to shell scripts:
• In kne_test.sh: sudo cp -f /etc/kubernetes/admin.conf "$HOME"/.kube/config (overwriting the ~/.kube/config created with mode 0600
earlier by kne deploy).
• In kne_test.sh and vendors_test.sh: Changed rm -r and cp -r to rm -rf and cp -rf.
1. Wait for apiserver readiness: Updated kubeadm.go in kubeadm.go to invoke kubeadm.go after copying the new manifest:
• Polls kubectl get pod -n kube-system -l component=kube-apiserver until the mirror pod reflects the updated --service-node-port-range flag.
• Verifies kubectl get --raw /readyz returns ok before allowing deployment to continue.
2. Unit tests: Updated kubeadm_test.go with test coverage for success, retry, and timeout conditions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DUTs set up nodeports for their service ports. That's a scarce resource; the default K8s config allocates range 30000-32767 which limits to 2768 services total. Lemming has two services, as an example, so that leaves a max of 1384 instances possible, if nothing else is using nodeports.
This boosts the range by starting at 10000, giving more room for more nodes in the KNE topology.