Create a cluster#
After you install k0smotron as described in the Installation section, you can start creating your Kubernetes control planes.
To create a cluster:
-
Create the
Cluster
object:cat <<EOF | kubectl create -f- apiVersion: k0smotron.io/v1beta1 kind: Cluster metadata: name: <cluster-name> spec: null EOF
This triggers the k0smotron controller manager to set up the control plane in pods.
Use an external cluster to set up control plane in pods
By default, control planes are deployed in the management cluster. If you choose to deploy them in an external cluster via
kubeconfigRef
, the identity in that kubeconfig must have sufficient RBAC permissions for k0smotron to create and manage control plane resources. You can review the roles used by k0smotron here. -
Once k0smotron finishes setting up the cluster, obtain the admin access kubeconfig:
kubectl get secret <cluster-name>-kubeconfig -o jsonpath='{.data.value}' | base64 -d > ~/.kube/child.conf
Depending on your configuration, the admin kubeconfig may not be pointing to the correct address. If the kubeconfig does not work by default, set the correct value for
<server-URL>
:apiVersion: v1 clusters: - cluster: server: <server-URL> certificate-authority-data: <redacted> name: k0s contexts: - context: cluster: k0s user: admin name: k0s current-context: k0s kind: Config preferences: {} users: - name: admin user: client-certificate-data: <redacted> client-key-data: <redacted>
Once your control plane is ready, you can start joining worker nodes into the newly created control plane.