Hetzner-k3s V2.3.0 - Create Error

by ADMIN 34 views

Introduction

As we continue to explore the world of container orchestration, the importance of efficient and reliable cluster creation cannot be overstated. In this article, we will delve into the issue of create errors encountered when using Hetzner K3s v2.3.0. We will examine the specific problem, provide examples of working YAML configurations, and discuss potential solutions to this issue.

The Problem

The issue at hand is related to the post_create_commands feature in Hetzner K3s v2.3.0. In previous versions, it was possible to specify individual commands for different types of pools, such as master and worker nodes. However, with the latest release, this feature seems to have been lost, causing create errors when attempting to create a cluster.

Example of Non-Working YAML Configuration

Below is an example of a YAML configuration that used to work but now results in a create error:

cat hetzner-cluster-config.yaml
hetzner_token: ***
cluster_name: rome
kubeconfig_path: "./kubeconfig"  # or /cluster/kubeconfig if you are going to use Docker
k3s_version: v1.32.4+k3s1
schedule_workloads_on_masters: true
protect_against_deletion: false

networking:
  ssh:
    public_key_path: "/Users/rmii/.ssh/rancher-staging/id_rsa.pub"
    private_key_path: "/Users/rmii/.ssh/rancher-staging/id_rsa"

masters_pool:
  instance_type: cpx21
  instance_count: 1
  locations:
    - nbg1
  image: ubuntu-24.04

worker_node_pools:
- name: generic-01
  instance_type: cpx11
  instance_count: 1
  location: nbg1
  image: ubuntu-24.04

post_create_commands:
- echo fs.inotify.max_user_watches=1048576|tee -a /etc/sysctl.conf
- echo fs.inotify.max_user_instances=1024|tee -a /etc/sysctl.conf
- echo Ciphers aes256-ctr,aes192-ctr,aes128-ctr|tee -a /etc/ssh/sshd_config
- echo MACs hmac-sha2-256,hmac-sha2-512|tee -a /etc/ssh/sshd_config
- mkdir -p -m 700 /var/lib/rancher/k3s/server/logs
- touch /var/lib/rancher/k3s/server/logs/audit.log
- touch /var/lib/rancher/k3s/server/audit.yaml
- touch /var/lib/rancher/k3s/server/downloadAudit.sh
- echo '#!/bin/bash' >> /var/lib/rancher/k3s/server/downloadAudit.sh
- echo 'curl -s -o /var/lib/rancher/k3s/server/audit.yaml https://***/k3s/main/audit.yaml' >> /var/lib/rancher/k3s/server/downloadAudit.sh
- chmod +x /var/lib/rancher/k3s/server/downloadAudit.sh
- touch /etc/systemd/system/downloadAudit.service
- echo '[Unit]' >> /etc/systemd/system/downloadAudit.service
- echo 'Description=Download audit config' >> /etc/systemd/system/downloadAudit.service
- echo '[Service]' >> /etc/systemd/system/downloadAudit.service
- echo 'ExecStart=/var/lib/rancher/k3s/server/downloadAudit.sh' >> /etc/systemd/system/downloadAudit.service
- echo '[Install]' >> /etc/systemd/system/downloadAudit.service
- echo 'WantedBy=multi-user.target' >> /etc/systemd/system/downloadAudit.service
- systemctl daemon-reload
- systemctl start downloadAudit.service
- apt update
- apt upgrade -y
- apt autoremove -y
- shutdown -r now

Example of Working YAML Configuration

Below is an example of a working YAML configuration for Hetzner K3s v2.3.0:

cat hetzner-cluster-config.yaml
hetzner_token: ***
cluster_name: rome
kubeconfig_path: "./kubeconfig"  # or /cluster/kubeconfig if you are going to use Docker
k3s_version: v1.32.4+k3s1
schedule_workloads_on_masters: true
protect_against_deletion: false

networking:
  ssh:
    public_key_path: "/Users/rmii/.ssh/rancher-staging/id_rsa.pub"
    private_key_path: "/Users/rmii/.ssh/rancher-staging/id_rsa"

masters_pool:
  instance_type: cpx21
  instance_count: 1
  locations:
    - nbg1
  image: ubuntu-24.04

worker_node_pools:
- name: generic-01
  instance_type: cpx11
  instance_count: 1
  location: nbg1
  image: ubuntu-24.04

post_create_commands:
- apt update
- apt upgrade -y   
- apt autoremove -y

Conclusion

Q: What is the issue with Hetzner K3s v2.3.0?

A: The issue is related to the post_create_commands feature in Hetzner K3s v2.3.0. In previous versions, it was possible to specify individual commands for different types of pools, such as master and worker nodes. However, with the latest release, this feature seems to have been lost, causing create errors when attempting to create a cluster.

Q: What are the symptoms of this issue?

A: The symptoms of this issue include:

  • Create errors when attempting to create a cluster
  • The post_create_commands feature is not working as expected
  • The cluster creation process is failing due to the lack of support for individual commands for different types of pools

Q: What are the possible causes of this issue?

A: The possible causes of this issue include:

  • A bug in the Hetzner K3s v2.3.0 code
  • A misconfiguration of the YAML file
  • A compatibility issue with the Hetzner API

Q: How can I resolve this issue?

A: To resolve this issue, you can try the following:

  • Check the Hetzner K3s v2.3.0 documentation for any updates or changes to the post_create_commands feature
  • Verify that your YAML file is correctly configured and that the post_create_commands feature is enabled
  • Try using a different version of Hetzner K3s or a different cluster creation tool

Q: What are the implications of this issue?

A: The implications of this issue include:

  • Delays in cluster creation and deployment
  • Inability to use the post_create_commands feature
  • Potential security risks due to the lack of support for individual commands for different types of pools

Q: How can I prevent this issue in the future?

A: To prevent this issue in the future, you can:

  • Regularly check the Hetzner K3s documentation for any updates or changes
  • Verify that your YAML file is correctly configured and that the post_create_commands feature is enabled
  • Use a different version of Hetzner K3s or a different cluster creation tool

Q: What is the current status of this issue?

A: The current status of this issue is that it is being investigated by the Hetzner team. We will provide updates as more information becomes available.

Q: How can I get help with this issue?

A: If you are experiencing issues with Hetzner K3s v2.3.0, you can try the following:

  • Check the Hetzner K3s documentation and community forums for any relevant information
  • Reach out to the Hetzner support team for assistance
  • Contact a Hetzner certified partner or consultant for help

Q: What are the next steps for resolving this issue?

A: The next steps for resolving this issue include:

  • Continuing to investigate the cause of the issue
  • Providing updates to the Hetzner community on the status of the issue
  • Working with the Hetzner team to resolve the issue and provide a fix