質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%

Q&A

解決済

1回答

702閲覧

kubeadm joinでmasterを参加させることができない

urbainleverrier

総合スコア200

0グッド

0クリップ

投稿2019/07/08 05:36

編集2019/07/08 15:34

現在起きていること

kubeadm joinでmaster nodeのクラスタを参加させることができません。etcdのクラスタを構築する際に、タイムアウトします。どうやら、joinするetcd.yamlが最初のmasterのipアドレス(172.16.1.11)でadvertiseするようです。
ここで、etcd.yamlでjoinするmasterのipアドレス(172.16.1.12)になっているようにしたいです。
どのようにすれば設定できるでしょうか。

実現したいこと

haクラスタを構築し、etcdはstackさせたいです。

参考ログ(ansible)

"cmd":[ "kubeadm", "join", "172.16.1.10:6443", "--apiserver-advertise-address", "172.16.1.12", "--apiserver-bind-port", "6443", "--certificate-key", "(decrypt key)", "--control-plane", "--discovery-token-ca-cert-hash", "(hash)", "--node-name", "v133-18-201-34", "--token", "(token)" ],
"stdout_lines":[ "[preflight] Running pre-flight checks", "[preflight] Reading configuration from the cluster...", "[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'", "[preflight] Running pre-flight checks before initializing the new control plane instance", "[preflight] Pulling images required for setting up a Kubernetes cluster", "[preflight] This might take a minute or two, depending on the speed of your internet connection", "[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'", "[download-certs] Downloading the certificates in Secret \"kubeadm-certs\" in the \"kube-system\" Namespace", "[certs] Using certificateDir folder \"/etc/kubernetes/pki\"", "[certs] Generating \"apiserver\" certificate and key", "[certs] apiserver serving cert is signed for DNS names [v133-18-201-34 kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 172.16.1.12 172.16.1.10 172.16.1.10]", "[certs] Generating \"apiserver-kubelet-client\" certificate and key", "[certs] Generating \"front-proxy-client\" certificate and key", "[certs] Generating \"etcd/server\" certificate and key", "[certs] etcd/server serving cert is signed for DNS names [v133-18-201-34 localhost] and IPs [172.16.1.12 127.0.0.1 ::1 172.16.1.11]", "[certs] Generating \"etcd/healthcheck-client\" certificate and key", "[certs] Generating \"etcd/peer\" certificate and key", "[certs] etcd/peer serving cert is signed for DNS names [v133-18-201-34 localhost] and IPs [172.16.1.12 127.0.0.1 ::1 172.16.1.11]", "[certs] Generating \"apiserver-etcd-client\" certificate and key", "[certs] Valid certificates and keys now exist in \"/etc/kubernetes/pki\"", "[certs] Using the existing \"sa\" key", "[kubeconfig] Generating kubeconfig files", "[kubeconfig] Using kubeconfig folder \"/etc/kubernetes\"", "[kubeconfig] Writing \"admin.conf\" kubeconfig file", "[kubeconfig] Writing \"controller-manager.conf\" kubeconfig file", "[kubeconfig] Writing \"scheduler.conf\" kubeconfig file", "[control-plane] Using manifest folder \"/etc/kubernetes/manifests\"", "[control-plane] Creating static Pod manifest for \"kube-apiserver\"", "[control-plane] Creating static Pod manifest for \"kube-controller-manager\"", "[control-plane] Creating static Pod manifest for \"kube-scheduler\"", "[check-etcd] Checking that the etcd cluster is healthy", "[kubelet-start] Downloading configuration for the kubelet from the \"kubelet-config-1.15\" ConfigMap in the kube-system namespace", "[kubelet-start] Writing kubelet configuration to file \"/var/lib/kubelet/config.yaml\"", "[kubelet-start] Writing kubelet environment file with flags to file \"/var/lib/kubelet/kubeadm-flags.env\"", "[kubelet-start] Activating the kubelet service", "[kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap...", "[etcd] Announced new etcd member joining to the existing etcd cluster", "[etcd] Wrote Static Pod manifest for a local etcd member to \"/etc/kubernetes/manifests/etcd.yaml\"", "[etcd] Waiting for the new etcd member to join the cluster. This can take up to 40s", "[kubelet-check] Initial timeout of 40s passed." ]

以下のetcd.yamlはjoinするnodeにある、kubeadm joinで自動生成されたものです。
ipアドレスは172.16.1.12ですが、172.16.1.11が生成され、また名前もv133-18-201-34を期待しますが、実際はv133-18-200-115が使われています。

[root@v133-18-201-34 manifests]# cat etcd.yaml apiVersion: v1 kind: Pod metadata: creationTimestamp: null labels: component: etcd tier: control-plane name: etcd namespace: kube-system spec: containers: - command: - etcd - --advertise-client-urls=https://172.16.1.11:2379 - --cert-file=/etc/kubernetes/pki/etcd/server.crt - --client-cert-auth=true - --data-dir=/var/lib/etcd - --initial-advertise-peer-urls=https://172.16.1.11:2380 - --initial-cluster=v133-18-200-115.vir.kagoya.net=https://172.16.1.11:2380,v133-18-201-34=https://172.16.1.12:2380 - --initial-cluster-state=existing - --key-file=/etc/kubernetes/pki/etcd/server.key - --listen-client-urls=https://127.0.0.1:2379, https://172.16.1.11:2379 - --listen-peer-urls=https://172.16.1.11:2380 - --name=v133-18-200-115.vir.kagoya.net - --peer-cert-file=/etc/kubernetes/pki/etcd/peer.crt - --peer-client-cert-auth=true - --peer-key-file=/etc/kubernetes/pki/etcd/peer.key - --peer-trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt - --snapshot-count=10000 - --trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt image: k8s.gcr.io/etcd:3.3.10 imagePullPolicy: IfNotPresent livenessProbe: exec: command: - /bin/sh - -ec - ETCDCTL_API=3 etcdctl --endpoints=https://[127.0.0.1]:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/healthcheck-client.crt --key=/etc/kubernetes/pki/etcd/healthcheck-client.key get foo failureThreshold: 8 initialDelaySeconds: 15 timeoutSeconds: 15 name: etcd resources: {} volumeMounts: - mountPath: /var/lib/etcd name: etcd-data - mountPath: /etc/kubernetes/pki/etcd name: etcd-certs hostNetwork: true priorityClassName: system-cluster-critical volumes: - hostPath: path: /etc/kubernetes/pki/etcd type: DirectoryOrCreate name: etcd-certs - hostPath: path: /var/lib/etcd type: DirectoryOrCreate name: etcd-data status: {}

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

kubeadmのconfigurationにetcdのconfigurationを記載したことが原因なようです。
configurationはkubeadm initに追加するしないにか関わらず、configmapに上がるのですが、etcdを記載するとkubeadm joinでこの情報を見るようで、特にlocalなetcdを構築する際、extraArgs以下のipアドレスは記載しないほうが良いことがわかりました。

kubeadm joinでetcdクラスタが同時に構築されるようになったようですが、(pull request)joinした方はclusterを構築するようyamlが変更されるのですが、joinされる側の最初のmaster nodeについては変更されず、livenessprobeがunhealthyになるようです。etcdクラスタについては別途、documentに書かれた内容を行う必要がありそうです。

投稿2019/07/08 15:34

urbainleverrier

総合スコア200

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問