Skip to content

Set CPU limits for pods for kairos image build pods #87

Open
@ndlanier

Description

@ndlanier

Is there anything in the cloud-config secret or the OSArtifact that can be set to limit the pods that spin up when building an image? The pods that spin up are not getting any memory or cpu limits applied and taking every resource they can from the host node.

I tried to set a cpu limit from what I could find in the CRD but the schema wasn't working and I couldn't create the OSArtifact.

Output of the kairos image pod taking up as much cpu as it wanted:

~$ k top pods
NAME                               CPU(cores)   MEMORY(bytes)
hello-kairos-d8r4d                 7493m        1065Mi
kairos-osbuilder-c96f9bb66-ngplp   2m           22Mi
osbuilder-nginx-744d46c789-bc9nt   0m           8Mi

My yaml manifest for the cloud config and the os artifact

kind: Secret
apiVersion: v1
metadata:
  name: cloud-config
stringData:
  userdata: |
    #cloud-config
    users:
    - name: "kairos"
      passwd: "kairos"
    name: "Default deployment"
    stages:
      boot:
      - name: "Repart image"
        layout:
          device:
            label: COS_RECOVERY
          add_partitions:
            - fsLabel: COS_STATE
              size: 16240 # At least 16gb
              pLabel: state
      - name: "Repart image"
        layout:
          device:
            label: COS_RECOVERY
          add_partitions:
            - fsLabel: COS_PERSISTENT
              pLabel: persistent
              size: 0 # all space
      - if: '[ -f "/run/cos/recovery_mode" ] && [ ! -e /usr/local/.deployed ]'
        name: "Deploy kairos"
        commands:
          - kairos-agent --debug reset --unattended
          - touch /usr/local/.deployed
          - reboot    
---
apiVersion: build.kairos.io/v1alpha2
kind: OSArtifact
metadata:
  name: hello-kairos
spec:
  imageName: REDACTED
  cloudImage: true
  cloudConfigRef:
    name: cloud-config
    key: userdata
  # versions:
  #   0:
  #     schema:
  #       openAPIV3Schema:
  #         properties:
  #           spec:
  #             properties:
  #               exporters:
  #                 items:
  #                   properties:
  #                     template:
  #                       properties:
  #                         spec:
  #                           properties:
  #                             containers:
  #                               items:
  #                                 properties:
  #                                   env:
  #                                     items:
  #                                       properties:
  #                                         valueFrom:
  #                                           properties:
  #                                             resourceFieldRef:
  #                                               limits:
  #                                                 cpu: "750m"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions