<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kuzmenko Konstantin on Medium]]></title>
        <description><![CDATA[Stories by Kuzmenko Konstantin on Medium]]></description>
        <link>https://medium.com/@ikkvitgdrscat?source=rss-12d1fb69b67e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Om0BjOO3RST-kmsY</url>
            <title>Stories by Kuzmenko Konstantin on Medium</title>
            <link>https://medium.com/@ikkvitgdrscat?source=rss-12d1fb69b67e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 16:16:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ikkvitgdrscat/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Hybrid AI Lab: Bridging KinD, Cilium BGP, and a Remote GPU Node for KubeAI with Containerlab]]></title>
            <link>https://medium.com/@ikkvitgdrscat/hybrid-ai-lab-bridging-kind-cilium-bgp-and-a-remote-gpu-node-for-kubeai-with-containerlab-9562f504ccea?source=rss-12d1fb69b67e------2</link>
            <guid isPermaLink="false">https://medium.com/p/9562f504ccea</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cilium]]></category>
            <category><![CDATA[cloud-native]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Kuzmenko Konstantin]]></dc:creator>
            <pubDate>Sun, 29 Nov 2026 15:49:34 GMT</pubDate>
            <atom:updated>2026-11-29T16:07:00.861Z</atom:updated>
            <content:encoded><![CDATA[<p>Running an AI laboratory often presents an expensive dilemma: managed cloud Kubernetes clusters with dedicated GPU nodes are costly to maintain 24/7, while running everything locally on a workstation is constrained by compute and VRAM.</p><p>In this guide, we engineer a Hybrid AI Laboratory:</p><ul><li>Control Plane &amp; Local Workers: Lightweight Kubernetes running locally via KinD and orchestrated by Containerlab.</li><li>Data Plane &amp; Routing: Cilium CNI (v2 BGP Control Plane) peering with an FRRouting (FRR) Top-of-Rack router — completely removing Kube-Proxy and overlay encapsulation overhead.</li><li>Compute Elasticity: An on-demand remote bare-metal/cloud GPU node attached directly into our local cluster via a Layer 3 SSH point-to-point tunnel.</li><li>Serving &amp; Ingress: KubeAI orchestrating open-source LLMs (Qwen 2.5), secured and exposed via Kubernetes Gateway API directly on the GPU node.</li></ul><pre>               +-----------------------------------------------------------+<br>               |                  LOCAL WORKSTATION                        |<br>               |                                                           |<br>               |   +-----------------------+     +---------------------+   |<br>               |   |   tun-control-plane   |     |   tun-worker (1/2)  |   |<br>               |   |     (ASN 65001)       |     |   (ASN 65002/3)     |   |<br>               |   +-----------+-----------+     +----------+----------+   |<br>               |               |  (192.168.11.0/24)         |              |<br>               |               +-------------+--------------+              |<br>               |                             |                             |<br>               |                 +-----------v-----------+                 |<br>               |                 |    clab tor-router    |                 |<br>               |                 |      (ASN 65000)      |                 |<br>               |                 +-----------+-----------+                 |<br>               |                             | (192.168.20.0/24)           |<br>               |                 +-----------v-----------+                 |<br>               |                 |    clab vpn-gateway   |                 |<br>               +-----------------+-----------+-----------+-----------------+<br>                                             |<br>                     === Encrypted L3 SSH Tunnel (tun0: 192.168.14.0/24) ===<br>                                             |<br>               +-----------------------------v-----------------------------+<br>               |                      REMOTE GPU NODE                      |<br>               |  Host: &quot;remote&quot; | ASN 65004 | Public IP: ${VPN_IP}        |<br>               |                                                           |<br>               |  [ Kubelet ]  &lt;--- (Internal Pod Traffic via tun0)        |<br>               |                                                           |<br>               |  [ Cilium Gateway ] (Port 8443 TLS Terminate)             |<br>               |         |                                                 |<br>               |         v (HTTPRoute: Header Auth)                        |<br>               |  [ KubeAI Pod: Qwen 2.5 Engine (vLLM) ]                   |<br>               +-----------------------------------------------------------+</pre><blockquote><em>📦 GitHub Repository: All code, Containerlab topologies, and manifests used in this guide are available at </em><a href="https://github.com/konstantforever/clabkindgpu"><em>konstantforever/clabkindgpu</em></a><em>.</em></blockquote><p>Before deploying virtual node, networking containers, and eBPF programs, the host operating system needs proper tuning.</p><p>Running a multi-node Kubernetes cluster inside Docker (KinD) alongside Containerlab can quickly exhaust default system limits — specifically file watchers and networking buffers.</p><p>Why this matters:</p><ul><li>fs.inotify.*: KinD nodes, the kubelet, and Cilium agents continuously monitor cgroups, container logs, and config files. Bumping inotify limits prevents too many open files and random pod scheduling failures.</li><li>TCP Buffers &amp; BBR (net.ipv4.tcp_*, net.core.*): Because our cluster communicates with the remote GPU node over an encrypted remote tunnel, enabling BBR and expanding socket buffers ensures rock-solid control-plane stability and responsive kubectl logs/exec sessions.</li></ul><p>Run the following command to apply the parameters immediately on the host machine:</p><pre>sudo sysctl -w \<br>  fs.inotify.max_user_watches=1048576 \<br>  fs.inotify.max_user_instances=8192 \<br>  fs.inotify.max_queued_events=65536 \<br>  net.core.default_qdisc=fq \<br>  net.ipv4.tcp_congestion_control=bbr \<br>  net.ipv4.tcp_slow_start_after_idle=0 \<br>  net.core.rmem_max=16777216 \<br>  net.core.wmem_max=16777216 \<br>  net.ipv4.tcp_rmem=&quot;4096 87380 16777216&quot; \<br>  net.ipv4.tcp_wmem=&quot;4096 65536 16777216&quot;</pre><h3>Step 2: Deploying Infrastructure &amp; Networking with Containerlab</h3><p>With the host tuned, we can build the actual testbed. Make sure you have <a href="https://containerlab.dev/install/">Containerlab installed</a> before proceeding.</p><p>To keep our iteration loop fast, we split our Containerlab topology into two separate manifests:</p><ol><li>clab-kind.yaml: Deploys the heavy Kubernetes control plane and worker nodes via KinD.</li><li>clab-net.yaml: Deploys the routing tier (tor-router with FRR BGP) and the vpn-gateway used to bridge our local lab with the remote GPU node.</li></ol><p>Separating them allows us to instantly re-configure or tear down the complex L3 network and VPN tunnels without having to recreate the entire Kubernetes cluster from scratch.</p><p>1. Pre-create the KinD Docker Network (MTU 9000)</p><p>Before deploying the nodes, we manually create the dedicated Docker bridge network. This ensures our KinD cluster uses our desired subnet (172.23.0.0/16) and sets an MTU of 9000 for the virtual lab environment:</p><pre>docker network create kind \<br>  --driver bridge \<br>  --subnet 172.23.0.0/16 \<br>  -o com.docker.network.driver.mtu=9000</pre><p>2. Deploy the KinD Cluster Base &amp; Extract Kubeconfig</p><p>Navigate to the working directory and deploy the base Kubernetes nodes:</p><pre>cd infrastructure/kind<br>clab deploy -t clab-kind.yaml</pre><p>Once the containers are up, pull the administrative kubeconfig directly from the control-plane container to your local machine so kubectl can interact with the cluster:</p><pre>mkdir -p ~/.kube<br>docker exec -i tun-control-plane cat /etc/kubernetes/admin.conf &gt; ~/.kube/config</pre><pre># Verify cluster connectivity<br>kubectl get nodes</pre><blockquote><em>Note: Nodes will be in the NotReady state at this stage. This is completely expected because we haven’t installed our CNI (Cilium) yet.</em></blockquote><p>👉 View manifest: <a href="https://github.com/konstantforever/clabkindgpu/blob/main/infrastructure/kind/clab-kind.yaml">infrastructure/kind/clab-kind.yaml</a></p><p>3. Configure Remote GPU Connection Variables</p><p>To allow our remote GPU node to join the local KinD cluster and communicate with the Control Plane, we bridge them via an encrypted Layer 3 SSH point-to-point tunnel. (<em>Note: Actual model inference traffic won’t be funneled blindly through this tunnel; we will handle ingress routing cleanly via Gateway API later in the guide</em>).</p><p>Create or update the .env file in infrastructure/kind/ with your remote GPU host credentials:</p><pre>cat &lt;&lt;EOF &gt; .env<br>export VPN_USER=&quot;root&quot;<br>export VPN_IP=&quot;YOUR_REMOTE_GPU_IP&quot;<br>export VPN_PORT=&quot;22&quot;<br>EOF</pre><p>Ensure your private SSH key configured for passwordless access to the remote GPU node is placed in ./nowg/sshtun/.</p><p>4. Load Environment Variables and Deploy the Network</p><p>Source the environment variables and deploy the networking layer:</p><pre>. .env<br>clab deploy -t clab-net.yaml</pre><p>What happens in clab-net.yaml:</p><ul><li>tor-router: Acts as our Top-of-Rack (ToR) BGP router powered by FRRouting (FRR). It peers directly with the KinD nodes (tun-control-plane, tun-worker, tun-worker2) over dedicated veth interfaces, establishing the dynamic L3 fabric.</li><li>vpn-gateway: Mounts your local SSH keys, spawns an autossh daemon, and sets up a point-to-point tunnel interface (tun0) extending directly to your remote GPU host (VPN_IP). It applies TCP MSS clamping to prevent packet drops caused by tunnel MTU overhead, joining the remote GPU node directly into our cluster&#39;s internal network.</li></ul><p>👉 View manifest: <a href="https://github.com/konstantforever/clabkindgpu/blob/main/infrastructure/kind/clab-net.yaml">infrastructure/kind/clab-net.yaml</a></p><h3>Step 3: Installing Gateway API &amp; Deploying Cilium CNI</h3><p>With our L3 routing topology in place, our KinD nodes are still in NotReady status. Before rolling out Cilium, we must install the official Kubernetes Gateway API CRDs.</p><p>Cilium has native Gateway API support (fully replacing legacy Ingress controllers and Kube-Proxy). However, its internal controller requires standard Gateway API resources (GatewayClass, HTTPRoute, GRPCRoute, etc.) to be registered in the API server upfront.</p><p>1. Install Kubernetes Gateway API Standard CRDs</p><p>We use --server-side apply to bypass kubectl annotation size limitations for large CRD manifests:</p><pre>GW_API=&quot;https://raw.githubusercontent.com/kubernetes-sigs/gateway-api/v1.6.1/config/crd/standard&quot;</pre><pre>kubectl apply --server-side \<br>  -f ${GW_API}/gateway.networking.k8s.io_gatewayclasses.yaml \<br>  -f ${GW_API}/gateway.networking.k8s.io_gateways.yaml \<br>  -f ${GW_API}/gateway.networking.k8s.io_httproutes.yaml \<br>  -f ${GW_API}/gateway.networking.k8s.io_referencegrants.yaml \<br>  -f ${GW_API}/gateway.networking.k8s.io_grpcroutes.yaml \<br>  -f ${GW_API}/gateway.networking.k8s.io_backendtlspolicies.yaml \<br>  -f ${GW_API}/gateway.networking.k8s.io_tlsroutes.yaml</pre><p>2. Deploy Cilium via Helm</p><p>Now we deploy Cilium configured with eBPF host routing, full Kube-Proxy replacement, dynamic BGP Control Plane, and Gateway API enabled via our custom values.yaml.</p><p>Add and update the official Cilium Helm repository:</p><pre>helm repo add cilium https://helm.cilium.io/<br>helm repo update</pre><p>Install Cilium into the kube-system namespace:</p><pre>helm upgrade --install cilium cilium/cilium \<br>  --namespace kube-system \<br>  --create-namespace \<br>  --version 1.20.2 \<br>  -f infrastructure/cilium/helm/values.yaml</pre><p>3. Verify Cluster Health &amp; CNI Rollout</p><p>Wait a few moments for the Cilium agents and operator to initialize:</p><pre># Check Cilium deployment rollout<br>kubectl -n kube-system rollout status daemonset/cilium</pre><pre># Verify node status<br>kubectl get nodes -o wide</pre><p>All KinD nodes (tun-control-plane, tun-worker, tun-worker2) should now transition into the Ready state, running pure eBPF networking without kube-proxy.</p><p>👉 View Helm configuration: <a href="https://github.com/konstantforever/clabkindgpu/blob/main/infrastructure/cilium/helm/values.yaml">infrastructure/cilium/helm/values.yaml</a></p><h3>Step 4: Dynamic Routing with Cilium BGP Control Plane (v2 API)</h3><p>Now that Cilium CNI is active, we need to announce each node’s PodCIDR to our virtual network infrastructure so traffic can be routed natively at Layer 3 without the encapsulation overhead of VXLAN or Geneve.</p><p>Instead of legacy peering policies, we leverage Cilium’s modern v2 BGP Control Plane API (CiliumBGPClusterConfig, CiliumBGPPeerConfig, and CiliumBGPAdvertisement).</p><p>Network Architecture Overview</p><p>Our BGP topology uses an eBGP-to-the-host design:</p><ul><li>ToR Router (clab-bgp-frr-tor-router) &amp; VPN Gateway: Upstream autonomous system ASN 65000.</li><li>Control Plane (tun-control-plane): Autonomous system ASN 65001, peering over 192.168.11.1.</li><li>Worker 1 (tun-worker): Autonomous system ASN 65002, peering over 192.168.12.1.</li><li>Worker 2 (tun-worker2): Autonomous system ASN 65003, peering over 192.168.13.1.</li><li>Remote GPU Node (remote): Autonomous system ASN 65004, peering with the VPN gateway over 192.168.14.1.</li></ul><p>1. Apply BGP Routing Policies</p><p>Apply the unified BGP policy manifest:</p><pre>kubectl apply -f infrastructure/cilium/manifests/bgpsep.yaml</pre><p>👉 View manifest: <a href="https://github.com/konstantforever/clabkindgpu/blob/main/infrastructure/cilium/manifests/bgpsep.yaml">infrastructure/cilium/manifests/bgpsep.yaml</a></p><p>2. Verify BGP Peering State</p><p>With Cilium’s v2 API, the controller automatically evaluates the cluster configurations and instantiates CiliumBGPNodeConfig resources per matching node:</p><pre>kubectl get ciliumbgpnodeconfigs.cilium.io</pre><p>You can also check the BGP peer states directly from any running Cilium agent:</p><pre>kubectl -n kube-system get po -l k8s-app=cilium -o name | xargs -I {} kubectl -n kube-system exec {} -c cilium-agent -- cilium-dbg bgp peers</pre><p>Next, inspect the Top-of-Rack router (clab-bgp-frr-tor-router) running FRRouting to confirm that all eBGP and iBGP sessions are established:</p><pre>docker exec -it clab-bgp-frr-tor-router vtysh -c &quot;show ip bgp summary&quot;</pre><pre>IPv4 Unicast Summary:<br>BGP router identifier 10.255.255.1, local AS number 65000 VRF default vrf-id 0<br>BGP table version 11<br>RIB entries 11, using 1760 bytes of memory<br>Peers 4, using 92 KiB of memory</pre><pre>Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt Desc<br>192.168.11.2    4      65001      3868      3875       11    0    0 03:13:17            1       11 tun-control-plane<br>192.168.12.2    4      65002      3868      3875       11    0    0 03:13:16            1       11 tun-worker<br>192.168.13.2    4      65003      3868      3875       11    0    0 03:13:16            1       11 tun-worker2<br>192.168.20.2    4      65000      3871      3873       11    0    0 03:13:17            3        8 to-vpn-gateway-ibgp</pre><pre>Total number of neighbors 4</pre><p>Now verify the IP routing table inside the ToR router:</p><pre>docker exec -it clab-bgp-frr-tor-router vtysh -c &quot;show ip route bgp&quot;</pre><pre>Codes: K - kernel route, C - connected, L - local, S - static,<br>       R - RIP, O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,<br>       T - Table, v - VNC, V - VNC-Direct, A - Babel, F - PBR,<br>       f - OpenFabric, t - Table-Direct,<br>       &gt; - selected route, * - FIB route, q - queued, r - rejected, b - backup<br>       t - trapped, o - offload failure</pre><pre>IPv4 unicast VRF default:<br>B&gt;* 0.0.0.0/0 [200/0] via 192.168.20.2, eth4, weight 1, 03:14:29<br>B&gt;* 10.0.0.0/24 [20/0] via 192.168.12.2, eth2, weight 1, 03:14:28<br>B&gt;* 10.0.1.0/24 [20/0] via 192.168.11.2, eth1, weight 1, 03:14:29<br>B&gt;* 10.0.2.0/24 [20/0] via 192.168.13.2, eth3, weight 1, 03:14:28<br>B&gt;* 10.0.3.0/24 [200/0] via 192.168.20.2, eth4, weight 1, 03:10:10<br>B&gt;* 192.168.14.0/24 [200/0] via 192.168.20.2, eth4, weight 1, 03:14:13</pre><p>What this routing table proves:</p><ul><li>Each KinD node advertises its allocated /24 PodCIDR directly to the ToR router via eBGP over dedicated point-to-point links.</li><li>The vpn-gateway (192.168.20.2) announces the remote GPU node’s PodCIDR (10.0.3.0/24) and tunnel interface network (192.168.14.0/24) via iBGP (AS 65000).</li><li>Any pod running on the local KinD cluster can now communicate directly with pods scheduled on the remote GPU node with zero NAT and zero encapsulation overhead.</li></ul><h3>Step 5: Onboarding the Remote GPU Node via Ansible</h3><p>To bridge our external GPU instance into the private Kubernetes fabric, we need to configure its kernel, create the Layer 3 point-to-point interface, and inject the underlay routes back to our KinD cluster.</p><p>Instead of installing Ansible and extra dependencies on your host machine, our vpn-gateway container already has Ansible pre-installed alongside the required SSH credentials.</p><p>1. The Remote Node Configuration Playbook</p><p>👉 View playbook: <a href="https://github.com/konstantforever/clabkindgpu/blob/main/infrastructure/kind/ansible/setup_ssh.yml">infrastructure/ansible/setup_ssh.yml</a></p><p>Why These Parameters Matter:</p><ul><li>PermitTunnel yes: Allows OpenSSH to establish raw Layer 3 point-to-point network tunnels (-w 0:0).</li><li>MTU 1380: Compensates for outer IP and SSH/TCP encapsulation overhead across the public internet.</li><li>rp_filter = 2 (Loose Mode): By default, Linux drops packets if the return route does not match the incoming interface (Strict Mode). Because BGP and Cilium eBPF perform asymmetric routing across virtual interfaces, setting loose mode on tun0 is mandatory to prevent dropped packets.</li><li>TCP MSS Clamping: Forces TCP handshakes to adjust their Maximum Segment Size to match the path MTU, preventing silent packet drops over the tunnel.</li></ul><p>2. Execute the Remote Setup via the VPN Gateway</p><p>Load your environment variables and trigger the playbook inside the clab-bgp-frr-vpn-gateway container:</p><pre># Ensure env vars are loaded in your current shell<br>cd infrastructure/kind<br>. .env</pre><pre># Run Ansible directly inside the gateway container<br>docker exec -it clab-bgp-frr-vpn-gateway sh -c \<br>  &#39;ansible-playbook -i &quot;${VPN_IP},&quot; \<br>   -u &quot;${VPN_USER}&quot; \<br>   --private-key /root/.ssh/soctl \<br>   -e &quot;ansible_port=${VPN_PORT}&quot; \<br>   --ssh-common-args=&quot;-o StrictHostKeyChecking=no&quot; \<br>   /ansible/setup_ssh.yml&#39;</pre><p>3. Reconfigure Network Tier to Establish the Tunnel</p><p>When we first deployed clab-net.yaml in Step 2, the remote host hadn’t yet permitted SSH tunneling. Now that Ansible has configured sshd and prepared the remote interfaces, reconfigure the network tier to trigger the tunnel initialization:</p><pre>clab deploy -t clab-net.yaml --reconfigure</pre><p>Why — reconfigure is required: Containerlab restarts the vpn-gateway container, which establishes the persistent autossh L3 tunnel (tun0) to the remote GPU node and immediately initiates BGP peering with the Top-of-Rack router.</p><p>4. Verify L3 Tunnel Reachability</p><p>Verify that the gateway can now reach the remote GPU node through the encrypted point-to-point interface:</p><pre>docker exec -it clab-bgp-frr-vpn-gateway ping -c 3 192.168.14.2</pre><p>Once you receive ICMP replies, both endpoints are connected. You can also re-verify BGP on the ToR router to confirm that the remote node’s subnet (192.168.14.0/24) is actively learned:</p><pre>docker exec -it clab-bgp-frr-tor-router vtysh -c &quot;show ip bgp summary&quot;</pre><h3>Step 6: Bootstrapping and Joining the Remote GPU Node</h3><p>With L3 reachability established over our tunnel, we can now configure the remote GPU host as a native Kubernetes worker node.</p><p>The secret sauce here is binding the remote kubelet explicitly to the tunnel IP (192.168.14.2). This ensures that intra-cluster pod networking, kubelet health checks, and Cilium eBPF routing all traverse the secure underlay.</p><p>1. Verify API Server Reachability from the Remote Machine</p><p>SSH into your remote GPU machine and verify that you can communicate directly with the local KinD control plane over the tunnel:</p><pre>curl -k https://192.168.11.2:6443/version</pre><pre>{<br>  &quot;major&quot;: &quot;1&quot;,<br>  &quot;minor&quot;: &quot;37&quot;,<br>  &quot;emulationMajor&quot;: &quot;1&quot;,<br>  &quot;emulationMinor&quot;: &quot;37&quot;,<br>  &quot;minCompatibilityMajor&quot;: &quot;1&quot;,<br>  &quot;minCompatibilityMinor&quot;: &quot;36&quot;,<br>  &quot;gitVersion&quot;: &quot;v1.37.0&quot;,<br>  &quot;gitCommit&quot;: &quot;f54c212e3a2f75d674b717a9b29052b20b60aefc&quot;,<br>  &quot;gitTreeState&quot;: &quot;clean&quot;,<br>  &quot;buildDate&quot;: &quot;2026-08-26T10:44:25Z&quot;,<br>  &quot;goVersion&quot;: &quot;go1.26.6&quot;,<br>  &quot;compiler&quot;: &quot;gc&quot;,<br>  &quot;platform&quot;: &quot;linux/amd64&quot;<br>}</pre><p>2. Prepare the Container Runtime &amp; Kubernetes Components</p><p>Execute the following setup sequence on the remote GPU host:</p><pre># 1. Enable kernel modules for container networking<br>modprobe overlay<br>modprobe br_netfilter</pre><pre>sysctl -w net.bridge.bridge-nf-call-iptables=1<br>sysctl -w net.ipv4.ip_forward=1</pre><pre># 2. Install and configure containerd with systemd cgroups<br>apt update &amp;&amp; apt install -y containerd<br>mkdir -p /etc/containerd<br>containerd config default | tee /etc/containerd/config.toml<br>sed -i &#39;s/SystemdCgroup = false/SystemdCgroup = true/&#39; /etc/containerd/config.toml<br>systemctl restart containerd</pre><pre># 3. Add official Kubernetes v1.37 apt repository<br>mkdir -p -m 755 /etc/apt/keyrings<br>apt install -y apt-transport-https ca-certificates curl gpg</pre><pre>curl -fsSL <a href="https://pkgs.k8s.io/core:/stable:/v1.37/deb/Release.key">https://pkgs.k8s.io/core:/stable:/v1.37/deb/Release.key</a> | \<br>  gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg</pre><pre>echo &#39;deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] <a href="https://pkgs.k8s.io/core:/stable:/v1.37/deb/">https://pkgs.k8s.io/core:/stable:/v1.37/deb/</a> /&#39; | \<br>  tee /etc/apt/sources.list.d/kubernetes.list</pre><pre># 4. Install kubelet and kubeadm<br>apt update &amp;&amp; apt install -y kubelet kubeadm</pre><pre># 5. Bind kubelet to the tunnel IP and root cgroup<br>echo &#39;KUBELET_EXTRA_ARGS=&quot;--node-ip=192.168.14.2 --cgroup-root=/&quot;&#39; | tee /etc/default/kubelet<br>systemctl daemon-reload &amp;&amp; systemctl restart kubelet</pre><pre># 6. Map the KinD control-plane hostname<br>echo &quot;192.168.11.2 tun-control-plane&quot; | tee -a /etc/hosts</pre><blockquote><em>Why </em><em>--node-ip=192.168.14.2 is vital: If left unconfigured, the kubelet will detect the server&#39;s default public IP. Explicitly pointing it to 192.168.14.2 guarantees that all inter-pod and BGP overlay communication stays locked inside our private tunnel.</em></blockquote><p>3. Generate the Join Command on the Control Plane Back on your local machine (in your KinD cluster environment), generate a fresh join token:</p><pre>docker exec -it tun-control-plane kubeadm token create --print-join-command</pre><p>This returns the join syntax:</p><pre>kubeadm join tun-control-plane:6443 --token &lt;token&gt; \<br>  --discovery-token-ca-cert-hash sha256:&lt;hash&gt;</pre><p>4. Join the Remote GPU Node to the Cluster</p><p>Run the join command directly on the remote GPU machine. Notice that we override the endpoint to use the control plane IP 192.168.11.2 and specify — node-name remote:</p><pre>kubeadm join 192.168.11.2:6443 \<br>  --token &lt;token&gt; \<br>  --discovery-token-ca-cert-hash sha256:&lt;hash&gt; \<br>  --node-name remote \<br>  --ignore-preflight-errors=SystemVerification,Swap \<br>  --v=5</pre><p>When successful, you will see:</p><pre>This node has joined the cluster:<br>* Certificate signing request was sent to apiserver and a response was received.<br>* The Kubelet was informed of the new secure connection details.</pre><pre>Run &#39;kubectl get nodes&#39; on the control-plane to see this node join the cluster.</pre><p>5. Label Node and Verify Hybrid Cluster State</p><p>Back in your local development environment, label the newly added node so our AI inference workloads (e.g., KubeAI) can target it specifically:</p><pre>kubectl label node remote gpu=true --overwrite</pre><p>Now inspect the entire cluster:</p><pre>kubectl get nodes -o wide</pre><pre>NAME                STATUS   ROLES           AGE     VERSION   INTERNAL-IP    EXTERNAL-IP   OS-IMAGE                       KERNEL-VERSION             CONTAINER-RUNTIME<br>remote              Ready    &lt;none&gt;          7m33s   v1.37.2   192.168.14.2   &lt;none&gt;        Ubuntu 26.04.1 LTS             7.0.0-43-generic (amd64)   containerd://2.2.2<br>tun-control-plane   Ready    control-plane   51m     v1.37.0   172.23.0.3     &lt;none&gt;        Debian GNU/Linux 13 (trixie)   7.0.0-43-generic (amd64)   containerd://2.3.4<br>tun-worker          Ready    &lt;none&gt;          51m     v1.37.0   172.23.0.4     &lt;none&gt;        Debian GNU/Linux 13 (trixie)   7.0.0-43-generic (amd64)   containerd://2.3.4<br>tun-worker2         Ready    &lt;none&gt;          51m     v1.37.0   172.23.0.5     &lt;none&gt;        Debian GNU/Linux 13 (trixie)   7.0.0-43-generic (amd64)   containerd://2.3.4</pre><p>The Architecture in Action:</p><p>Because our node was joined with --node-name remote:</p><ol><li>Cilium automatically scheduled an agent pod on it.</li><li>The CiliumBGPClusterConfig/cilium-bgp-gpu manifest we applied in Step 4 instantly matched the node label kubernetes.io/hostname: remote.</li><li>The remote node peered over eBGP (AS 65004) to 192.168.14.1 (vpn-gateway), announcing its dedicated PodCIDR (10.0.3.0/24).</li></ol><p>Our hybrid AI Kubernetes cluster is now fully unified and ready to run GPU workloads!</p><h3>Step 7: Patching CoreDNS for Hybrid Name Resolution</h3><p>Before launching AI workloads, we must address a common pitfall in hybrid KinD environments: upstream DNS resolution.</p><p>By default, CoreDNS inside KinD forwards external DNS queries to /etc/resolv.conf, inheriting Docker’s internal resolver (127.0.0.11). When pods running on our remote GPU node need to download model weights from Hugging Face or pull engine containers from public registries, resolution through Docker’s loopback fails or causes resolution loops.</p><p>To fix this, we point CoreDNS directly to public DNS upstreams (8.8.8.8 and 1.1.1.1).</p><ol><li>Update the CoreDNS ConfigMap</li></ol><p>Edit the ConfigMap directly:</p><pre>kubectl edit cm coredns -n kube-system</pre><p>Replace the default forward . /etc/resolv.conf block with explicit public resolvers:</p><pre>forward . 8.8.8.8 1.1.1.1 {<br>       max_concurrent 1000<br>    }</pre><p>Your final Corefile should look like this:</p><pre>kubectl get cm coredns -n kube-system -o jsonpath=&#39;{.data.Corefile}&#39;</pre><pre>.:53 {<br>    errors<br>    health {<br>       lameduck 5s<br>    }<br>    ready<br>    kubernetes cluster.local in-addr.arpa ip6.arpa {<br>       pods insecure<br>       fallthrough in-addr.arpa ip6.arpa<br>       ttl 30<br>    }<br>    prometheus :9153<br>    forward . 8.8.8.8 1.1.1.1 {<br>       max_concurrent 1000<br>    }<br>    cache 30 {<br>       disable success cluster.local<br>       disable denial cluster.local<br>    }<br>    loop<br>    reload<br>    loadbalance<br>}</pre><p>2. Restart CoreDNS Deployment Trigger a rolling restart of CoreDNS so the pods pick up the new configuration immediately:</p><pre>kubectl rollout restart deployment coredns -n kube-system<br>kubectl rollout status deployment coredns -n kube-system</pre><p>Now, every pod in the cluster — whether running on local KinD worker containers or across the tunnel on the remote bare-metal GPU node — will have bulletproof internet name resolution.</p><h3>Step 8: Deploying KubeAI, Securing with Gateway API, and Running Inference</h3><p>Now we reach the final milestone: deploying KubeAI to manage our LLM, and exposing it to the outside world using Cilium Gateway API.</p><p>1. Install KubeAI via Helm</p><p>Add the official repository and install KubeAI:</p><pre>helm repo add kubeai https://www.kubeai.org<br>helm repo update </pre><pre>helm upgrade --install kubeai kubeai/kubeai \<br>  --namespace kubeai-operator \<br>  --create-namespace \<br>  --version 0.25.1 \<br>  -f infrastructure/kubeai/helm/values.yaml</pre><p>2. Deploy the Model (Qwen)</p><p>Apply the Model manifest to trigger KubeAI:</p><pre>kubectl apply -f infrastructure/kubeai/manifests/model.yaml</pre><p>Because our remote GPU node was tagged with gpu=true, KubeAI schedules the inference engine (vLLM) directly on that machine, downloads the model weights, and registers the backend service.</p><p>3. Expose Inference via Cilium Gateway API</p><p>Instead of routing heavy inference traffic back and forth through our management tunnel, we bind our Gateway directly to the physical interface of the remote GPU server (bypassing tun0 entirely):</p><ul><li>Direct Public IP (Bare-metal): Bind the Gateway directly to your server’s public IP (${VPN_IP}).</li><li>Behind NAT / Private LAN: If your GPU server sits behind a router, firewall, or cloud NAT (where the OS only sees a private IP like 192.168.1.x or 10.x.x.x), bind the Gateway to that local interface IP, and forward port 8443 on your external router to it.</li></ul><p>This guarantees that inference requests enter the GPU node directly through its physical uplink with zero encapsulation and zero management tunnel overhead.</p><p>Create a dedicated IP pool referencing our remote node’s public IP:</p><pre># infrastructure/cilium/manifests/lb.yaml<br>apiVersion: cilium.io/v2<br>kind: CiliumLoadBalancerIPPool<br>metadata:<br>  name: remote-node-lb-pool<br>spec:<br>  blocks:<br>    # Must be the IP assigned to the node&#39;s physical interface (e.g., eth0), NEVER the tun0 IP:<br>    # - Direct Bare-Metal: use your public IP (${VPN_IP}/32)<br>    # - Behind NAT / Private LAN: use your host&#39;s local interface IP (e.g., 192.168.1.x/32 or 10.x.x.x/32)<br>    - cidr: 4.3.2.1/32</pre><blockquote><em>💡 Important Note: The IP in this pool must belong to the remote GPU host’s primary physical network interface (e.g., eth0). Do not use the tunnel IP (192.168.14.2), as that is dedicated exclusively to intra-cluster Kubernetes control-plane traffic. If your machine is behind a NAT or router, specify its local LAN IP here so the Gateway can bind locally.</em></blockquote><p>Apply the pool:</p><pre>kubectl apply -f infrastructure/cilium/manifests/lb.yaml</pre><p>Step B: Issue Self-Signed TLS Certificate Generate an SSL certificate matching the remote node’s public IP:</p><pre>openssl req -x509 -nodes -days 365 -newkey rsa:2048 \<br>  -keyout tls.key -out tls.crt \<br>  -subj &quot;/CN=${VPN_IP}&quot; \<br>  -addext &quot;subjectAltName = IP:${VPN_IP}&quot;</pre><pre>kubectl create secret tls my-gateway-tls --cert=tls.crt --key=tls.key</pre><p>Step C: Deploy the Gateway</p><p>Define the Gateway listener on port 8443 with TLS termination:</p><pre># infrastructure/cilium/manifests/gw.yaml<br>apiVersion: gateway.networking.k8s.io/v1<br>kind: Gateway<br>metadata:<br>  name: my-gateway<br>  namespace: default<br>  annotations:<br>    io.cilium/lb-ipam-pool: remote-node-lb-pool<br>    io.cilium/service-external-traffic-policy: Local<br>spec:<br>  gatewayClassName: cilium<br>  listeners:<br>  - name: https-my<br>    protocol: HTTPS<br>    port: 8443<br>    tls:<br>      mode: Terminate<br>      certificateRefs:<br>      - name: my-gateway-tls<br>    allowedRoutes:<br>      namespaces:<br>        from: All</pre><blockquote><em>Why external-traffic-policy: Local matters: It ensures the Gateway pod running directly on the GPU node processes incoming external traffic locally, preserving client source IP and avoiding unnecessary inter-node routing back to KinD.</em></blockquote><pre>kubectl apply -f infrastructure/cilium/manifests/gw.yaml</pre><p>Step D: Secure L7 Routing with HTTPRoute</p><p>We configure an HTTPRoute that does something powerful: it enforces API authentication at the network edge. Cilium Envoy drops any request lacking the pre-shared Bearer token before it ever reaches the KubeAI model pod:</p><pre># infrastructure/kubeai/manifests/route.yaml<br>apiVersion: gateway.networking.k8s.io/v1<br>kind: HTTPRoute<br>metadata:<br>  name: qwen-via-kubeai-route<br>  namespace: kubeai-operator<br>spec:<br>  parentRefs:<br>  - name: my-gateway<br>    namespace: default<br>  rules:<br>  - matches:<br>    - path:<br>        type: PathPrefix<br>        value: /openai/v1<br>      headers:<br>      - name: Authorization<br>        value: &quot;Bearer ooV3ucesh2au7gaeNg3faoqu7ehoomaadu9Apheec6ahsiar2veiw7weik7coh9sooz5otiCou&quot;<br>    backendRefs:<br>    - group: &quot;&quot;<br>      kind: Service<br>      name: kubeai<br>      namespace: kubeai-operator<br>      port: 80</pre><p>Apply the route:</p><pre>kubectl apply -f infrastructure/kubeai/manifests/route.yaml</pre><p>Step E: Verify Service Allocation</p><p>Check all services across namespaces:</p><pre>kubectl get svc -A</pre><pre>NAMESPACE         NAME                        TYPE           CLUSTER-IP      EXTERNAL-IP       PORT(S)                  AGE<br>default           cilium-gateway-my-gateway   LoadBalancer   10.96.243.175   4.3.2.1   8443:30525/TCP           4h3m<br>default           kubernetes                  ClusterIP      10.96.0.1       &lt;none&gt;            443/TCP                  6h19m<br>kube-system       cilium-envoy                ClusterIP      None            &lt;none&gt;            9964/TCP                 5h16m<br>kube-system       kube-dns                    ClusterIP      10.96.0.10      &lt;none&gt;            53/UDP,53/TCP,9153/TCP   6h19m<br>kubeai-operator   kubeai                      ClusterIP      10.96.145.66    &lt;none&gt;            80/TCP                   4h31m<br>kubeai-operator   kubeai-open-webui           ClusterIP      10.96.234.197   &lt;none&gt;            80/TCP                   4h31m</pre><p>The cilium-gateway-my-gateway service automatically acquired our public IP (4.3.2.1)!</p><p>4. Running the End-to-End Inference Test</p><p>Send an OpenAI-compatible request from your local machine to the remote public Gateway endpoint:</p><pre>. infrastructure/kind/.env</pre><pre>curl -s -k -X POST <a href="https://${vpn_ip}:8443/openai/v1/chat/completions">https://${VPN_IP}:8443/openai/v1/chat/completions</a> \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -H &quot;Authorization: Bearer ooV3ucesh2au7gaeNg3faoqu7ehoomaadu9Apheec6ahsiar2veiw7weik7coh9sooz5otiCou&quot; \<br>  -d &#39;{<br>    &quot;model&quot;: &quot;qwen25&quot;,<br>    &quot;messages&quot;: [<br>      {&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: &quot;Hello! Who are you?&quot;}<br>    ]<br>  }&#39; | jq .</pre><p>The Response:</p><pre>{<br>  &quot;choices&quot;: [<br>    {<br>      &quot;finish_reason&quot;: &quot;stop&quot;,<br>      &quot;index&quot;: 0,<br>      &quot;message&quot;: {<br>        &quot;role&quot;: &quot;assistant&quot;,<br>        &quot;content&quot;: &quot;Hello! I am Qwen, a large language model created by Alibaba Cloud. I am here to assist you with various tasks and answer your questions to the best of my abilities. How can I assist you today?&quot;<br>      }<br>    }<br>  ],<br>  &quot;created&quot;: 1795351936,<br>  &quot;model&quot;: &quot;qwen25&quot;,<br>  &quot;system_fingerprint&quot;: &quot;b10680-d7bd3bfca&quot;,<br>  &quot;object&quot;: &quot;chat.completion&quot;,<br>  &quot;usage&quot;: {<br>    &quot;completion_tokens&quot;: 44,<br>    &quot;prompt_tokens&quot;: 35,<br>    &quot;total_tokens&quot;: 79,<br>    &quot;prompt_tokens_details&quot;: {<br>      &quot;cached_tokens&quot;: 34<br>    }<br>  },<br>  &quot;id&quot;: &quot;chatcmpl-eyiR3L7cGeUrle7tknT2wBxIsxcgaAZW&quot;,<br>  &quot;timings&quot;: {<br>    &quot;cache_n&quot;: 34,<br>    &quot;prompt_n&quot;: 1,<br>    &quot;prompt_ms&quot;: 202.185,<br>    &quot;prompt_per_token_ms&quot;: 202.185,<br>    &quot;prompt_per_second&quot;: 4.945965328783045,<br>    &quot;predicted_n&quot;: 44,<br>    &quot;predicted_ms&quot;: 9170.435,<br>    &quot;predicted_per_token_ms&quot;: 213.26593023255813,<br>    &quot;predicted_per_second&quot;: 4.688981493244323<br>  }<br>}</pre><p>A Note on GPUs: The Traditional “Homework Assignment” 🎮</p><p>Of course, to run actual hardware-accelerated LLMs on the remote node, Kubernetes needs to see the GPU devices.</p><p>Once your remote host has the NVIDIA drivers and the NVIDIA Container Toolkit configured with CDI, you simply roll out the official NVIDIA Device Plugin targeted at our GPU node:</p><pre>helm repo add nvdp https://nvidia.github.io/k8s-device-plugin<br>helm repo update </pre><pre>helm upgrade -i nvdp nvdp/nvidia-device-plugin \<br>  --namespace nvidia-device-plugin \<br>  --create-namespace \<br>  --version 0.20.2 \<br>  --set runtimeClassName=nvidia \<br>  --set image.pullPolicy=IfNotPresent \<br>  --set deviceListStrategy=cdi-annotations \<br>  --set nvidiaDriverRoot=/ \<br>  --set compatWithCPUManager=true \<br>  --set affinity=null \<br>  --set-string nodeSelector.gpu=&quot;true&quot;</pre><p>As is tradition in the AI infrastructure world, debugging CUDA driver mismatches, kernel headers, and containerd runtime configurations is left as an exciting exercise for the reader! 😉</p><p><strong>Conclusion</strong></p><p>We have successfully engineered an advanced Hybrid AI Infrastructure:</p><ol><li>Zero Cloud Management Overhead: A local KinD cluster orchestrated by Containerlab runs our Control Plane for free.</li><li>Encapsulation-Free L3 Routing: Cilium’s modern v2 BGP Control Plane peers directly with our FRR Top-of-Rack router, delivering pure L3 pod routing across local and remote nodes.</li><li>Optimized Inference Traffic: Instead of hairpinning heavy model inference through the VPN tunnel, Cilium Gateway API terminates client traffic directly on the public IP of the GPU node with TLS and header-based token validation.</li><li>Declarative AI Orchestration: With KubeAI, self-hosting state-of-the-art LLMs is as straightforward as applying a native Kubernetes manifest.</li></ol><p>📦 Check out the full repository on GitHub: <a href="https://github.com/konstantforever/clabkindgpu">https://github.com/konstantforever/clabkindgpu</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9562f504ccea" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>