How to add tolerations to k0smotron workloads

Hello.

I am new to k0smotron. Using k0smotron would solve the problem of how to effectively provision Kubernetes control planes.

As I setup my test k0s cluster that should run k0smotron, I added taints to the nodes and now I can’t figure out a way to add the required tolerations to the k0smotron workloads. I have read the documentation and I have tried throwing both Copilot and Claude at the problem but no luck.

I am trying to use Cluster.spec.patches to do it. I get no errors when applying my Cluster custom resource but no tolerations are added to the stateful set that is created. Has anyone managed to successfuly add tolerations?

I would probably not have to add custom taints as the management cluster will only run k0smotron and any dependencies. Still, it would be nice to understand how it works.

Cheers,

A

Turns out i had confused the app.kubernetes.io/component with the component label at some point of my troubleshooting and retries. It works as documented.

If anyone else is looking for this, here is an example

apiVersion: k0smotron.io/v1beta2
kind: Cluster
metadata:
  name: k0smotron-test
spec:
  replicas: 1
  service:
    type: NodePort
    apiPort: 30443
    konnectivityPort: 30132
  storage:
    type: nats
  persistence:
    type: emptyDir
  patches:
      - patch:
          content: |
            - op: add
              path: /spec/template/spec/tolerations
              value:
                - operator: "Exists"
          type: json
        target:
          kind: StatefulSet
          component: cluster