k0sproject / k0sproject/k0sctl

Networking error "failed to connect from worker to kubernetes api at xxx:6443" despite firewall port open

Open
#758 2 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Go
Stars
582
Forks
113
Avg merge
2d 13h
Merged PRs (30d)
34

Description

I'd start giving a bit of context, I'm a noob and I'm trying to setup k0s through terraform/opentofu
and I get an error due to networking despite the firewall seems fine (to me at least)

I could use some help

error message

```console
⠀⣿⣿⡇⠀⠀⢀⣴⣾⣿⠟⠁⢸⣿⣿⣿⣿⣿⣿⣿⡿⠛⠁⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀█████████ █████████ ███
⠀⣿⣿⡇⣠⣶⣿⡿⠋⠀⠀⠀⢸⣿⡇⠀⠀⠀⣠⠀⠀⢀⣠⡆⢸⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀███ ███ ███
⠀⣿⣿⣿⣿⣟⠋⠀⠀⠀⠀⠀⢸⣿⡇⠀⢰⣾⣿⠀⠀⣿⣿⡇⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀███ ███ ███
⠀⣿⣿⡏⠻⣿⣷⣤⡀⠀⠀⠀⠸⠛⠁⠀⠸⠋⠁⠀⠀⣿⣿⡇⠈⠉⠉⠉⠉⠉⠉⠉⠉⢹⣿⣿⠀███ ███ ███
⠀⣿⣿⡇⠀⠀⠙⢿⣿⣦⣀⠀⠀⠀⣠⣶⣶⣶⣶⣶⣶⣿⣿⡇⢰⣶⣶⣶⣶⣶⣶⣶⣶⣾⣿⣿⠀█████████ ███ ██████████
k0sctl v0.18.1 Copyright 2023, k0sctl authors.
Anonymized telemetry of usage will be sent to the authors.
By continuing to use k0sctl you agree to these terms:
https://k0sproject.io/licenses/eula
level=info msg="==> Running phase: Set k0s version"
level=info msg="Looking up latest stable k0s version"
level=info msg="Using k0s version v1.30.4+k0s.0"
level=info msg="==> Running phase: Connect to hosts"
level=info msg="[ssh] 206.81.20.20:22: connected"
level=info msg="[ssh] 206.81.31.231:22: connected"
level=info msg="[ssh] 161.35.218.68:22: connected"
level=info msg="==> Running phase: Detect host operating systems"
level=info msg="[ssh] 206.81.20.20:22: is running Ubuntu 24.04 LTS"
level=info msg="[ssh] 206.81.31.231:22: is running Ubuntu 24.04 LTS"
level=info msg="[ssh] 161.35.218.68:22: is running Ubuntu 24.04 LTS"
level=info msg="==> Running phase: Acquire exclusive host lock"
level=info msg="==> Running phase: Prepare hosts"
level=info msg="==> Running phase: Gather host facts"
level=info msg="[ssh] 206.81.20.20:22: using worker-node-1 as hostname"
level=info msg="[ssh] 161.35.218.68:22: using worker-node-0 as hostname"
level=info msg="[ssh] 206.81.31.231:22: using controller-node-0 as hostname"
level=info msg="[ssh] 206.81.20.20:22: discovered eth0 as private interface"
level=info msg="[ssh] 161.35.218.68:22: discovered eth0 as private interface"
level=info msg="[ssh] 206.81.31.231:22: discovered eth0 as private interface"
level=info msg="[ssh] 161.35.218.68:22: discovered 10.19.0.5 as private address"
level=info msg="[ssh] 206.81.20.20:22: discovered 10.19.0.7 as private address"
level=info msg="[ssh] 206.81.31.231:22: discovered 10.19.0.6 as private address"
level=info msg="==> Running phase: Validate hosts"
level=info msg="==> Running phase: Gather k0s facts"
level=info msg="[ssh] 206.81.31.231:22: found existing configuration"
level=info msg="[ssh] 206.81.31.231:22: is running k0s controller version v1.30.4+k0s.0"
level=info msg="[ssh] 206.81.31.231:22: listing etcd members"
level=info msg="==> Running phase: Validate facts"
level=info msg="[ssh] 206.81.31.231:22: validating configuration"
level=info msg="==> Running phase: Install workers"
level=info msg="[ssh] 206.81.20.20:22: validating api connection to https://10.19.0.6:6443"
level=info msg="[ssh] 161.35.218.68:22: validating api connection to https://10.19.0.6:6443"
level=info msg="* Running clean-up for phase: Acquire exclusive host lock"
level=info msg="* Running clean-up for phase: Install workers"
level=info msg="[ssh] 161.35.218.68:22: cleaning up"
level=info msg="[ssh] 206.81.20.20:22: cleaning up"
level=info msg="==> Apply failed"
level=fatal msg="apply failed - log file saved to /Users/francesco/Library/Caches/k0sctl/k0sctl.log: failed on 2 hosts:\n - [ssh] 161.35.218.68:22: failed to connect from worker to kubernetes api at https://10.19.0.6:6443 - check networking\n - [ssh] 206.81.20.20:22: failed to connect from worker to kubernetes api at https://10.19.0.6:6443 - check networking"
```

here is my
- [firewall configuration](https://github.com/iapicca/learning_k8s/blob/pivot_to_k0s/tofu/firewall.tf) what did I miss
- [terraform set up](https://github.com/iapicca/learning_k8s/blob/pivot_to_k0s/tofu/)
- [k0sctl.log](https://github.com/user-attachments/files/16784338/k0sctl.log)

note, `k0sctl` is installed on my local machine
```ssh
k0sctl version
version: v0.18.1
commit: 53248d6
```

possibly related to [#716](https://github.com/k0sproject/k0sctl/issues/716#issuecomment-2126776288)
question on [lens forum](https://forums.k8slens.dev/t/k0sctl-networking-error-failed-to-connect-from-worker-to-kubernetes-api-despite-firewall-config/3558)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.