+
Skip to content

Conversation

Atrox
Copy link

@Atrox Atrox commented Feb 23, 2025

Example:

# https://kubernetes.io/docs/reference/config-api/kubelet-config.v1beta1/
k3s_kubelet_config = <<-EOT
  apiVersion: kubelet.config.k8s.io/v1beta1
  kind: KubeletConfiguration
  imageGCLowThresholdPercent: 40
  imageGCHighThresholdPercent: 50
  imageMaximumGCAge: 24h
EOT

@mysticaltech mysticaltech requested a review from Copilot March 23, 2025 05:49
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.

Files not reviewed (8)
  • agents.tf: Language not supported
  • autoscaler-agents.tf: Language not supported
  • control_planes.tf: Language not supported
  • kube.tf.example: Language not supported
  • locals.tf: Language not supported
  • modules/host/main.tf: Language not supported
  • modules/host/variables.tf: Language not supported
  • variables.tf: Language not supported

@mysticaltech
Copy link
Collaborator

Thanks @Atrox, that's a better way of configuring it than what we have now with the command line options k3s_server_kubelet_args and k3s_agent_kubelet_args.

Copy link
Collaborator

@mysticaltech mysticaltech left a comment

Choose a reason for hiding this comment

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

Overall, this PR is close to completion but there are a couple of issues that need to be addressed:

  1. Mismatch in filenames for the kubelet config: in autoscaler-agents.tf, you write the file to /tmp/kubelet.yaml, but the update script compares /tmp/kubelet-config.yaml to /etc/rancher/k3s/kubelet-config.yaml. That mismatch means the config update script will never find the newly written file. They must match.
  2. Initial missing kubelet-config.yaml case: In the k3s_kubelet_config_update_script, there's an unconditional backup step (cp /etc/rancher/k3s/kubelet-config.yaml …). If it's the very first time and that file doesn't exist yet, cp will fail. Consider gracefully handling the "file does not exist" case or only backing up if it exists.

With those fixes, this should be good to go. Thanks for your work!

@Atrox Atrox force-pushed the feature/kubelet-config branch from 553eeb2 to 6d59b86 Compare March 24, 2025 19:05
@Atrox
Copy link
Author

Atrox commented Mar 24, 2025

Fixed the issues. Thanks for the catch regarding the autoscaler. I don't use those myself so I didn't notice that typo...

@mysticaltech
Copy link
Collaborator

@Atrox Again thanks for this. There's one thing though, maybe you are on windows and using a different kind of line ending. Because the diffs change whole blocks and files, it's hard to pin point what actually really changed. Please set your file editor to edit in unix mode, that way I can better review the PR.
Screenshot From 2025-05-18 08-23-48

@Atrox
Copy link
Author

Atrox commented May 18, 2025

@mysticaltech i don't think the issue in that specific block is line endings. I formatted the file, so that all the lines match up with the '='. The same way it currently is, just tried to follow the project style.

Should I remove the formatting?

edit: fwiw, I did the PR on unix

@mysticaltech
Copy link
Collaborator

Ah I see @Atrox . In that case, please just run terraform fmt

@Atrox
Copy link
Author

Atrox commented May 18, 2025

@mysticaltech fmt doesn't change any file for me. terraform fmt -check successfully exits on my machine.

@Atrox Atrox force-pushed the feature/kubelet-config branch from 6d59b86 to 1548db4 Compare May 18, 2025 09:06
@Atrox
Copy link
Author

Atrox commented May 18, 2025

@mysticaltech did a rebase with master + terraform fmt, alignment with = stays the same.

@mysticaltech
Copy link
Collaborator

No worries, thanks for trying, I will test it ASAP and merge!

user = "root"
private_key = var.ssh_private_key
agent_identity = local.ssh_agent_identity
host = hcloud_server.server.ipv4_address
Copy link

@sando38 sando38 Jul 24, 2025

Choose a reason for hiding this comment

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

I believe the host should be

host = coalesce(hcloud_server.server.ipv4_address, hcloud_server.server.ipv6_address, try(one(hcloud_server.server.network).ip, null))

to make sure, also private Kubernetes nodes with public IPv4 disabled can be accessed? I derived it from the resource "null_resource" "registries" part.

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

Successfully merging this pull request may close these issues.

3 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载