Skip to content

shopstic/jetski

Repository files navigation

Jetski - the nimble local Kubernetes development environment

jetski is a CLI tool built on top of multipass and k3s to create an ideal local Kubernetes development experience.

It embraces Infrastructure as Code practice and allows you to manage multiple local Kubernetes instances via their own type-safe config files. On top of that, it manages local routes and DNS rules such that you can access Kubernetes Services and/or Pods directly via their respective DNS names, Service IPs or ClusterIPs from all your local tools. It's "magical", and once you have tried it, there's no going back.

jetski has first-class support for all common Operating Systems, including macOS (both Intel and Apple Silicon architectures), Windows via WSL 2 and Linux (both amd64 and arm64).

License

Apache 2.0 License

Getting started

First, install multipass on your local development computer.

Then obtain jetski in your Nix shell. You can simply add it as a Nix flake input to your existing flake.nix. For example:

{
  # ...

  inputs = {
    # ...
    jetski.url = "github:shopstic/jetski";
  };

  outputs = { self, nixpkgs, flakeUtils, /* ... ,*/ jetski }:
    flakeUtils.lib.eachDefaultSystem
      (system:
        let
          jetskiBin = jetski.defaultPackage.${system};
        in
        {
          devShell = pkgs.mkShellNoCC rec {
            buildInputs = [
              jetskiBin
            ];
          };
        }
      );
}

Usage

Create a config file that describe a local Kubernetes instance, for example:

import type { InstanceConfig } from "https://deno.land/x/[email protected]/types.ts";

const config: InstanceConfig = {
  name: "local",
  image: "focal",
  cpus: 1,
  memoryGiBs: 1,
  diskGiBs: 4,
  k3sVersion: "v1.21.9+k3s1",
  clusterCidr: "10.254.254.0/24",
  serviceCidr: "10.254.255.0/24",
  clusterDnsIp: "10.254.255.10",
  clusterDomain: "jetski.local",
  nodeLabels: {
    "com.jetski/foo": "bar",
    "com.jetski/baz": "boo",
  },
  sshDirectoryPath: "./local/.ssh",
};

export default config;

Then simply launch it via a single command:

jetski --config /path/to/instance-config.ts create

To see the complete list of all supported commands, run jetski with no arguments. The currently supported commands are:

  • version: Output the current jetski version in JSON
  • ssh: SSH into an instance's VM
  • create: Create a new instance
  • stop: Shutdown an instance's VM
  • destroy: Destroy an instance
  • start: Start a previously stopped instance
  • reset: A convenient command to destroy then create the instance again