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

feat: Added option to customize kubelet arguments #196

Merged
merged 3 commits into from
Feb 26, 2024

Conversation

lukapetrovic-git
Copy link
Contributor

@lukapetrovic-git lukapetrovic-git commented Feb 22, 2024

Description

Added option to customize kubelet arguments (https://docs.rke2.io/reference/server_config#agentflags).

I used the variable rke2_server_options somewhat successfully too, but it becomes very messy very fast since it requires specifying all kubelet arguments on a single line like so:

rke2_server_options:
  - "kubelet-arg: ['--system-reserved=cpu=100m,memory=100Mi,pid=100000','--kube-reserved=cpu=80m,memory=1400Mi,pid=100000','--eviction-hard=memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<15%','--enforce-node-allocatable=pods', '--pod-max-pids=32768']"

I would constantly break it trying to add new/adjust existing arguments so i created a new variable so that arguments can be passed like below:

rke_kubelet_arg:
  - "--system-reserved=cpu=100m,memory=100Mi,pid=100000"
  - "--kube-reserved=cpu=80m,memory=1400Mi,pid=100000"
  - "--eviction-hard=memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<15%"
  - "--enforce-node-allocatable=pods"
  - "--pod-max-pids=32768"

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Small minor change not affecting the Ansible Role code (Github Actions Workflow, Documentation, etc.)

How Has This Been Tested?

I have been successfully using this variable on all my environments both dev/test and production in the last month or so.

@lukapetrovic-git lukapetrovic-git changed the title Added option to customize kubelet arguments [feat]: Added option to customize kubelet arguments Feb 22, 2024
@lukapetrovic-git lukapetrovic-git changed the title [feat]: Added option to customize kubelet arguments feat: Added option to customize kubelet arguments Feb 22, 2024
@MonolithProjects MonolithProjects added the enhancement New feature or request label Feb 22, 2024
Copy link
Collaborator

@MonolithProjects MonolithProjects left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks

@lukapetrovic-git
Copy link
Contributor Author

@MonolithProjects I just noticed i named the variable rke_kubelet_arg instead of rke2_kubelet_arg and pushed another commit just to stay consistent across all vars.

Copy link
Collaborator

@MonolithProjects MonolithProjects left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MonolithProjects
Copy link
Collaborator

@MonolithProjects I just noticed i named the variable rke_kubelet_arg instead of rke2_kubelet_arg and pushed another commit just to stay consistent across all vars.

Thanks. I didn't notice that too.

@MonolithProjects MonolithProjects merged commit ac9315d into lablabs:main Feb 26, 2024
5 checks passed
@albundy83
Copy link

Hello,
just to harmonize things, won't it be possible to use the same format than kube_controller_manager and kube_scheduler_arg:

# rke2_kube_controller_manager_arg:
#   - "bind-address=0.0.0.0"

# rke2_kube_scheduler_arg:
#   - "bind-address=0.0.0.0"

Like this (I have removed -- from parameter)

# (Optional) Customize default kubelet arguments
# rke2_kubelet_arg:
#   - "system-reserved=cpu=100m,memory=100Mi"

instead of:

# (Optional) Customize default kubelet arguments
# rke2_kubelet_arg:
#   - "--system-reserved=cpu=100m,memory=100Mi"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants