Skip to content

k0sctl apply: selects wrong IP address for ClusterConfig #716

Open

Description

Before creating an issue, make sure you've checked the following:

  • You are running the latest released version of k0s
  • Make sure you've searched for existing issues, both open and closed
  • Make sure you've searched for PRs too, a fix might've been merged already
  • You're looking at docs for the released version, "main" branch docs are usually ahead of released versions.

Platform

aarch64 & x86_64 (arch linux)

Version

No response

Sysinfo

`k0s sysinfo`
➡️ Please replace this text with the output of `k0s sysinfo`. ⬅️

What happened?

I have a controller node defined with two IP addresses. The primary network adress is 192.168.1.254, the secondary address is 192.168.1.240/32:

# ip addr show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1492 qdisc mq state UP group default qlen 1000
    link/ether dc:a6:32:1c:a9:fc brd ff:ff:ff:ff:ff:ff
    altname end0
    inet 192.168.1.254/24 brd 192.168.1.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet 192.168.1.240/32 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::dea6:32ff:fe1c:a9fc/64 scope link proto kernel_ll 
       valid_lft forever preferred_lft forever

In k0sctl, I specify:

 - ssh:
      address: 192.168.1.254
      user: root
      port: 22
      keyPath: ~/.ssh/id_rsa
    role: controller+worker

The ClusterConfig is picking up the secondary IP address (192.168.1.240) as the API address but should be choosing the primary IP address 192.168.1.254.

# generated-by-k0sctl 2024-05-16T10:06:40+01:00
apiVersion: k0s.k0sproject.io/v1beta1
kind: ClusterConfig
metadata:
  name: home-cluster
spec:
  api:
    address: 192.168.1.240
    sans:
    - 192.168.1.240
    - 192.168.1.252
    - 192.168.1.254
    - 127.0.0.1
  storage:
    etcd:
      peerAddress: 192.168.1.240
    kine:
      dataSource: mysql://k0s:k0s@tcp(192.168.1.252)/k0s
    type: kine

Steps to reproduce

  1. Build a k0sctl.yaml with a controller node
  2. Add secondary IP to an interface ip addr add 192.168.1.240/32 dev eth0 onto the controller node
  3. k0sctl apply --dry-run and observe the ClusterConfig output

Expected behavior

ClusterConfig should have been defined with the primary interface address 192.168.1.254.

Actual behavior

ClusterConfig should have been defined with the primary interface address 192.168.1.240.

Screenshots and logs

No response

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions