colima icon indicating copy to clipboard operation
colima copied to clipboard

feat: add support for setting kubernetes server port (or automate based on profiles to avoid overlap)

Open dmccaffery opened this issue 3 years ago • 2 comments

Description

When starting two instances of colima, both with kubernetes enabled, they use the same server port mapped to the host (6443). Only the first instance is mapped correctly. When the kube config context is activated, it no longer works as the certificates do not align.

Expected:

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0t...
    server: https://127.0.0.1:6443
  name: colima
- cluster:
    certificate-authority-data: LS0t...
    server: https://127.0.0.1:6444
  name: colima-backup

Actual:

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0t...
    server: https://127.0.0.1:6443
  name: colima
- cluster:
    certificate-authority-data: LS0t...
    server: https://127.0.0.1:6443
  name: colima-backup

You can switch between the two by starting one and stopping the other, but it would be nice to be able to run different versions of kubernetes, or different instances at the same time to support a backup in demo / presentation settings.

dmccaffery avatar Nov 08 '22 00:11 dmccaffery

If you start with network address enabled, it would avoid the clash.

But yeah, that's a good point you raised.

colima start --network-address

abiosoft avatar Nov 08 '22 01:11 abiosoft

In ~/.colima/{profile}/colima.yaml you can specify the port as described by @abiosoft (thank you for the hint)

#(...)
# Network configurations for the virtual machine.
network:
  # Assign reachable IP address to the virtual machine.
  # NOTE: this is currently macOS only and ignored on Linux.
  # Default: false
  address: https://127.0.0.1:6444
#(...)

daBrian avatar Mar 21 '24 07:03 daBrian