netclab-xp, routers operated from Kubernetes

published

Extend Kubernetes to manage any resource anywhere

Powered by crossplane.io

Crossplane Configuration packages that operate routers from Kubernetes.

They turn router settings into Kubernetes resources: declarative, versioned,
reviewable, and reconciled like anything else in a cluster.

package devices over tags
configuration-iosxe Cisco IOS XE RESTCONF iosxe/v*
configuration-eos Arista EOS RESTCONF, JSON-RPC (eAPI) eos/v*
configuration-aws-vpn Cisco IOS XE and AWS RESTCONF, the AWS API aws-vpn/v*

Until v0.5.0 the EOS package was published as netclab-xp; those releases stay
where they are.

Documentation

netclab.dev/netclab-xp

IPsec on IOS XE adopting a router, part 9 with a post-quantum preshared key, an overlay in VRFs, key rotation
Site-to-Site VPN to AWS a router and an AWS gateway from one object, keys rotated one tunnel at a time
Arista EOS one API over several mechanisms
Set up a lab two cEOS devices on Kubernetes
Install the package the Configuration and its prerequisites
Your first resource one interface, then a BGP session between two devices
Scenarios every mechanism the package offers

Cisco IOS XE

One resource type per section of the router's configuration in iosxe.netclab.dev, over RESTCONF:
Device, Ikev2Proposal, Ikev2Policy, Ikev2Keyring (with a post-quantum
preshared key), Ikev2Profile, IpsecTransformSet, IpsecProfile and
TunnelInterface. Each waits for the objects it names, so a set applies at once.

A router configured by hand is adopted one section at a time: each object first observes,
showing what the router holds and what differs from its spec, and writes only once set to
Merge or Replace. Keys live in Secrets, and a key changed there reaches both ends.

iosxe/scenarios/part9/ is part 9 of
Cisco's IPsec series:
Tunnel0 between two routers, with a post-quantum preshared key (PPK, RFC 8784) mixed
into IKEv2, kept on the routers by reconcile:

$ kubectl get tunnelinterface -n lab
NAME                    DEVICE   INTERFACE   TUNNEL-MODE   ADDRESS            MODE      OPER    IKE-SA   WANTS-NAME   SYNCED   READY   COMPOSITION                          AGE
r1--tunnel0--d311cfe5   r1       Tunnel0     ipsec-ipv4    192.168.100.1/24   Replace   ready   1/1                   True     True    tunnelinterfaces.iosxe.netclab.dev   5m54s
r3--tunnel0--d311cfe5   r3       Tunnel0     ipsec-ipv4    192.168.100.2/24   Replace   ready   1/1                   True     True    tunnelinterfaces.iosxe.netclab.dev   5m54s

iosxe/scenarios/overlay/ is the same tunnel with a
front-door VRF and an overlay VRF. See IPsec on IOS XE.

Installation

Needs the prerequisites of netclab:
Docker, kind, kubectl, Helm, and uv. A kind cluster with Crossplane and the package:

CROSSPLANE=<release>   # a Crossplane v2 release
VERSION=<version>      # the newest iosxe/v* tag, without iosxe/

uvx netclab up --cluster xp --crossplane ${CROSSPLANE} \
  --configuration xpkg.upbound.io/netclab/configuration-iosxe:${VERSION}

The routers need RESTCONF and a user it accepts:
Quick start.

Usage

Set each Device's address to its router's RESTCONF address,
iosxe/examples/device/r1.yaml and iosxe/scenarios/part9/r3/device.yaml, then:

git clone https://github.com/netclab/netclab-xp
cd netclab-xp
kubectl apply -k iosxe/scenarios/prerequisites
kubectl kustomize --load-restrictor LoadRestrictionsNone iosxe/scenarios/part9 \
  | kubectl apply -f -
kubectl get device,tunnelinterface -n lab

Teardown and the rest: Quick start.

Arista EOS

One API for you, several mechanisms for the device. Everything is a
Kubernetes resource, applied and reviewed the same way whatever the device
speaks. Underneath, RESTCONF carries structured data and reaches what OpenConfig
models, while eAPI carries CLI commands over JSON-RPC and reaches whatever the
CLI can say. They overlap heavily, and where they overlap, the mechanism is
selectable without changing the resource.

Above that, layers describing how much you configure at once:

Fabric (function-avd, installed apart)          a whole network, one design
   v
Router                                          one device, one resource
   v
BgpGlobal, BgpNeighbor, BgpPeerGroup,           one setting, one resource
RoutedInterface, LoopbackInterface,
IpRouting, EosCommand, ...
   v
provider-http                                   RESTCONF, JSON-RPC, eAPI

The low-level resources map closely onto what a device models; Router
composes them into something you would recognise as a router; and Fabric
describes the design of a whole network, leaving AVD to work out each switch's
configuration.

The bottom three layers are this package's own: twelve resource types in
eos.netclab.dev, installed together. Fabric is
function-avd's, and not installed
with configuration-eos.

Scenarios

The repository carries runnable manifests for every mechanism, under
eos/scenarios/:

scenario mechanism
restconf OpenConfig over RESTCONF: the base config
jsonrpc eAPI over JSON-RPC: settings OpenConfig does not model
eapi raw EOS CLI through function-eapi
router the Router abstraction

restconf, eapi and router are alternatives to one another: each becomes
an owner of the same device configuration. See
Scenarios for how to apply
and remove them.

Contributing & extending

Contributions are welcome: new vendor-specific resource types, higher-level
abstractions, better compositions, examples, tests, or documentation.

License

Licensed under the Apache-2.0 License.
Copyright 2025-present Michal Bakalarski and Netclab Contributors.

View code on GitHub

Code Exchange Community

Get help, share code, and collaborate with other developers in the Code Exchange community.View Community
Disclaimer:
Cisco provides Code Exchange for convenience and informational purposes only, with no support of any kind. This page contains information and links from third-party websites that are governed by their own separate terms. Reference to a project or contributor on this page does not imply any affiliation with or endorsement by Cisco.