Skip to content

Cannot override k3s arguments during cluster installation #1363

@Nevon

Description

@Nevon

Description

When starting colima with the --kubernetes flag, it is not possible to override arguments passed to k3s using the --k3s-arg parameter. The user provided arguments are included in the final command, but they are combined with the ones defined by colima rather than overriding them.

Version

colima version 0.8.1
git commit: 96598cc
limactl version 1.1.1

Operating System

  • macOS Intel <= 13 (Ventura)
  • macOS Intel >= 14 (Sonoma)
  • Apple Silicon <= 13 (Ventura)
  • Apple Silicon >= 14 (Sonoma)
  • Linux

Output of colima status

INFO[0000] colima [profile=kube] is running using macOS Virtualization.Framework
INFO[0000] arch: aarch64
INFO[0000] runtime: docker
INFO[0000] mountType: virtiofs
INFO[0000] address: 192.168.105.5
INFO[0000] socket: unix:///Users/tommy.brunn/.colima/kube/docker.sock
INFO[0000] kubernetes: enabled

Reproduction Steps

  1. Create a new profile with k3s enabled and try to override for example --advertise-address:
colima start --kubernetes \
  --profile example \
  --k3s-arg="--advertise-address=192.168.105.2" \
  --very-verbose`
  1. Note how in the arguments passed to the k3s-install script, --advertise-address is included twice:

TRAC[0025] cmd ["lima" "sh" "-c" "INSTALL_K3S_SKIP_DOWNLOAD=true INSTALL_K3S_SKIP_ENABLE=true k3s-install.sh --write-kubeconfig-mode 644 --disable=traefik --advertise-address=192.168.105.2 --advertise-address 192.168.105.5\n192.168.105.2 --flannel-iface col0 --docker --https-listen-port 57908"]

The second instance of --advertise-address there is set by colima:

args = append(args, "--advertise-address", ipAddress)

Expected behaviour

I would expect any argument passed via --k3s-arg to override any default values set by colima. In the example above, I would expect the resulting command to only include --advertise-address=192.168.105.2

Additional context

This behavior might get more ambiguous if k3s has arguments that you are expected to provide multiple times, similar to colimas --k3s-arg parameter. That may have to be decided on a case-by-case basis whether a user supplied value indicates that colima should not set any defaults, or if they should be additive in addition to whatever colima sets.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions