github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/plugins/drivers/community/firecracker-task-driver.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: 'Drivers: firecracker-task-driver'
     4  description: >-
     5    The Firecracker task driver is used to run
     6    firecracker(https://firecracker-microvm.github.io/) microvms.
     7  ---
     8  
     9  # Firecracker task Driver
    10  
    11  Name: `firecracker-task-driver`
    12  
    13  The Firecracker task driver provides an interface for creating Linux microvms.
    14  For more detailed instructions on how to set up and use this driver, please
    15  refer to the [documentation][firecracker-task-guide].
    16  
    17  ## Task Configuration
    18  
    19  ```hcl
    20  task "test01" {
    21    driver = "firecracker-task-driver"
    22  
    23    config {
    24      KernelImage = "/home/build/hello-vmlinux.bin"
    25      Firecracker = "/home/build/firecracker"
    26      Vcpus       = 1
    27      Mem         = 128
    28      Network     = "default"
    29    }
    30  }
    31  ```
    32  
    33  The firecracker task driver supports the following parameters:
    34  
    35  - `KernelImage` - (Optional) Path to the kernel image to be used on the microvm.
    36    Defaults to 'vmlinux' in the [allocation working directory].
    37  
    38  - `BootDisk` - (Optional) Path to the ext4 rootfs to boot from.
    39    Defaults to 'rootfs.ext4' in the [allocation working directory].
    40  
    41  - `BootOptions` - (Optional) Kernel command line options to boot the microvm.
    42    Defaults to "ro console=ttyS0 reboot=k panic=1 pci=off"
    43  
    44  - `Network` - (Optional) Network name of your container network configuration
    45    file.
    46  
    47  - `Vcpus` - (Optional) Number of CPUs to assign to microvm.
    48  
    49  - `Cputype` - (Optional) CPU template to use, templates available are C3 or T2.
    50  
    51  - `Mem` - (Optional) Amount of memory in Megabytes to assign to microvm.
    52    Defaults to 512
    53  
    54  - `Firecracker` Location of the firecracker binary, the option could be omitted
    55    if the environment variable FIRECRACKER_BIN is setup. Defaults to
    56    '/usr/bin/firecracker'
    57  
    58  - `DisableHt` - (Optional) Disable CPU Hyperthreading. Defaults to false
    59  
    60  - `Log` - (Optional) path to file where to write firecracker logs.
    61  
    62  ## Networking
    63  
    64  Network configuration is setup using CNI plugins, the steps to setup firecracker
    65  task driver with cni are the following:
    66  
    67  - Build [cni plugins][container network plugins] and [tc-redirect-tap][tc-redirect-tap]
    68    and copy them to `/opt/cni`.
    69  
    70  - Create a network configuration to be used by micro-vms on /etc/cni/conf.d/,
    71    for example: default.conflist.
    72  
    73  ### Example network configuration
    74  
    75  ```json
    76  {
    77    "name": "default",
    78    "cniVersion": "0.4.0",
    79    "plugins": [
    80      {
    81        "type": "ptp",
    82        "ipMasq": true,
    83        "ipam": {
    84          "type": "host-local",
    85          "subnet": "192.168.127.0/24",
    86          "resolvConf": "/etc/resolv.conf"
    87        }
    88      },
    89      {
    90        "type": "firewall"
    91      },
    92      {
    93        "type": "tc-redirect-tap"
    94      }
    95    ]
    96  }
    97  ```
    98  
    99  In this example the name of this network is default and this name is the
   100  parameter used in Network on the task driver job spec. Also the filename must
   101  match the name of the network, and use the .conflist extension.
   102  
   103  ## Client Requirements
   104  
   105  `firecracker-task-driver` requires the following:
   106  
   107  - Linux 4.14+ Firecracker currently supports physical Linux x86_64 and aarch64
   108    hosts, running kernel version 4.14 or later. However, the aarch64 support is
   109    not feature complete (alpha stage)
   110  
   111  - The [Firecracker binary][firecracker binary]
   112  
   113  - KVM enabled in your Linux kernel, and you have read/write access to /dev/kvm
   114  
   115  - tun kernel module
   116  
   117  - The firecracker-task-driver binary placed in the [plugin_dir][plugin_dir]
   118    directory
   119  
   120  - ip6tables package
   121  
   122  - [Container network plugins][container network plugins]
   123  
   124  - [tc-redirect-tap][tc-redirect-tap]
   125  
   126  [plugin_dir]: /docs/configuration#plugin_dir
   127  [tc-redirect-tap]: https://github.com/firecracker-microvm/firecracker-go-sdk/tree/master/cni
   128  [container network plugins]: https://github.com/containernetworking/plugins
   129  [firecracker binary]: https://github.com/firecracker-microvm/firecracker/releases
   130  [firecracker-task-guide]: https://github.com/cneira/firecracker-task-driver
   131  [allocation working directory]: /docs/runtime/environment#task-directories 'Task Directories'