Install on kind

Learn how to install Drasi on a kind cluster for local development and testing

kind is a tool for running Kubernetes clusters on your local computer. Aimed primarily at developers, kind is an easy to use option for doing local development and testing of Drasi, Drasi extensions, and Drasi-based solutions. This guide describes how to install Drasi on kind.

Prerequisites

This guide assumes you are familiar with Kubernetes and know how to use kubectl to manage a Kubernetes cluster.

On the computer where you will install kind, you need to install the following software:

Install kind

The kind installation instructions describe multiple ways to install kind on macOS, Windows, and Linux. The options include downloading binaries, using a package manager, and building from source. Review the available installation options and use one to install kind on your computer before continuing.

Create a kind Cluster

To create a kind cluster, open a terminal or command prompt and run the following command:

kind create cluster

During the cluster creation, you will see output similar to this:

Creating cluster "kind" ...
 ✓ Ensuring node image (kindest/node:v1.30.0) đŸ–ŧ
 ✓ Preparing nodes đŸ“Ļ
 ✓ Writing configuration 📜
 ✓ Starting control-plane 🕹ī¸
 ✓ Installing CNI 🔌
 ✓ Installing StorageClass 💾
Set kubectl context to "kind-kind"
You can now use your cluster with:

kubectl cluster-info --context kind-kind

This will create a kind cluster named kind-kind and set the current kubectl context to the new cluster. Now you can manage the kind cluster using familiar Kubernetes management tools such as kubectl and the Kubernetes extension for Visual Studio Code.

Get the Drasi CLI

You will install Drasi on the kind cluster using the Drasi CLI.

You can get the Drasi CLI for your platform using one of the following options:

curl -fsSL https://raw.githubusercontent.com/drasi-project/drasi-platform/main/cli/installers/install-drasi-cli.sh | /bin/bash
iwr -useb "https://raw.githubusercontent.com/drasi-project/drasi-platform/main/cli/installers/install-drasi-cli.ps1" | iex
wget -q "https://raw.githubusercontent.com/drasi-project/drasi-platform/main/cli/installers/install-drasi-cli.sh" -O - | /bin/bash

Download a specific version of the CLI from the drasi-platform releases page on GitHub. The file to download for your platform is:

  • macOS arm64 - drasi-darwin-arm64
  • macOS x64 - drasi-darwin-x64
  • Windows x64 - drasi-windows-x64.exe
  • Linux x64 - drasi-linux-x64
  • Linux arm64 - drasi-linux-arm64

Once downloaded, rename the file to drasi (macOS and Linux) or drasi.exe (Windows) and add it to your path.

The Drasi CLI source code is in the drasi-platform repo in the cli folder.

The readme.md file in the cli folder describes how to build and install the Drasi CLI on your computer.

This guide focuses on how to install Drasi on a kind cluster and covers only a few features of the Drasi CLI. Refer to the Drasi CLI Command Reference for a complete description of the functionality it provides.

Install Drasi on the kind Cluster

To install Drasi on the kind cluster using all default settings, simply run the command:

drasi init

This will install the version of Drasi that matches the version of the Drasi CLI that you are using and will create the Drasi environment in the drasi-system namespace, which will be created if it doesn’t exist. The Drasi container images will be pulled from the main Drasi container registry located on ghcr.io.

The drasi init command gives you to control over certain aspects of the install process and the configuration of the Drasi environment through these flags and argument:

  • --dapr-runtime-version <version>: Specifies the Dapr runtime version to install. The default value is “1.10.0”.
  • --dapr-sidecar-version <version>: Specifies the Dapr sidecar (daprd) version to install. The default value is “1.9.0”.
  • --local: If set, the Drasi CLI will use locally available images to install Drasi instead of pulling them from a remote container registry.
  • -n|--namespace <namespace>: Specifies the Kubernetes namespace to install Drasi into. This namespace will be created if it does not exist. The default value is “drasi-system”.
  • --registry <registry>: Address of the container registry to pull Drasi images from. The default value is “ghcr.io”.
  • --version <tag>: Container image version tag to use when pulling Drasi images. The default value is the version tag of the Drasi CLI, which is available through the drasi version command.

