You are viewing documentation for the Kairos release v3.1.3. For the latest release, click here.
Single Node k3s cluster
This section describe examples on how to deploy Kairos with k3s as a single-node cluster
In the example below we will use a bare metal host to provision a Kairos node in the local network with K3s.
Installation
Use the standard images which contain k3s.
Follow the Installation documentation, and use the following cloud config file with Kairos:
#cloud-config
hostname: metal-{{ trunc 4 .MachineID }}
users:
- name: kairos
  # Change to your pass here
  passwd: kairos
  ssh_authorized_keys:
  # Replace with your github user and un-comment the line below:
  # - github:mudler
k3s:
  enabled: true
  args:
  - --node-label "nodetype=small"
write_files:
- path: /var/lib/rancher/k3s/server/manifests/myapp.yaml
  permissions: "0644"
  content: |
    apiVersion: v1
    kind: Namespace
    metadata:
      name: myapp
    ---
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: foobar
      namespace: myapp
    data:
      foo: bar    
Notably:
- We use the k3sblock to set the node label
- In a single-node setup, you may wish to use a non-generated node name. This can be achieved with these options:k3s: enabled: true replace_args: true args: - --node-name=my-nodeNotereplace_argsreplaces all arguments otherwise passed to k3s by Kairos with those supplied here. Make sure you pass all the arguments you need.
- We use write_filesto write manifests to the defaultk3smanifest directory (/var/lib/rancher/k3s/server/manifests/) see docs to create a Namespace and ConfigMap.