Repository: kubernetes/kubernetes
File: hack/local-up-cluster.sh (Shell)

Code before:
  KUBE_FASTBUILD=true make ginkgo cross

  log_dir="${LOG_DIR}"
  if [[ -n "${ARTIFACTS}" ]]; then
    # Store logs in the artifacts directory so that they are
    # available in the prow web UI.
    log_dir="${ARTIFACTS}"
  fi

  echo "install additional packages"
  apt-get update
  apt-get install -y conntrack dnsutils nftables ripgrep sudo tree vim

  # configure shared mounts to prevent failure in DIND scenarios
  mount --make-rshared /

  # Configure kernel network parameters for container networking.
  # These settings are required for ptp CNI and iptables-based kube-proxy
  # to work correctly in docker-in-docker environments.
  # See KIND's network configuration for reference.
  echo "Configuring kernel network parameters for DIND..."

  # Enable route_localnet - allows routing to localhost addresses after NAT.
  # Required for proper DNS resolution in containers.
  echo 1 > /proc/sys/net/ipv4/conf/all/route_localnet

  # Set arp_ignore=0 - required for ptp CNI which uses /32 addresses.
  # Ensures ARP replies are sent for all local addresses.
  echo 0 > /proc/sys/net/ipv4/conf/all/arp_ignore

  # Ensure IP forwarding is enabled for pod-to-pod traffic
  echo 1 > /proc/sys/net/ipv4/ip_forward
  echo 1 > /proc/sys/net/ipv6/conf/all/forwarding 2>/dev/null || true

  echo "Kernel network parameters configured"

  # to use containerd as kubelet container runtime we need to install cni
  install_cni 

  # If we are running in a cgroups v2 environment
  # we need to enable nesting
  tolerate_cgroups_v2

  echo "stopping docker"
  service docker stop

  # output version info
  containerd --version
  runc --version

  # configure and start containerd

Review comment (suggestion):
I'm not sure about modifying these sysctls on the host, I guess we silently set rshared on `/` already

Code after:
  export PATH="${KUBE_ROOT}/third_party/etcd:${PATH}"
  KUBE_FASTBUILD=true make ginkgo cross

  log_dir="${LOG_DIR}"
  if [[ -n "${ARTIFACTS}" ]]; then
    # Store logs in the artifacts directory so that they are
    # available in the prow web UI.
    log_dir="${ARTIFACTS}"
  fi

  echo "install additional packages"
  apt-get update
  apt-get install -y conntrack dnsutils nftables ripgrep sudo tree vim

  # configure shared mounts to prevent failure in DIND scenarios
  mount --make-rshared /

  # Configure kernel network parameters for container networking.
  # These settings are required for ptp CNI and iptables-based kube-proxy
  # to work correctly in docker-in-docker environments.
  # See KIND's network configuration for reference.
  echo "Configuring kernel network parameters for DIND..."

  # Enable route_localnet - allows routing to localhost addresses after NAT.
  # Required for proper DNS resolution in containers.
  echo 1 > /proc/sys/net/ipv4/conf/all/route_localnet

  # Set arp_ignore=0 - required for ptp CNI which uses /32 addresses.
  # Ensures ARP replies are sent for all local addresses.
  echo 0 > /proc/sys/net/ipv4/conf/all/arp_ignore

  # Ensure IP forwarding is enabled for pod-to-pod traffic
  echo 1 > /proc/sys/net/ipv4/ip_forward
  echo 1 > /proc/sys/net/ipv6/conf/all/forwarding 2>/dev/null || true

  echo "Kernel network parameters configured"

  # to use containerd as kubelet container runtime we need to install cni
  install_cni 

  # If we are running in a cgroups v2 environment
  # we need to enable nesting
  tolerate_cgroups_v2

  echo "stopping docker"
  service docker stop

  # output version info
  containerd --version
  runc --version