hetzner-k3s icon indicating copy to clipboard operation
hetzner-k3s copied to clipboard

undefined method `[]' for nil:NilClass (NoMethodError)

Open diego95root opened this issue 1 year ago • 1 comments

Hi, I was giving your project a try and I can't seem to be able to create the servers. I would appreciate it if you took a look, perhaps I'm missing something? I'm using Linux and the YAML is as follows:

---
hetzner_token: AXsUAaPBmMDnkBrYnhKvaC6mYJWi5isv15IpzOoLMgnpji95vEnfunYUMiOHz03O
cluster_name: "kubito"
kubeconfig_path: "./kubeconfig"
k3s_version: v1.21.3+k3s1
public_ssh_key_path: "/home/diego/.ssh/id_rsa_test.pub"
private_ssh_key_path: "/home/diego/.ssh/id_rsa_test"
ssh_allowed_networks:
  - 0.0.0.0/0
api_allowed_networks:
  - 0.0.0.0/0
verify_host_key: false
location: nbg1
schedule_workloads_on_masters: false
masters:
  instance_type: cpx21
  instance_count: 3
  # labels:
  #   purpose: master
  #   size: cpx21
  # taints:
  #   something: value1:NoSchedule
worker_node_pools:
- name: small
  instance_type: cpx21
  instance_count: 1
  # labels:
  #   purpose: worker
  #   size: cpx21
  # taints:
  #   something: GpuWorkloadsOnly:NoSchedule
post_create_commands:
- apt update
- apt upgrade -y
- apt autoremove -y
- shutdown -r now
enable_encryption: true
# kube_api_server_args:
# - arg1
# - ...
# kube_scheduler_args:
# - arg1
# - ...
# kube_controller_manager_args:
# - arg1
# - ...
# kube_cloud_controller_manager_args:
# - arg1
# - ...
# kubelet_args:
# - arg1
# - ...
# kube_proxy_args:
# - arg1
# - ...

Error:

$hetzner-k3s create-cluster --config-file=config.yaml

Placement group kubito already exists, skipping.


Firewall already exists, skipping.


Private network already exists, skipping.


SSH key already exists, skipping.


Placement group kubito-small already exists, skipping.





Creating server kubito-cpx21-master1...
Creating server kubito-cpx21-pool-small-worker1...
Creating server kubito-cpx21-master3...
Creating server kubito-cpx21-master2...
Error creating server kubito-cpx21-master1. Response details below:

Error creating server kubito-cpx21-pool-small-worker1. Response details below:

Error creating server kubito-cpx21-master2. Response details below:

Error creating server kubito-cpx21-master3. Response details below:

#<Thread:0x00007fa0a004c9a8 /__enclose_io_memfs__/local/lib/hetzner/k3s/cluster.rb:272 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
	7: from /__enclose_io_memfs__/local/lib/hetzner/k3s/cluster.rb:272:in `block (2 levels) in wait_for_servers'
	6: from /__enclose_io_memfs__/local/lib/hetzner/utils.rb:54:in `wait_for_ssh'
	5: from /__enclose_io_memfs__/lib/ruby/2.7.0/timeout.rb:110:in `timeout'
	4: from /__enclose_io_memfs__/lib/ruby/2.7.0/timeout.rb:33:in `catch'
	3: from /__enclose_io_memfs__/lib/ruby/2.7.0/timeout.rb:33:in `catch'
	2: from /__enclose_io_memfs__/lib/ruby/2.7.0/timeout.rb:33:in `block in catch'
	1: from /__enclose_io_memfs__/lib/ruby/2.7.0/timeout.rb:95:in `block in timeout'
