Deploy Klutch locally
Local Klutch Deployment
This tutorial guides you through deploying Klutch locally using two interconnected local clusters that simulate a App and a Control Plane Cluster. It covers setting up both clusters, connecting them using Klutch, and showcases how developers can request and utilize resources in the App Cluster that are actually provisioned in the Control Plane Cluster.
Overview
In this tutorial, you'll perform the following steps in your local environment:
- Deploy a Control Plane Cluster (which will also host resources)
- Set up an App Cluster
- Bind APIs from the App Cluster to Control Plane Cluster
- Create and use remote resources from the App Cluster (in this case Postgresql service)
We'll use the open source a9s CLI to streamline this process, making it easy to follow along and understand each step.
Prerequisites
Before beginning this tutorial, ensure you have the following:
Required Tools
If you work with Kubernetes regularly, you probably have these standard tools already installed:
To follow along with this tutorial, you need to install the following specialized tools:
Network Access
Ensure your machine can reach the following external resources:
- Configuration:
https://anynines-artifacts.s3.eu-central-1.amazonaws.com/central-management/v1.3.0/crds.yaml
- Docker Image Repositories:
public.ecr.aws/w5n9a2g2/anynines/
dexidp/dex
curlimages/curl
xpkg.upbound.io/crossplane-contrib/provider-kubernetes:v0.14.1
Step 1: Run the Deployment Command
In this step, we'll set up both the Control Plane Cluster and the App Cluster for Klutch using a single command. This command will install all components needed by Klutch, including the a8s framework with the PostgreSQL operator.
This step does not automatically create bindings between the App Cluster and the resources in the Control Plane Cluster. You'll need to create these bindings using a web UI in a later step.
Run the following command to set up Klutch on two local clusters.
a9s klutch deploy --port 8080 --yes
- The
--port 8080
flag specifies the port on which the Control Plane Cluster's ingress will listen. You can change this if needed. - The
--yes
flag skips all confirmation prompts, speeding up the process.
What this command does:
- Deploys the Control Plane Cluster with all required components.
- Installs the a8s framework with the PostgreSQL Kubernetes operator.
- Creates an App Cluster with Kind.
Remove the --yes
flag if you want to review and approve each step of the process. This can be helpful for
understanding each action the CLI takes.
For a hands-off deployment, keep the --yes
flag to skip all prompts.
1.1 Control Plane Cluster Deployment
The CLI automatically:
- Checks prerequisites
- Creates a Kind cluster named "klutch-control-plane"
- Deploys core components:
- ingress-nginx
- Dex IdP (for authentication)
- Klutch backend
- Crossplane and provider-kubernetes
- Provider configuration package
- API Service Export Templates
- a8s stack as a sample data service
- Minio (for object storage)
- cert-manager
You'll see progress updates and YAML files being applied for each component.
1.2 App Cluster Deployment
After setting up the Control Plane Cluster, the CLI:
- Creates a new Kind cluster named "klutch-app"
At the moment this is an empty Kind cluster. Klutch components will be added in the next step, when the App Cluster is "bound" to the Control Plane Cluster. Stay tuned!
Deployment Output
Here's a trimmed example of what you might see during the deployment:
...
Checking Prerequisites...
✅ Found git at path /usr/bin/git.
✅ Found docker at path /opt/homebrew/bin/docker.
✅ Found kind at path /opt/homebrew/bin/kind.
...
Creating cluster "klutch-control-plane"...
• Ensuring node image (kindest/node:v1.31.0) 🖼 ...
✓ Ensuring node image (kindest/node:v1.31.0) 🖼
• Preparing nodes 📦 ...
✓ Preparing nodes 📦
...
Applying ingress-nginx manifests...
[YAML content will be displayed here]
✅ ingress-nginx appears to be ready.
Deploying Dex IdP...
[YAML content will be displayed here]
✅ Dex appears to be ready.
...
Applying the a8s Data Service manifests...
...
✅ The a8s System appears to be ready.
...
Deploying an App Cluster with Kind...
Creating cluster "klutch-app" ...
• Ensuring node image (kindest/node:v1.31.0) 🖼 ...
✓ Ensuring node image (kindest/node:v1.31.0) 🖼
• Preparing nodes 📦 ...
✓ Preparing nodes 📦
...
Summary
You've successfully accomplished the followings steps:
✅ Deployed a Klutch Control Plane Cluster with Kind.
✅ Deployed Dex Idp and the anynines klutch-bind backend.
✅ Deployed Crossplane and the Kubernetes provider.
✅ Deployed the Klutch Crossplane configuration package.
✅ Deployed Klutch API Service Export Templates to make the Klutch Crossplane APIs available to App Clusters.
✅ Deployed the a8s Stack.
✅ Deployed an App Cluster.
🎉 You are now ready to bind APIs from the App Cluster using the `a9s klutch bind` command.
Step 2: Bind Resource APIs from the App Cluster
After setting up both clusters, the next step is to bind APIs from the App Cluster to the Control Plane Cluster. We'll
bind two APIs: postgresqlinstance
and servicebinding
.
This operation also sets up an agent in the cluster to keep resources in sync between the App Cluster and the Control Plane Cluster.
Execute the following command to initiate the binding process:
a9s klutch bind
The CLI automatically:
- Checks prerequisites
- Executes the kubectl bind command
- Directs you to the web UI for authentication and API selection
- Prompts you to accept the required permissions
- Confirms binding completion
You'll see progress updates for each step.