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 limit worker resource ? #1578

Closed
0Delta opened this issue May 11, 2020 · 8 comments
Closed

How limit worker resource ? #1578

0Delta opened this issue May 11, 2020 · 8 comments
Labels
kind/support Categorizes issue or PR as a support question.

Comments

@0Delta
Copy link

0Delta commented May 11, 2020

I want limit worker resource for simulate weak node. e.g. 1vCPU/2GB

  • kind version 0.8.1
  • Windows 10 2004 build:19041.208
  • WSL2 with Ubuntu 18.04
  • Docker Desktop 2.2.0.4 (43472)
    • Engine 19.03.8
    • Kubernetes v1.15.5
    • Compose 1.25.4
    • Notary 0.6.1
    • Credential Helper 0.6.3

I tryed ...

Creating cluster "kind" ...
ERROR: failed to create cluster: unable to decode config: yaml: unmarshal errors:
  line 7: field constraints not found in type v1alpha3.Node

shell returned 1
$ kubectl describe nodes
 : 
Addresses:
  InternalIP:  172.20.0.2
  Hostname:    kind-control-plane
Capacity:
 cpu:                12                              # I want restrict this parameter
 ephemeral-storage:  263174212Ki
 hugepages-2Mi:      0
 memory:             25912152Ki           # and this one as well.
 pods:               110
Allocatable:
 cpu:                12
 ephemeral-storage:  263174212Ki
 hugepages-2Mi:      0
 memory:             21717848Ki
 pods:               110
 : 

any ideas ?

@0Delta 0Delta added the kind/support Categorizes issue or PR as a support question. label May 11, 2020
@BenTheElder
Copy link
Member

#1524
#877

If you use an older kubernetes version you'll have to use older kubeadm config types.

@teachermanalex
Copy link

@0Delta, @BenTheElder :
I found that I can use kubeadmConfigPatches and it will affect the control-plane node but not the worker node....

@teachermanalex
Copy link

Ok, figured it out. For worker nodes, you have to use JoinConfiguration:

- role: worker
  kubeadmConfigPatches:
  - |
    kind: JoinConfiguration
    nodeRegistration:
      kubeletExtraArgs:
        system-reserved: memory=8Gi

@aojea
Copy link
Contributor

aojea commented May 20, 2020

I didn't test it but you should be able to patch the kubelet configuration directly

---
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
metadata:
  name: config
systemReserved:
  cpu: 2
  memory: "8Gi"

@BenTheElder
Copy link
Member

kubelet configuration object is not respected per node in kubeadm currently, only from init :(

this is what you want #1578 (comment)

@0Delta
Copy link
Author

0Delta commented Jun 1, 2020

Sorry for late response.

finally, I success controle resource by means of @teachermanalex .

- role: worker
  kubeadmConfigPatches:
  - |
    kind: JoinConfiguration
    nodeRegistration:
      kubeletExtraArgs:
        system-reserved: memory=8Gi,cpu=8

And i found this issue. #896
that mean "resource controle function is now developing. but it not matured, so it too early to merge."
I will use kubeadmConfigPatches carefully. becase it is compromised method.

However, the control node resource is successful. my question is solved.
thanks for all.

@Al4DIN
Copy link

Al4DIN commented May 23, 2022

Hello, can we specify the ram utilisation with an argument instead of passing it in our yaml file.
For example kubectl cluster-info --context kind-kind -arg

@BenTheElder
Copy link
Member

Hello, can we specify the ram utilisation with an argument instead of passing it in our yaml file.

Most complex options are only in config, not a flag, and will remain that way.
This allows us to version the types, behavior, etc.
Kubernetes core components also work this way, it is referred to as "component config" there.

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

5 participants