Skip to content

Conversation

@kvaps
Copy link

@kvaps kvaps commented Jan 19, 2026

Summary

Add a new --internal-cidr flag that filters internal IP auto-detection by specified CIDRs. This flag can be specified multiple times.

Motivation

When running Kilo with CNI plugins like Cilium, the auto-detected internal IP may incorrectly select overlay network IPs (e.g., 10.244.x.x) instead of actual node IPs (e.g., 192.168.x.x) due to lexicographic sorting in IP selection. This causes routing issues as privIface gets set to the wrong interface.

Usage

# Filter auto-detection to specific CIDRs
kg --internal-cidr=192.168.0.0/16

# With Kubernetes Downward API
kg --internal-cidr=$(NODE_IP)/32

Changes

  • Add --internal-cidr flag to cmd/kg/main.go
  • Update mesh.New() to accept allowedInternalCIDRs parameter
  • Update getIP() in discoverips.go to filter IPs by allowed CIDRs
  • Update manifests for cilium and flannel deployments to use this flag with NODE_IP from Downward API

Test plan

  • Build passes
  • Tested with --internal-cidr flag in environment with Cilium

Add a new --internal-cidr flag that allows users to specify which CIDRs
should be considered during internal IP auto-detection. This flag can
be specified multiple times to allow multiple CIDRs.

When set, only IPs within these CIDRs will be selected as the internal
IP, preventing incorrect IP selection (e.g., when CiliumInternalIP is
chosen over the real node IP due to lexicographic sorting).

Example usage:
  --internal-cidr=192.168.0.0/16
  --internal-cidr=$(NODE_IP)/32

Also update manifests for cilium and flannel deployments to use this
flag with NODE_IP from Kubernetes Downward API.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
@kvaps kvaps marked this pull request as ready for review January 19, 2026 16:57
@kvaps kvaps force-pushed the feature/internal-cidr-flag branch from 2a04879 to 0ada870 Compare January 19, 2026 18:35
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