how to set listen-client-urls for etec local in a cluste setup with kubeadm

2/16/2019

the etcd local advertise-client-urls is default at https://127.0.0.1:2379 when kubeadm init a cluster successfully. how can i change it to my network Default route transits interface ip address like 192.168.1.9?

bigo@bigo-vm1:~$ kubeadm version
kubeadm version: &version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.3", GitCommit:"721bfa751924da8d1680787490c54b9179b1fed0", GitTreeState:"clean", BuildDate:"2019-02-16T15:29:34Z", GoVersion:"go1.11.5", Compiler:"gc", Platform:"linux/amd64"}
bigo@bigo-vm1:~$ cat /etc/kubernetes/manifests/etcd.yaml 
cat: /etc/kubernetes/manifests/etcd.yaml: Permission denied
bigo@bigo-vm1:~$ sudo cat /etc/kubernetes/manifests/etcd.yaml 
apiVersion: v1
kind: Pod
metadata:
  annotations:
    scheduler.alpha.kubernetes.io/critical-pod: ""
  creationTimestamp: null
  labels:
    component: etcd
    tier: control-plane
  name: etcd
  namespace: kube-system
spec:
  containers:
  - command:
    - etcd
    - --advertise-client-urls=https://127.0.0.1:2379:2379
    - --cert-file=/etc/kubernetes/pki/etcd/server.crt
    - --client-cert-auth=true
    - --data-dir=/var/lib/etcd
    - --initial-advertise-peer-urls=https://192.168.1.9:2380
    - --initial-cluster=bigo-vm1=https://192.168.1.9:2380
    - --key-file=/etc/kubernetes/pki/etcd/server.key
    - --listen-client-urls=https://127.0.0.1:2379

i have tried to modify kubernetes/hack/lib/etcd.sh

git diff kubernetes/hack/lib/etcd.sh
-ETCD_HOST=${ETCD_HOST:-127.0.0.1}
+ETCD_HOST=${ETCD_HOST:-192.168.1.9}

rebuild kubeadm from source , it can work, but it's take a long time to rebuild.

Another working method is to edit pod manifests files manually which involve any etcd client config file change.

is there something like kubeadm config etcd --config= to change the endpoints all involved

many thanks for your help

-- Bigo
kubeadm
kubernetes

1 Answer

2/17/2019

after switch the latest the release ,then rebuild the cluster ,

found out that the latest kubeadm has fixed this problem and use the

network Default route transits interface ip address as the endpoint.

thanks you all and kubeamd team for this improvement

-- Bigo
Source: StackOverflow