Connecting your Kubernetes cluster to Cosmonic is a simple one-line command. This will install the cosmo-controller on your Kubernetes cluster and allow you to manage wasmCloud hosts connected to Cosmonic using a single CRD. Kubernetes cluster configurations can be highly customized so for this tutorial we'll be using kind to simplify the process of creating and connecting a local Kubernetes cluster.
Starting a local cluster
If you already have a cluster running, you can skip ahead to the Connecting to Cosmonic section.
Start up a cluster using
kind create cluster
Once it completes, you should be able to see you have one node available locally:
kubectl get nodes
NAME STATUS ROLES AGE VERSION kind-control-plane Ready control-plane 8m58s v1.26.3
Connecting to Cosmonic
Connecting your cluster is a simple one-line command:
cosmo connect k8s
Successfully connected to constellation [<id>] ✅ Successfully connected to k8s cluster ✅ Successfully configured controller ✅ Successfully started wasmcloud hosts ✅ Wadm manifest deployed. You can check deployment status at https://app.cosmonic.com/constellation/applications/cosmo-connect-127-0-0-1-default?view=manifest 🔗 Kubernetes cluster successfully connected! 🚀 Open Cosmonic (https://app.cosmonic.com/constellation/infrastructure) to interact with your Kubernetes hosts.
This command deploys the Cosmonic controller and two pods to your cluster in the default namespace. These pods contain 2 containers, similar to the setup with
cosmo connect local, one is a NATS leaf to extend your Cosmonic network and the other is a wasmCloud runtime for running your WebAssembly components. Now that your cluster is fully connected, you can use Wadm and the Cosmonic UI to deploy WebAssembly to your Kubernetes cluster.