nsc create
create
starts a fresh Kubernetes cluster in an ephemeral and isolated environment.
The Kubernetes distribution is k3s. The environment is uniquely identified
by a cluster ID. You can specify the machine shape you need and a file to output the cluster ID.
For example:
Usage
nsc create [--machine_type <cpu>x<mem>] [--output_to <path>] [--wait_kube_system]
Example
The following example creates a new ephemeral Kubernetes cluster with the default machine shape (4 CPUs and 4 GiB of memory).
$ nsc create
Created cluster "h9am86n6gi25m"
deadline: 2023-04-25T08:48:38Z
The below command creates a Kubernetes cluster with 4 CPUs and 8 GiB of memory. Then, it writes the
cluster ID into a file, which is especially useful for writing automation programs around nsc
CLI.
$ nsc create --machine_type 4x8 --output_to /tmp/cluster_id
Created cluster "hrc4b9nvoj7ki"
deadline: 2023-04-25T08:58:58Z
$ cat /tmp/cluster_id
hrc4b9nvoj7ki
Options
--machine_type <cpu>x<mem>
Specifying the machine shape. Namespace supports arbitrary machine shapes that use any of [2, 4, 8, 16, 32] as CPU value, and [2, 4, 8, 16, 32, 64, 80, 96, 112, 128] as RAM value, with the constraint that RAM must always be larger or equal to CPU.
--output_to <path>
Write the cluster ID to file. If file already exists, it will get overwritten.
--wait_kube_system
If specified nsc
will wait until resources in kube-system
Kubernetes
namespace are ready.
--label key=value
Annotate the new instance with the specified values. Multiple values can be specified. They are rendered by default in the web UI, and can be used for programmatic instance filtering.
--duration
Specify how long an ephemeral environment should live for. E.g. --duration 10m
.
Experimental features
We tend to introduce new possible features under experimental
. Features here
may graduate to be fully supported, or may end up being removed.
In order to use experimental features, pass --experimental_from
pointing at a
json file where the features you want to use are specified.
Currently, the following experimental features are available:
-
disks
: specify an additional set of images to attach to the ephemeral environment. Each disk is created from a flattened container image, which you specify. And is mounted under/disk/<name>
. NOTE: the current version of this feature requires that images used be public. That means thatnscr.io
is not supported. -
containerd_shims
: specify an additional set of containerd shims to configure containerd with.
Example:
{
"disks": [
{
"name": "gvisor",
"image": "..."
}
],
"containerd_shims": [
{
"name": "runsc",
"runtime_type": "io.containerd.runsc.v1",
"add_to_path": ["/disk/gvisor"]
}
]
}