Skip to content

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:

  1. Create the Cluster object:

    cat <<EOF | kubectl create -f-
       kind: Cluster
         name: <cluster-name>
       spec: null

    This triggers the k0smotron controller manager to set up the control plane in pods.

  2. 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
    - cluster:
        server: <server-URL>
        certificate-authority-data: <redacted>
      name: k0s
    - context:
        cluster: k0s
        user: admin
      name: k0s
    current-context: k0s
    kind: Config
    preferences: {}
    - name: admin
        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.