How to change the IP and port of etcd listening

7/10/2019

my vm(virtual machine) have Multiple virtual network cards,so it has multiple ip,When I installed kubernetes, etcd was automatically installed and configured,and it automatically selected a default IP. but This IP is not what I want it to listen for. where and how can I configure the etcd to listen the right ip I wanted?

I installed kubernetes and the first control panel(master01) is work(ready). but when i join the second control panel(master02),I get the error like this: "error execution phase check-etcd: error syncing endpoints with etc: dial tcp 10.0.2.15:2379: connect: connection refused". so I checked etcd process found that one of it configuration is"--advertise-client-urls=10.0.2.15:2379",the ip is not what I want it to listen for. my realy ip is 192.168.56.101. And I want it listen for this ip. what should I do?

my kubernetes cluster version is v1.14.1

I hope the etcd can listen for the correct IP. And the second kubernetes master node can join the cluster successfully.

-- Esc
etcd
kubernetes

1 Answer

7/10/2019

Judging by the error message it looks like you're using kubeadm. You need to add extraArgs to your etcd in ClusterConfiguration, something like (untested):

apiVersion: kubeadm.k8s.io/v1beta1
kind: ClusterConfiguration
etcd:
  local:
   ...
    extraArgs:
      advertise-client-urls: "https://192.168.56.101:2379"
      listen-client-urls: "https://192.168.56.101:2379,https://127.0.0.1:2379"
   ...

Also see the ClusterConfiguration documentation: https://godoc.org/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta1#LocalEtcd

-- johnharris85
Source: StackOverflow