siderolabs / talos

Talos Linux is a modern Linux distribution built for Kubernetes.
https://www.talos.dev
Mozilla Public License 2.0
6.39k stars 514 forks source link

Docker control plane port mapping should be 6443:6443 (or documented not to be) #9012

Open jfrosch opened 1 month ago

jfrosch commented 1 month ago

Bug Report

Docker installation port mapping should map the control plane as 6443:6443 not some_random_port:6443. Either the docs should warn about this and advise users to update the kube config with the random port mapping, or (even better) change the mapping of the control plane container to 6443:6443.

Description

The cluster was created with the simple command talosctl cluster create --workers 3 but I couldn't get kubectl get nodes to work. It kept timing out. Same with curl. Being new to Talos, I though I had made a mistake somewhere. After retracing my steps, it became obvious the instructions in the docs and the Install on Docker video were missing some key ingredient.

I couldn't figure it out until I opened Docker Desktop dashboard and noticed the port mappings. Here's the control plane entry from docker ps:

b02a0503888c   ghcr.io/siderolabs/talos:v1.7.5   "/sbin/init"   About an hour ago   Up About an hour   0.0.0.0:64919->6443/tcp, 0.0.0.0:64920->50000/tcp   talos-default-controlplane-1

Crap. The container was started with control plane port mapping of 64919:6443 . I would have expected a port mapping of 6443:6443 to go along with all the documentation, videos, etc. I don't have any other apps listening on 6443, so the random port number doesn't seem to have been used to deconflict with an existing K8s cluster.

As soon as I updated the KubeConfig with server: https://localhost:64919, kubectl was able to interact with the cluster.

Logs

Environment

smira commented 1 month ago

talosctl cluster create out of the box generates proper kubeconfig (with the correct port) and merges it into your default ~/.kubeconfig location. So you can do kubectl right after the moment talosctl cluster create finished.

I agree there's a bit of the documentation missing here.