Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ndlanier opened this issue Aug 10, 2023 · 0 comments
Open

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

ndlanier opened this issue Aug 10, 2023 · 0 comments

Comments

@ndlanier
Copy link

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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant