Skip to content

Allocate more nodeports - #739

Open
kraney wants to merge 4 commits into
openconfig:mainfrom
kraney:kne-nodeports
Open

Allocate more nodeports#739
kraney wants to merge 4 commits into
openconfig:mainfrom
kraney:kne-nodeports

Conversation

@kraney

@kraney kraney commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

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.

@kraney
kraney force-pushed the kne-nodeports branch 3 times, most recently from 56c3235 to 01a9fc3 Compare August 13, 2026 22:19
kraney added 4 commits August 14, 2026 18:20
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant