# How to write a new custom Node Driver

**URL:** <https://forums.suse.com/t/how-to-write-a-new-custom-node-driver/17309>\
**Category:** SUSE Rancher Prime\
**Created:** [April 30, 2020, 1:29am UTC](https://forums.suse.com/t/how-to-write-a-new-custom-node-driver/17309 "2020-04-30T01:29:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![livinston](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/livinston/32/6325_2.png) [@livinston](https://forums.suse.com/u/livinston)\
**Post date:** [April 30, 2020, 1:29am UTC](https://forums.suse.com/t/how-to-write-a-new-custom-node-driver/17309/1 "2020-04-30T01:29:12Z")

</div>

1. Can someone point me to the documentation for writing rancher custom node driver? We need this to support the provisioning of VMs in our private cloud. Sifting through the official docs of rancher 2.x landed me with this [page](https://rancher.com/docs/rancher/v2.x/en/admin-settings/drivers/node-drivers/#adding-custom-node-drivers). This pretty much delegates it to docker-machine. Going through the documentation of docker-machine, I got hold of the Drivers section in the Contributing Guide (not putting link since new users are only allowed 2 links) which generically explains guidelines on how to get a docker-machine driver accepted by the maintainers of the project. Other than that I couldn’t find any specifics of creating a docker-machine driver.
2. I came across this PR on github docker/machine#1902 (quite old - 17 Oct 2015. not putting as a link since new users are only allowed 2 links) which seems to give some technical details like which interface to implement and an example driver on github docker/docker-machine-example(not putting as a link since new users are only allowed 2 links) that could be used as a starter code(repo is missing and couldn’t find the code in the main repo as well). Can this be considered the official documentation?
3. I also came across this issue [docker/machine#4537](https://github.com/docker/machine/issues/4537) in the docker-machine GitHub repo which says that the project is in maintenance mode(14th July 2018). Will docker-machine continue to be the standard node driver integration in rancher. Just asking to assess if it would be worth the effort in creating a docker-machine driver that is specific for a private cloud.

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [April 30, 2020, 1:44am UTC](https://forums.suse.com/t/how-to-write-a-new-custom-node-driver/17309/2 "2020-04-30T01:44:56Z")

</div>

We are still maintaining a forked version of it; you can look at any 3rd-party machine driver as an example but you basically just implement the golang interface for the lifecycle of a node. Create the VM, get its IP, configure the SSH key, etc.

Custom UI for Rancher after you have the actual driver working is a separate optimal step (without it you’ll get a generic laid out form of the options).

---

<div class="post-metadata">

**Author:** ![livinston](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/livinston/32/6325_2.png) [@livinston](https://forums.suse.com/u/livinston)\
**Post date:** [April 30, 2020, 3:46am UTC](https://forums.suse.com/t/how-to-write-a-new-custom-node-driver/17309/3 "2020-04-30T03:46:57Z")

</div>

Is this documented somewhere, at least in the forked version of docker-machine?

Adding this info here to avoid additional google searches for users who come across this post:

1. [Driver](https://github.com/rancher/machine/blob/47ba74901e3084288fc72826b68fdb311bbb810d/libmachine/drivers/drivers.go) seems to be the golang interface for the lifecycle of a node that needs to be implemented
2. [ui-driver-skel](https://github.com/rancher/ui-driver-skel) is the starter repo for implementing a custom UI for your custom node driver. The Usage section of README also includes steps on adding the custom driver binary and UI to rancher.

---

<div class="post-metadata">

**Author:** ![livinston](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/livinston/32/6325_2.png) [@livinston](https://forums.suse.com/u/livinston)\
**Post date:** [April 30, 2020, 4:07am UTC](https://forums.suse.com/t/how-to-write-a-new-custom-node-driver/17309/4 "2020-04-30T04:07:32Z")

</div>

The documentation for implementing a docker-machine driver seems to available on [github](https://git.io/JfY71), but not on the [official documentation website](https://tinyurl.com/jm9d6vp). That is the reason it was difficult to discover.

---

<div class="post-metadata">

**Author:** ![blackwood821](https://avatars.discourse-cdn.com/v4/letter/b/d78d45/32.png) [@blackwood821](https://forums.suse.com/u/blackwood821)\
**Post date:** [March 19, 2022, 1:27am UTC](https://forums.suse.com/t/how-to-write-a-new-custom-node-driver/17309/5 "2022-03-19T01:27:44Z")

</div>

@livinston I know this is an old post but I’m testing out a custom node driver as well and am running into an issue where I don’t know how to pass an SSH key to my driver. The custom node driver accepts either a path to a SSH key or the fingerprint of a SSH key that is loaded in the SSH agent. I’m able to set either of these parameters in my node template but I don’t know how to get my node driver access to this SSH key. I’m running rancher in a docker container on an Ubuntu VM. I tried placing my SSH key inside the rancher docker container but that didn’t work since rancher creates a jail when running the node driver. I also tried adding the SSH key to the SSH agent in the Ubuntu VM and recreated the rancher docker container with the following arguments: `-v $SSH_AUTH_SOCK:$SSH_AUTH_SOCK -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK` which allows me to see the SSH key when I run `ssh-add -l` from inside the rancher docker container but `$SSH_AUTH_SOCK` is still not accessible to my node driver since it’s in a jail. Any suggestions?

Here’s where I see it creating a jail in the rancher docker container log:

```auto
2022/03/19 01:27:45 [INFO] Creating jail for c-9dfx6
2022/03/19 01:27:45 [INFO] Provisioning node k8s-worker-1

```

---

<div class="post-metadata">

**Author:** ![Holger\_Winkelmann](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/holger_winkelmann/32/8961_2.png) [@Holger\_Winkelmann](https://forums.suse.com/u/Holger_Winkelmann)\
**Post date:** [May 7, 2022, 4:42am UTC](https://forums.suse.com/t/how-to-write-a-new-custom-node-driver/17309/6 "2022-05-07T04:42:54Z")

</div>

Seems Cluster API with machine controller would be a good fit these days?
