github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/website/pages/docs/drivers/external/firecracker-task-driver.mdx (about)

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