How to find cluster node ip address

前端 未结 4 1526
庸人自扰
庸人自扰 2021-01-28 19:58

Minikube has the specific node ip address (192.168.99.100) for single cluster, if I using kubeadm to create many nodes cluster, what should I do to find this ip address?

4条回答
  •  迷失自我
    2021-01-28 20:34

    it is important to understand that there is no such thing as single IP of the kubernetes cluster. Minikube has it because it's a special 1 node case. Most production clusters will be one way or another operating with many internal and external IP addresses: each node is deployed on a separate (virtual) machine that has it's own IP address, either public or private depending on how you setup the (virtual) machines. Now the question is what do you need the IP for:

    • if you are looking for the kubernetes API endpoint server address (the endpoint to which kubectl talks) then in case of clusters created manually with kubeadm, this will be the IP of the master node that you created with kubeadm init command (assuming single master case). See this official doc for details. To talk to your cluster using kubectl you will need some authorization data except its IP: see subsequent sections of the mentioned document how to obtain it.
    • if you are looking for the IP of a LoadBalancer type service, then it will be reported among lots of other stuff in the output of kubectl get service name-of-your-service -o yaml or kubectl describe service name-of-your-service. Note however that clusters created with kubeadm don't provide external load-balancers on their own (that's why they are called external) and if you intend to setup a fully functional production cluster manually, you will need to use something like MetalLB in addition.
    • if you are looking for IPs of NodePort type services then these will be all the IPs of worker node (virtual) machines that you assimilated into you cluster by running kubeadm join command on them. if you don't remember them then you can use kubectl get nodes -o wide as suggested in the other answer.

提交回复
热议问题