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

API URL broken in build script when using dual stack configs #111

Closed
djh00t opened this issue Mar 14, 2023 · 4 comments · Fixed by #113
Closed

API URL broken in build script when using dual stack configs #111

djh00t opened this issue Mar 14, 2023 · 4 comments · Fixed by #113

Comments

@djh00t
Copy link
Contributor

djh00t commented Mar 14, 2023

Howdy!

I am building a dual stack cluster however the installer doesn't work and needs to be manually hacked around to get servers to build due to a malformed Kube API URL in the installer:

K8S Server Config

    k8s01 = {
      # name = k8s01
      ip = "172.18.100.2,XXX:XXX:XXX:102::1:1" // internal node IP
      connection = {
        host = "172.18.100.2" // public node IP
        user = "ord"
      }
      # flags  = ["--flannel-backend=none"]
      labels = { "node.kubernetes.io/type" = "master" }
      # taints = { "node.k3s.io/type" = "server:NoSchedule" }
    }
    k8s02 = {
      # name = k8s02
      ip = "172.18.100.6,XXX:XXX:XXX:102::1:2"
      connection = {
        host = "172.18.100.6" // public node IP
        user = "ord"
      }
      # flags  = ["--flannel-backend=none"]
      labels = { "node.kubernetes.io/type" = "master" }
      # taints = { "node.k3s.io/type" = "server:NoSchedule" }
    }

Script that is output

#!/bin/sh
INSTALL_K3S_VERSION=v1.26.1+k3s1 sh /tmp/k3s-installer server --node-ip 172.18.100.6,XXX:XXX:XXX:102::1:2 --node-name 'k8s02' --server https://172.18.100.2,XXX:XXX:XXX:102::1:1:6443 --cluster-cidr 10.255.0.0/16,XXX:XXX:XXX:200::/56 --service-cidr 172.18.100.0/24,XXX:XXX:XXX:102::/112 --token <redacted> --disable traefik --disable servicelb
until sudo kubectl get node k8s02; do sleep 1; done

I've taken a look at the code and I could use root_server_ip = values(var.servers)[0].connection.host but that seems like a hack, perhaps the first value in the dual stack pair should be parsed and used instead?

@xunleii
Copy link
Owner

xunleii commented Mar 14, 2023

Hi @djh00t,

I never used k3s (and this module) in dual stack mode, so thanks a lot for your feedback.

@xunleii
Copy link
Owner

xunleii commented Mar 14, 2023

@djh00t, I made a change on #112 that should fix your issue. Would it be possible to test it from your side?

Here is the source value to use when you call this module:

   source = "github.com/xunleii/terraform-module-k3s?ref=cfdeacc14dcb7440efba24489c29ffb779cf5084"

Thanks a lot for your help !

@djh00t
Copy link
Contributor Author

djh00t commented Mar 15, 2023

Hello @xunleii - I was just about to send a PR to fix this :)

Let me test and come back to you shortly.

@djh00t
Copy link
Contributor Author

djh00t commented Mar 15, 2023

Hello @xunleii,

After testing your PR, there were a bunch of other changes required to get K3S to build reliably using both native IPv6 and dual stack IPv4/IPv6.

Please consider PR #113 for inclusion. I have tested all 3 K3S install modes and they all work without error.

If you'd like any further changes made please let me know.

@djh00t djh00t mentioned this issue Mar 15, 2023
3 tasks
@xunleii xunleii linked a pull request Mar 18, 2023 that will close this issue
3 tasks
@xunleii xunleii closed this as completed Mar 18, 2023
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 a pull request may close this issue.

2 participants