k0sctl icon indicating copy to clipboard operation
k0sctl copied to clipboard

In dual-stack mode --node-ip to kubelet only have one address

Open uablrek opened this issue 1 year ago • 5 comments

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

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

Platform

vm-001 ~ # uname -srvmo; cat /etc/os-release || lsb_release -a
Linux 6.9.3 k0sproject/k0s#6 SMP PREEMPT_DYNAMIC Fri Jun 14 10:33:26 CEST 2024 x86_64 GNU/Linux
NAME="Xcluster"
VERSION="2024.06.28"
ID=xcluster
PRETTY_NAME="Xcluster"
VERSION_ID="2024.06.28"

Version

vm-001 ~ # k0s version v1.30.2+k0s.0

Sysinfo

`k0s sysinfo`
vm-001 ~ # k0s sysinfo
Total memory: 982.2 MiB (warning: 1.0 GiB recommended)
Disk space available for /var/lib/k0s: 4.8 GiB (pass)
Name resolution: localhost: [127.0.0.1] (pass)
Operating system: Linux (pass)
  Linux kernel release: 6.9.3 (pass)
  Max. file descriptors per process: current: 4096 / max: 4096 (warning: 

What happened?

In dual-stack mode only the ipv4 address is specified in the "--node-ip" parameter to kubelet. This causes the node object to have only an ipv4 address.

Steps to reproduce

  1. Start k0s in dual-stack mode
  2. On a worker node do: ps ... | grep kubelet and check the "--node-ip" parameter
  3. Or, do k0s kubectl get node $(hostname) -o json | jq .status.addresses. Only ipv4 is present

Expected behavior

Both ipv4 and ipv6 addresses should be specified in "--node-ip", example:

--node-ip=192.168.1.2,fd00::c0a8:102

Then, when the worker joins, the node object will have both addresses:

# kubectl get node $(hostname) -o json | jq .status.addresses
[
  {
    "address": "192.168.1.2",
    "type": "InternalIP"
  },
  {
    "address": "fd00::c0a8:102",
    "type": "InternalIP"
  },
  {
    "address": "vm-002",
    "type": "Hostname"
  }
]

Actual behavior

Only ipv4 is specified in "--node-ip", and the node object only gets an ipv4 address:

vm-002 ~ # k0s kubectl get node $(hostname) -o json | jq .status.addresses
[
  {
    "address": "192.168.1.2",
    "type": "InternalIP"
  },
  {
    "address": "vm-002",
    "type": "Hostname"
  }
]

Screenshots and logs

No response

Additional context

I install with k0sctl.

k0scat.yaml
apiVersion: k0sctl.k0sproject.io/v1beta1
kind: Cluster
metadata:
  name: k0s-cluster
spec:
  k0s:
    version: $__k0sver
    config:
      apiVersion: k0s.k0sproject.io/v1beta1
      kind: Cluster
      metadata:
        name: k0s
      spec:
        api:
          k0sApiPort: 9443
          port: 6443
        installConfig:
          users:
            etcdUser: etcd
            kineUser: kube-apiserver
            konnectivityUser: konnectivity-server
            kubeAPIserverUser: kube-apiserver
            kubeSchedulerUser: kube-scheduler
        konnectivity:
          adminPort: 8133
          agentPort: 8132
        network:
          kubeProxy:
            disabled: false
            mode: iptables
          provider: calico
          calico:
            mode: "bird"
            envVars:
              IP_AUTODETECTION_METHOD: "interface=eth1"
              IP6_AUTODETECTION_METHOD: "interface=eth1"
          kuberouter:
            autoMTU: true
            mtu: 0
            peerRouterASNs: ""
            peerRouterIPs: ""
          podCIDR: 10.244.0.0/16
          serviceCIDR: 10.96.0.0/16
          dualStack:
            enabled: true
            IPv6podCIDR: "$PREFIX:0af4:0:0/108"
            IPv6serviceCIDR: "$PREFIX:0a60:0:0/108"
        podSecurityPolicy:
          defaultPolicy: 00-k0s-privileged
        storage:
          type: etcd
        telemetry:
          enabled: false
  hosts:
  - ssh:
      address: 192.168.1.1
      user: root
      port: 22
      keyPath: /root/.ssh/id_dropbear_ssh
    role: controller+worker
    installFlags:
    - --disable-components=konnectivity-server
    noTaints: true
    os: alpine
    privateInterface: eth1
    privateAddress: 192.168.1.1
    k0sDownloadURL: file:///root/www/k0s-$__k0sver-amd64
  - ssh:
      address: 192.168.1.2
      user: root
      port: 22
      keyPath: /root/.ssh/id_dropbear_ssh
    role: worker
    os: alpine
    privateInterface: eth1
    privateAddress: 192.168.1.2
    k0sDownloadURL: file:///root/www/k0s-$__k0sver-amd64
  - ssh:
      address: 192.168.1.3
      user: root
      port: 22
      keyPath: /root/.ssh/id_dropbear_ssh
    role: worker
    os: alpine
    privateInterface: eth1
    privateAddress: 192.168.1.3
    k0sDownloadURL: file:///root/www/k0s-$__k0sver-amd64
  - ssh:
      address: 192.168.1.4
      user: root
      port: 22
      keyPath: /root/.ssh/id_dropbear_ssh
    role: worker
    os: alpine
    privateInterface: eth1
    privateAddress: 192.168.1.4
    k0sDownloadURL: file:///root/www/k0s-$__k0sver-amd64

uablrek avatar Jun 28 '24 08:06 uablrek