Hello Friends:
I have a question.
Given the information I compiled further below, how do either of the following two commands find anything at all?
nmvega@vps10$ kubectl cluster-info # --or--
nmvega@vps10$ kubectl cluster-info --context kind-kind
Kubernetes master is running at https://127.0.0.1:32773
KubeDNS is running at https://127.0.0.1:32773/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
Why I ask:
The API-Server port exposed to the outermost docker ("bare-metal") host is 32773 (see below), which is not a well-known port to the kubectl(1) command (at least not that I know of).
Similarly, the 172.17.0.0/16 address-space for the docker-hosted Kubernetes nodes aren't well-known to kubectl(1) either (again, not that I know of). And even if it was, kubectl(1) would need to somehow discover that 172.17.0.5 is the control-plane (API server).
I feel like I'm missing a concept or magic somewhere. :)
In any case, here is some information to help you help me. Thank you in advance!
Container information, including internal / external port mappings ...
CONTAINER ID IMAGE NAMES PORTS
c93b0d105ff8 kindest/node:v1.17.0 kind-control-plane 127.0.0.1:32773->6443/tcp
d61d797f8b58 kindest/node:v1.17.0 kind-worker1
f7ab13ae4aae kindest/node:v1.17.0 kind-worker2
cfb036b2d1b0 kindest/node:v1.17.0 kind-worker3
And here are their pair-wise IP-Addresses ...
172.17.0.5
172.17.0.4
172.17.0.2
172.17.0.3
And the API-Server Port connections between them ...
nmvega@vps10$ docker container exec -it kind-worker ss | grep 6443
tcp ESTAB 0 0 172.17.0.4:33190 172.17.0.5:6443
tcp ESTAB 0 0 172.17.0.4:33114 172.17.0.5:6443
nmvega@vps10$ docker container exec -it kind-worker2 ss | grep 6443
tcp ESTAB 0 0 172.17.0.3:52560 172.17.0.5:6443
tcp ESTAB 0 0 172.17.0.3:52588 172.17.0.5:6443
nmvega@vps10$ docker container exec -it kind-worker3 ss | grep 6443
tcp ESTAB 0 0 172.17.0.2:56666 172.17.0.5:6443
tcp ESTAB 0 0 172.17.0.2:56586 172.17.0.5:6443
nmvega@vps10$ docker container exec -it kind-control-plane ss -l | grep 6443
tcp LISTEN 0 4096 *:6443 # This is: 172.17.0.5
And finally, LISTENed to ports and processes on the docker ("bare-metal") outer Host ...
nmvega@vps10$ sudo netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:32773 0.0.0.0:* LISTEN 200358/docker-proxy
tcp 0 0 0.0.0.0:5355 0.0.0.0:* LISTEN 142/systemd-resolve
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 142/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 164/sshd
tcp6 0 0 :::5355 :::* LISTEN 142/systemd-resolve
tcp6 0 0 :::22 :::* LISTEN 164/sshd
KIND uses the KUBECONFIG "standard" to write credentials. there is a file most likely in $HOME/.kube/config containing the cluster address, credentials, etc.
https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/
KIND uses the KUBECONFIG "standard" to write credentials. there is a file most likely in
$HOME/.kube/configcontaining the cluster address, credentials, etc.https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/
Thank goodness it makes sense (no magic after all).
And here I was -- before writing my question -- searching as follows (yet didn't think to egrep(1) for kube, too; which is actually the right thing to search for):
nmvega@vps10$ cd ~; find . | grep -i kind # Sigh! LoL
Thank you so much!
you're most welcome :-)
most kubernetes provisioning tools do something similar, we write to the kuebconfig file following some rules from kubectl about which file to use based on the --kubeconfig flag and KUBECONFIG environment variable and user HOME dir, we then set current-context to the one for this cluster.
you can also check just the kind part out with kind get kubeconfig and do this again for a running cluster with kind export kubeconfig
Excellent! You guys probably had answered this already (or in the docs), but maybe this question and answer wording will help others searching in the future. (I guess that's my cop-out for not searching for kube). :) Ttys