k0s
k0s copied to clipboard
`k0s kubeconfig create` has hardcoded `k8s` as cluster name, even though we can change the clustername
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
k0smotron
Linux 5.10.198-187.748.amzn2.x86_64 #1 SMP Tue Oct 24 19:49:54 UTC 2023 x86_64 GNU/Linux
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.18.3
PRETTY_NAME="Alpine Linux v3.18"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"
Version
v1.28.4+k0s.0
Sysinfo
`k0s sysinfo`
Machine ID: "23d05826c4fce391c617b0fb3731b7055c9363224c45f867079a4c240b2101c6" (from machine) (pass)
Total memory: 7.5 GiB (pass)
Disk space available for /var/lib/k0s: 74.9 GiB (pass)
Name resolution: localhost: [::1 127.0.0.1] (pass)
Operating system: Linux (pass)
Linux kernel release: 5.10.198-187.748.amzn2.x86_64 (pass)
Max. file descriptors per process: current: 1048576 / max: 1048576 (pass)
AppArmor: unavailable (pass)
Executable in PATH: modprobe: /sbin/modprobe (pass)
Executable in PATH: mount: /bin/mount (pass)
Executable in PATH: umount: /bin/umount (pass)
/proc file system: mounted (0x9fa0) (pass)
Control Groups: version 1 (pass)
cgroup controller "cpu": available (pass)
cgroup controller "cpuacct": available (pass)
cgroup controller "cpuset": available (pass)
cgroup controller "memory": available (pass)
cgroup controller "devices": available (pass)
cgroup controller "freezer": available (pass)
cgroup controller "pids": available (pass)
cgroup controller "hugetlb": available (pass)
cgroup controller "blkio": available (pass)
CONFIG_CGROUPS: Control Group support: no kernel config found (warning)
CONFIG_NAMESPACES: Namespaces support: no kernel config found (warning)
CONFIG_NET: Networking support: no kernel config found (warning)
CONFIG_EXT4_FS: The Extended 4 (ext4) filesystem: no kernel config found (warning)
CONFIG_PROC_FS: /proc file system support: no kernel config found (warning)
What happened?
running k0s kubeconfig create creates a kubeconfig with a hardcoded name k0s
Steps to reproduce
- Create Cluster with
k0sConfig: apiVersion: k0s.k0sproject.io/v1beta1 kind: ClusterConfig metadata: name: foobar - run
k0s kubeconfig create - kubeconfig uses
k0sas the name
clusters:
- cluster:
server: https://xxxxx.eu-west-1.elb.amazonaws.com:6443
certificate-authority-data: LS0tLS1CRUdJ
name: k0s
contexts:
- context:
cluster: k0s
user: admin
name: k0s
current-context: k0s
kind: Config
preferences: {}
users:
- name: admin
user:
client-certificate-data: LS0tLS1CRUdJTiB
client-key-data: LS0tLS1CRU
Expected behavior
kubeconfig is created with name foobar
Actual behavior
kubeconfig is created with name k0s
Screenshots and logs
No response
Additional context
hardcoding happens here https://github.com/k0sproject/k0s/blob/75f90530d690289423937b6edb40eb4d7914a9f6/cmd/kubeconfig/create.go#L35-L55
@Schnitzel So given the config named as foobar, is this what you'd expect to see:
apiVersion: v1
clusters:
- cluster:
server: https://10.244.0.1:6443
certificate-authority-data: deadbeef
name: foobar
contexts:
- context:
cluster: foobar
user: foo
name: foobar
current-context: foobar
kind: Config
preferences: {}
users:
- name: foo
user:
client-certificate-data: deadbeef
client-key-data: deadbeef
So basically both the cluster and context is named as foobar
@jnummelin correct!
This would be great, I ran into the same issue today.
The issue is marked as stale since no activity has been recorded in 30 days
The issue is marked as stale since no activity has been recorded in 30 days
The issue is marked as stale since no activity has been recorded in 30 days