For example, to install Drasi 0.1.3 in the drasi-dev namespace, you would run the following command:

drasi init --version 0.1.3 -n drasi-dev

The following shows the output you would expect from a successful installation of Drasi 0.1.3:

Installing Drasi with version 0.1.3 from registry ghcr.io
ℹ Dapr not installed
✓ Dapr installed successfully
✓ Infrastructure deployed
  ✓ app=rg-redis is online
  ✓ app=rg-mongo is online
✓ Control plane is online
  ✓ drasi/infra=api is online
  ✓ drasi/infra=resource-provider is online
✓ Query container created
  ✓ Apply: QueryContainer/default: complete
  ✓ Wait QueryContainer/default online
✓ Default source providers created
  ✓ Apply: SourceProvider/PostgreSQL: complete
  ✓ Apply: SourceProvider/SQLServer: complete
  ✓ Apply: SourceProvider/CosmosGremlin: complete
✓ Default reaction providers created
  ✓ Apply: ReactionProvider/Debug: complete
  ✓ Apply: ReactionProvider/Debezium: complete
  ✓ Apply: ReactionProvider/EventGrid: complete
  ✓ Apply: ReactionProvider/Gremlin: complete
  ✓ Apply: ReactionProvider/Result: complete
  ✓ Apply: ReactionProvider/SignalR: complete
  ✓ Apply: ReactionProvider/StorageQueue: complete
  ✓ Apply: ReactionProvider/StoredProc: complete

Note that the Drasi installation also installs a number of dependencies, including:

If drasi init completes without error, the Drasi environment is ready for use and you can start to create Sources, Continuous Queries, and Reactions.

Troubleshooting Installation Problems

If any of installation steps fail, a check mark will appear next to the failed step and the installation process will abort. For example:

ℹ Dapr not installed
✓ Dapr installed successfully
✓ Infrastructure deployed
  ✗ Timed out waiting for app=drasi-redis
  ✗ Timed out waiting for app=drasi-mongo
✓ Control plane is online
  ✗ Timed out waiting for drasi/infra=api
  ✗ Timed out waiting for drasi/infra=resource-provider
●∙∙ Creating query container...
Error: drasi API not available

Sometimes, drasi init can fail due to transient errors, usually due to failed network connections or timeouts experienced while downloading and installing dependencies. In these situations you can simply rerun the same drasi init command and the Drasi CLI will attempt to complete the remaining incomplete steps.

To verify Dapr was installed successfully, you can check what Dapr pods are running using the command:

kubectl get pods -n dapr-system

Which should show output similar to this:

NAME                                     READY   STATUS    RESTARTS        AGE
dapr-dashboard-5cc65d985f-qzqbg          1/1     Running   0               10m
dapr-operator-5d98f57c86-kspwk           1/1     Running   0               10m
dapr-placement-server-0                  1/1     Running   0               10m
dapr-sentry-697bdc6cc4-xprww             1/1     Running   0               10m
dapr-sidecar-injector-56c4c4b485-n48bg   1/1     Running   0               10m

Deleting Drasi

To delete a Drasi environment that is installed in the default drasi-system namespace, run the command:

drasi uninstall

To delete a Drasi environment from a specific namespace, include the -n flag:

drasi uninstall -n drasi-dev

In either case, the Drasi CLI will delete the namespace containing the Drasi environment. Everything in that namespace will be deleted and cannot be recovered.

Deleting the kind cluster

To delete the kind cluster and everything it contains, including the Drasi environment, run this command:

kind delete cluster

You will see the following output:

Deleting cluster "kind" ...
Deleted nodes: ["kind-control-plane"]