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

How to set Node Allocatable memory in kind? #1524

Closed
arianvp opened this issue Apr 28, 2020 · 10 comments
Closed

How to set Node Allocatable memory in kind? #1524

arianvp opened this issue Apr 28, 2020 · 10 comments
Assignees
Labels
kind/support Categorizes issue or PR as a support question.

Comments

@arianvp
Copy link

arianvp commented Apr 28, 2020

When I create a KIND cluster; it sets the Node Allocatable memory to the max memory that my laptop has. However I want to limit it to something lower because I'm usually running other things on my laptop as well (like a browser)

Usually one would do this through specifying kubelet flags as I read here: https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/

I tried looking in the docs but found nothing about how to override kubelet flags so this is probably not the right way.

Reason is i'm trying to debug some deployment locally; but because kind thinks there is more RAM than it actually has it over-allocates and my computer runs out of memory and locks up before I can debug. I want to turn that over-allocation into a scheduling error; by giving kind less memory to work with.

@arianvp arianvp added the kind/support Categorizes issue or PR as a support question. label Apr 28, 2020
@arianvp
Copy link
Author

arianvp commented Apr 28, 2020

I think this and #877 are the same question. Feel free to close if you agree

@BenTheElder
Copy link
Member

#877 is looking to actually change the node size I think, overridding kubelet flags can be done with a kubeadmConfigPatch which needs more documentation... it's on our radar.

@BenTheElder
Copy link
Member

supporting this first class might be a better answer than #877's current WIP approach

@aojea
Copy link
Contributor

aojea commented May 1, 2020

supporting this first class might be a better answer than #877's current WIP approach

yeah, definitely that's the missing part in that PR, is just not isolating the nodes, is "converting" them in VMs and for that we need kubelet to only "see" the allocated resources ... hehe, I didn't get that before 😅

Let me play with this https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/#example-scenario and see how it goes

/assign

@arianvp
Copy link
Author

arianvp commented May 4, 2020

How would this look with kubeadmConfigPatch?

@arianvp
Copy link
Author

arianvp commented May 4, 2020

Answering my own question:

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  kubeadmConfigPatches:
  - |
    kind: InitConfiguration
    nodeRegistration:
      kubeletExtraArgs:
        system-reserved: memory=4Gi

@teachermanalex
Copy link

Thanks @arianvp . I did this, and copied the block to my worker node as well. It reduced the allocatable memory for the control-plane node, but not the worker node.
Any ideas?

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  kubeadmConfigPatches:
  - |
    kind: InitConfiguration
    nodeRegistration:
      kubeletExtraArgs:
        system-reserved: memory=8Gi
- role: worker
  kubeadmConfigPatches:
  - |
    kind: InitConfiguration
    nodeRegistration:
      kubeletExtraArgs:
        system-reserved: memory=8Gi

@teachermanalex
Copy link

Figured it out. For worker nodes you need JoinConfiguration (not InitConfiguration).
See comment here

@chevalsumo
Copy link

Correct me if I'm wrong, this approach limits the resources that can be used for the system (OS system daemon) of the container and not the resources that can be allocated by the pods ?

@heumsi
Copy link

heumsi commented May 11, 2023

Correct me if I'm wrong, this approach limits the resources that can be used for the system (OS system daemon) of the container and not the resources that can be allocated by the pods ?

@chevalsumo

You are correct in your understanding.

The documentation below should help clarify your understanding of arguments.

https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/#node-allocatable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support Categorizes issue or PR as a support question.
Projects
None yet
Development

No branches or pull requests

6 participants