skills/k8s-hostnetwork-port-conflict/SKILL.md
Debug Kubernetes pods using hostNetwork: true that crash with "Address already in use" or "failed to create listening socket for port N". Use when: (1) a hostNetwork pod container is in CrashLoopBackOff and logs show a port bind failure, (2) the port works fine in non-hostNetwork pods but fails with hostNetwork, (3) you need to identify which host-level process holds a port from within Kubernetes (no SSH). Covers /proc/net/udp inspection and kubectl debug node with nsenter.
npx skillsauth add aldengolab/lorist k8s-hostnetwork-port-conflictInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
A pod with hostNetwork: true shares the host's network namespace. If a
system-level service on the node already binds the same port, the container
fails with "Address already in use" and enters CrashLoopBackOff. The error
is misleading because nothing inside Kubernetes appears to hold the port.
failed to create listening socket for port <N>: Address already in use
or similar bind errorshostNetwork: truekubectl get pods shows CrashLoopBackOff with restarts climbingFrom any running container on the same node with hostNetwork (or the crashing pod's surviving sidecar):
kubectl exec -n <ns> <pod> -c <container> -- cat /proc/net/udp # UDP
kubectl exec -n <ns> <pod> -c <container> -- cat /proc/net/tcp # TCP
Ports are in hex in column 2 (local_address). Convert: e.g. 0045 = 69.
Look for 00000000:<hex-port> (bound on all interfaces).
Use kubectl debug node/ with the sysadmin profile to get root access:
kubectl debug node/<node-name> -it --image=ubuntu --profile=sysadmin -- bash
Inside the debug pod, enter the host namespaces:
nsenter -t 1 -m -u -i -n -p -- ss -tulnp | grep :<port>
This shows the process name and PID holding the port.
Note: Without --profile=sysadmin, nsenter fails with
"cannot open /proc/1/ns/ipc: Permission denied".
Option A — Stop the host service (if it's redundant):
# systemd-based hosts:
nsenter -t 1 -m -u -i -n -p -- systemctl stop <service>
nsenter -t 1 -m -u -i -n -p -- systemctl disable <service>
# Non-systemd hosts (e.g., minimal k3s distros):
nsenter -t 1 -m -u -i -n -p -- kill <pid>
# Then find and disable the init mechanism (inetd.conf, xinetd.d/, init.d/)
Option B — Change the container's port (if the service must stay): Reconfigure the containerized application to use an alternative port. Note that for protocol-standard ports (TFTP/69, DHCP/67-68), clients may expect the default port, making Option A preferable.
ss -tulnp | grep :<port> on the nodeAfter removing the conflicting service, either wait for CrashLoopBackOff retry or delete the pod to force immediate recreation:
kubectl delete pod -n <ns> <pod-name>
Confirm the new pod reaches Running + Ready with 0 restarts.
systemctl may not exist.
Fall back to kill and investigate the init system./proc/net/udp technique works from any container sharing the host
network namespace — it doesn't require privileges.development
Build a UEFI Secure Boot PXE netboot server for Ubuntu autoinstall. Use when: designing or implementing network boot infrastructure for automated Ubuntu provisioning with Secure Boot enabled. Covers the complete chain: signed shim+GRUB selection, TFTP layout, kernel parameters, autoinstall config requirements, and post-install bootstrapping scripts. Also applicable when debugging an existing PXE setup that uses the wrong GRUB binary or config paths.
development
Design pattern for running a persistent PXE/TFTP server that safely coexists with already-installed nodes. Use when: building PXE infrastructure that should stay always-on, designing automated bare-metal provisioning in GitOps/Kubernetes environments, or any PXE setup where UEFI boot order has network boot first. Eliminates boot loops without requiring UEFI firmware changes.
development
This skill governs all prose output — Claude's own responses, documentation, PR descriptions, commit messages, README content, comments, and any text the user asks to draft or edit. It should also be used when the user asks to "review my writing", "edit this for clarity", "make this clearer", "simplify this text", "rewrite this", "check my prose", "tighten this up", or "make this more concise". Based on George Orwell's "Politics and the English Language" (1946).
development
Adversarial 3-stage review of an implementation plan before execution — checks completeness, security/best-practices, and multi-agent implementability. Use this skill whenever the user wants to validate, review, stress-test, or check an existing implementation plan before building or executing it. Trigger on phrases like "review the plan", "stress-test the plan", "is this plan ready", "check the plan", "validate the plan", "go through the plan", "find what's wrong with the plan", "is this ready for agents", "can subagents execute this", or any request to find gaps, security issues, or underspecified tasks in a plan that has already been written. Also trigger when the user has just finished /plan-implementation and is about to run /autonomous-plan-execution — the plan should be reviewed first. This skill is specifically for reviewing EXISTING plans, not for writing new ones (use plan-implementation for that), not for code review or PR review (use code-review for that), and not for debugging or post-deployment issues. If the user mentions a plan file, says "before we build", or asks whether phases can be parallelized, this skill almost certainly applies.