-
Notifications
You must be signed in to change notification settings - Fork 98
KinD plugin and device #2997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
KinD plugin and device #2997
Conversation
|
@wnagele -- the "kind" plugin (documentation included in PR) successfully starts a single-node or multi-node KinD cluster, including attachments to LAN or P2P links. The configuration of the cluster nodes (IP addresses and static routes) is still missing, but I think I know how I'll handle that. A few more days... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a new "kind" plugin that implements Kubernetes in Docker (KinD) cluster deployments for containerlab. The plugin creates multi-node Kubernetes clusters from a single node definition, automatically expanding it into control-plane and worker nodes with appropriate networking.
Changes:
- Adds kind plugin with pre_node_transform hook to expand kind device nodes into KinD clusters
- Adds kind and kind-node daemon definitions with Linux parent configuration
- Extends clab provider with cp_sh mode for copying and executing scripts in containers
- Adds comprehensive documentation for the plugin
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| netsim/providers/clab.py | Adds cp_sh mode for copying files into containers before executing them |
| netsim/extra/kind/plugin.py | Core plugin logic to expand kind nodes into control-plane and worker nodes with link replication |
| netsim/extra/kind/defaults.yml | Device definitions for kind and kind-node daemons |
| netsim/daemons/kind/initial.j2 | KinD cluster configuration template |
| docs/plugins/kind.md | Plugin documentation with usage examples |
| docs/plugins.md | Adds kind plugin to documentation index |
| docs/platforms.md | Updates platform support tables and adds daemon-related notes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
|
@wnagele -- This should be it. The cluster comes up and IP addresses and static routes are configured on cluster nodes. Would love to hear your feedback before merging it. Thank you! |
|
Will change the way "kind" device is defined and tied to the "kind" plugin based on the kind remark by @jbemmel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.
|
I'll try to find time this week to give it a spin. Thanks! |
|
Did a test drive with this. I got stuck on the point of having to influence the configs inside the worker nodes started by the plugin. How would I be running |
Thank you!
What exactly would you like to execute on those nodes? IP addresses and static routes are already configured. |
|
As these are K8S nodes - without some further setup they are doing basically nothing. The main things to do here are not network related - applying K8S manifests to get Pods, etc. started. I would have liked to be able to provide those commands via |
And I thought there would be some magic API exposed by the K8s control-plane node and a CLI command you could execute on the host to get the pods deployed.
Here's a topology that executes a command on the control-plane node: However, it's "a bit" hard to get a file into the KinD container as clab.binds does not work. If you insist on executing commands within the containers, it might be best to go with Unfortunately, "netlab config" or "config" node attribute don't work because the KinD nodes are running systemd and thus have per-tty (or whatever) /tmp directory. I might have a solution for that, but it's in another branch, so I have to merge stuff first. Let me know what works best for you, and I'll add that to the documentation. |
|
Is there a way to influence this? My worker nodes in the cluster have to do forwarding but I cannot switch the role to |
| initial: /tmp/kind | ||
| routing: /tmp/routing | ||
| image: kindest/node:v1.34.3 | ||
| build: 'https://netlab.tools/netlab/clab/#netlab-clab-build' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The image here is available in Docker hub. No need to build locally. Remove the build parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, copy-paste blunder.
|
|
||
| def setup_kind_cluster(node: Box, topology: Box) -> None: | ||
| k_workers = node.get('kind.workers',0) | ||
| node.clab['startup-config'] = f'node_files/{node.name}/initial' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any objection to making this conditional? I'd like to be able to set the startup-config in my topology in case I have more advanced configs. A simple if not node.clab.get('startup-config') around it would suffice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely not a problem, although I'd recommend using a user template in that case.
Allowing the role "router", or even having "kind.role" attribute would be easiest. Let me check how that works with loopbacks. |
|
Thanks, aside from my remarks above - this works for my usecase. |
|
Found one bug that seems to come somewhere from the |
The "kind" plugin implements Kubernetes in Docker (KinD) cluster for containerlab deployments