/__enclose_io_memfs__/local/lib/hetzner/utils.rb:55:in `block in wait_for_ssh': undefined method `[]' for nil:NilClass (NoMethodError)
#<Thread:0x00007fa0a004c890 /__enclose_io_memfs__/local/lib/hetzner/k3s/cluster.rb:272 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
	7: from /__enclose_io_memfs__/local/lib/hetzner/k3s/cluster.rb:272:in `block (2 levels) in wait_for_servers'
	6: from /__enclose_io_memfs__/local/lib/hetzner/utils.rb:54:in `wait_for_ssh'
	5: from /__enclose_io_memfs__/lib/ruby/2.7.0/timeout.rb:110:in `timeout'
	4: from /__enclose_io_memfs__/lib/ruby/2.7.0/timeout.rb:33:in `catch'
	3: from /__enclose_io_memfs__/lib/ruby/2.7.0/timeout.rb:33:in `catch'
	2: from /__enclose_io_memfs__/lib/ruby/2.7.0/timeout.rb:33:in `block in catch'
	1: from /__enclose_io_memfs__/lib/ruby/2.7.0/timeout.rb:95:in `block in timeout'
/__enclose_io_memfs__/local/lib/hetzner/utils.rb:55:in `block in wait_for_ssh': undefined method `[]' for nil:NilClass (NoMethodError)
#<Thread:0x00007fa0a004c6b0 /__enclose_io_memfs__/local/lib/hetzner/k3s/cluster.rb:272 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
	7: from /__enclose_io_memfs__/local/lib/hetzner/k3s/cluster.rb:272:in `block (2 levels) in wait_for_servers'
	6: from /__enclose_io_memfs__/local/lib/hetzner/utils.rb:54:in `wait_for_ssh'
	5: from /__enclose_io_memfs__/lib/ruby/2.7.0/timeout.rb:110:in `timeout'
	4: from /__enclose_io_memfs__/lib/ruby/2.7.0/timeout.rb:33:in `catch'
	3: from /__enclose_io_memfs__/lib/ruby/2.7.0/timeout.rb:33:in `catch'
	2: from /__enclose_io_memfs__/lib/ruby/2.7.0/timeout.rb:33:in `block in catch'
	1: from /__enclose_io_memfs__/lib/ruby/2.7.0/timeout.rb:95:in `block in timeout'
/__enclose_io_memfs__/local/lib/hetzner/utils.rb:55:in `block in wait_for_ssh': undefined method `[]' for nil:NilClass (NoMethodError)
#<Thread:0x00007fa0a004c7a0 /__enclose_io_memfs__/local/lib/hetzner/k3s/cluster.rb:272 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
	7: from /__enclose_io_memfs__/local/lib/hetzner/k3s/cluster.rb:272:in `block (2 levels) in wait_for_servers'
	6: from /__enclose_io_memfs__/local/lib/hetzner/utils.rb:54:in `wait_for_ssh'
	5: from /__enclose_io_memfs__/lib/ruby/2.7.0/timeout.rb:110:in `timeout'
	4: from /__enclose_io_memfs__/lib/ruby/2.7.0/timeout.rb:33:in `catch'
	3: from /__enclose_io_memfs__/lib/ruby/2.7.0/timeout.rb:33:in `catch'
	2: from /__enclose_io_memfs__/lib/ruby/2.7.0/timeout.rb:33:in `block in catch'
	1: from /__enclose_io_memfs__/lib/ruby/2.7.0/timeout.rb:95:in `block in timeout'
/__enclose_io_memfs__/local/lib/hetzner/utils.rb:55:in `block in wait_for_ssh': undefined method `[]' for nil:NilClass (NoMethodError)
Traceback (most recent call last):
	7: from /__enclose_io_memfs__/local/lib/hetzner/k3s/cluster.rb:272:in `block (2 levels) in wait_for_servers'
	6: from /__enclose_io_memfs__/local/lib/hetzner/utils.rb:54:in `wait_for_ssh'
	5: from /__enclose_io_memfs__/lib/ruby/2.7.0/timeout.rb:110:in `timeout'
	4: from /__enclose_io_memfs__/lib/ruby/2.7.0/timeout.rb:33:in `catch'
	3: from /__enclose_io_memfs__/lib/ruby/2.7.0/timeout.rb:33:in `catch'
	2: from /__enclose_io_memfs__/lib/ruby/2.7.0/timeout.rb:33:in `block in catch'
	1: from /__enclose_io_memfs__/lib/ruby/2.7.0/timeout.rb:95:in `block in timeout'
/__enclose_io_memfs__/local/lib/hetzner/utils.rb:55:in `block in wait_for_ssh': undefined method `[]' for nil:NilClass (NoMethodError)

I also tried to use Docker but kept getting problems with Ruby dependencies:

$docker run --rm -it   -v ${PWD}:/cluster   -v ${HOME}/.ssh:/tmp/.ssh   vitobotta/hetzner-k3s:v0.6.4   create-cluster   --config-file /cluster/config.yaml bin/setup.sh
chmod: /root/.ssh/config: No such file or directory
Could not find rake-12.3.3 in any of the sources
Run `bundle install` to install missing gems.

Thanks!

diego95root avatar Sep 07 '22 18:09 diego95root

Hi, unfortunately there are some issues with the latest versions introduced with changes I made to be able to offer standalone binaries. I recommend you use v0.5.9 for the time being as I am busy rewriting the tool in Crystal. Rewriting in Crystal makes it easier to produce standalone binaries that will make using the tool easier, since you won't need to set up a Ruby environment or use the Docker image anymore. But this is still a work in progress, so for now please use v0.5.9. Thanks

vitobotta avatar Sep 08 '22 18:09 vitobotta