66448


vagrantのLinux上でマルチノードのK8sクラスタを構築しようとしてますが、エラーで行き詰っております。  
当方、kubanetesを勉強している最中で、本（15Stepで習得 Dockerから入るKubernetes
コンテナ開発からK8s本番運用まで）で紹介されている、  
デプロイメントの機能を試すため、導入を試みております。

手順１.  
power-shellで、Cドライブ直下で以下のコマンドを実行

[code]

    git clone https://github.com/takara9/vagrant-kubernetes
    
[/code]

手順２．  
power-shellで、以下のコマンドを実行

[code]

    cd vagrant-kubernetes
    
[/code]

手順３．  
power-shellで、以下のコマンドを実行

[code]

    vagrant up
    
[/code]

途中まで（masterやnode1）はうまくいっている感じですが、node2でエラー（fatal: [node2]: FAILED!
=>・・・の部分）がでます。  
エラーメッセージは、以下の通りです。

**エラーメッセージ１**

[code]

    ==> node2: Importing base box 'ubuntu/bionic64'...
    ==> node2: Matching MAC address for NAT networking...
    ==> node2: Checking if box 'ubuntu/bionic64' version '20200429.0.0' is up to date...
    ==> node2: Setting the name of the VM: vagrant-kubernetes_node2_1588557470915_41321
    ==> node2: Fixed port collision for 22 => 2222. Now on port 2201.
    ==> node2: Vagrant has detected a configuration issue which exposes a
    ==> node2: vulnerability with the installed version of VirtualBox. The
    ==> node2: current guest is configured to use an E1000 NIC type for a
    ==> node2: network adapter which is vulnerable in this version of VirtualBox.
    ==> node2: Ensure the guest is trusted to use this configuration or update
    ==> node2: the NIC type using one of the methods below:
    ==> node2:
    ==> node2:   https://www.vagrantup.com/docs/virtualbox/configuration.html#default-nic-type
    ==> node2:   https://www.vagrantup.com/docs/virtualbox/networking.html#virtualbox-nic-type
    ==> node2: Clearing any previously set network interfaces...
    ==> node2: Preparing network interfaces based on configuration...
        node2: Adapter 1: nat
        node2: Adapter 2: hostonly
    ==> node2: Forwarding ports...
        node2: 22 (guest) => 2201 (host) (adapter 1)
    ==> node2: Running 'pre-boot' VM customizations...
    ==> node2: Booting VM...
    ==> node2: Waiting for machine to boot. This may take a few minutes...
        node2: SSH address: 127.0.0.1:2201
        node2: SSH username: vagrant
        node2: SSH auth method: private key
        node2: Warning: Connection reset. Retrying...
        node2: Warning: Remote connection disconnect. Retrying...
        node2: Warning: Connection aborted. Retrying...
        node2: Warning: Connection aborted. Retrying...
        node2: Warning: Remote connection disconnect. Retrying...
        node2: Warning: Connection reset. Retrying...
        node2:
        node2: Vagrant insecure key detected. Vagrant will automatically replace
        node2: this with a newly generated keypair for better security.
        node2:
        node2: Inserting generated public key within guest...
        node2: Removing insecure key from the guest if it's present...
        node2: Key inserted! Disconnecting and reconnecting using new SSH key...
    ==> node2: Machine booted and ready!
    ==> node2: Checking for guest additions in VM...
    ==> node2: Setting hostname...
    ==> node2: Configuring and enabling network interfaces...
    ==> node2: Mounting shared folders...
        node2: /vagrant => C:/vagrant-kubernetes
    ==> node2: Running provisioner: ansible_local...
        node2: Installing Ansible...
        node2: Installing pip... (for Ansible installation)
    Vagrant has automatically selected the compatibility mode '2.0'
    according to the Ansible version installed (2.9.6).
    
    Alternatively, the compatibility mode can be specified in your Vagrantfile:
    https://www.vagrantup.com/docs/provisioning/ansible_common.html#compatibility_mode
        node2: Running ansible-playbook...
    
    PLAY [Kubernetes base] *********************************************************
    
    TASK [Gathering Facts] *********************************************************
    [DEPRECATION WARNING]: Distribution Ubuntu 18.04 on host node2 should use
    /usr/bin/python3, but is using /usr/bin/python for backward compatibility with
    prior Ansible releases. A future Ansible release will default to using the
    discovered platform python for this host. See https://docs.ansible.com/ansible/
    2.9/reference_appendices/interpreter_discovery.html for more information. This
    feature will be removed in version 2.12. Deprecation warnings can be disabled
    by setting deprecation_warnings=False in ansible.cfg.
    ok: [node2]
    
    TASK [kubernetes : Change selinux] *********************************************
    skipping: [node2]
    
    TASK [kubernetes : Stop firewalld] *********************************************
    skipping: [node2]
    
    TASK [kubernetes : Disable Swap area and delete] *******************************
    skipping: [node2]
    
    TASK [kubernetes : Add Docker GPG key] *****************************************
    changed: [node2]
    
    TASK [kubernetes : Add Docker APT repository] **********************************
    changed: [node2]
    
    TASK [kubernetes : Install a list of packages] *********************************
    changed: [node2]
    
    TASK [kubernetes : ensure a list of packages uninstalled] **********************
    skipping: [node2]
    
    TASK [kubernetes : Add Docker repository] **************************************
    skipping: [node2]
    
    TASK [kubernetes : ensure a list of packages installed] ************************
    skipping: [node2]
    
    TASK [kubernetes : Add the user 'vagrant' with a specific uid and a primary group of 'docker'] ***
    changed: [node2]
    
    TASK [kubernetes : Start dockerd] **********************************************
    ok: [node2]
    
    TASK [kubernetes : Add GlusterFS Repository] ***********************************
    fatal: [node2]: FAILED! => {"changed": false, "cmd": "apt-key adv --recv-keys --no-tty --keyserver hkp://keyserver.ubuntu.com:80 F7C73FCC930AC9F83B387A5613E01B7B3FE869A9", "msg": "Warning: apt-key output should not be parsed (stdout is not a terminal)\ngpg: connecting dirmngr at '/tmp/apt-key-gpghome.EcVqWUIgDu/S.dirmngr' failed: IPC connect call failed\ngpg: keyserver receive failed: No dirmngr", "rc": 2, "stderr": "Warning: apt-key output should not be parsed (stdout is not a terminal)\ngpg: connecting dirmngr at '/tmp/apt-key-gpghome.EcVqWUIgDu/S.dirmngr' failed: IPC connect call failed\ngpg: keyserver receive failed: No dirmngr\n", "stderr_lines": ["Warning: apt-key output should not be parsed (stdout is not a terminal)", "gpg: connecting dirmngr at '/tmp/apt-key-gpghome.EcVqWUIgDu/S.dirmngr' failed: IPC connect call failed", "gpg: keyserver receive failed: No dirmngr"], "stdout": "Executing: /tmp/apt-key-gpghome.EcVqWUIgDu/gpg.1.sh --recv-keys --no-tty --keyserver hkp://keyserver.ubuntu.com:80 F7C73FCC930AC9F83B387A5613E01B7B3FE869A9\n", "stdout_lines": ["Executing: /tmp/apt-key-gpghome.EcVqWUIgDu/gpg.1.sh --recv-keys --no-tty --keyserver hkp://keyserver.ubuntu.com:80 F7C73FCC930AC9F83B387A5613E01B7B3FE869A9"]}
    
    PLAY RECAP *********************************************************************
    node2                      : ok=6    changed=4    unreachable=0    failed=1    skipped=6    rescued=0    ignored=0
    
    Ansible failed to complete successfully. Any error output should be
    visible above. Please fix these errors and try again.
    
[/code]

また、以前上記と同じやり方でやった際に、手順3のところで時間がかかるだろうと思い、パソコンを一日電源つけたまま翌朝途中から再開したら、以下のメッセージがでました。  
この場合は、中断しなければうまくいくだろうと思い、今度は中断させずにやったら上記の通りのエラーがでます。  
今回の場合、どこかの設定ファイルを調整するなどの必要があるのだと推測しておりますが、見当がついていない状況です。  
わかる方がいらっしゃいましたら教えていただきたいです。

**エラーメッセージ２**

[code]

    TASK [kubernetes : Add Docker APT repository] **********************************
    fatal: [node2]: FAILED! => {"changed": false, "msg": "Failed to auto-install python-apt. Error was: 'E: Release file for http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease is not valid yet (invalid for another 8h 11min 21s). Updates for this repository will not be applied.\nE: Release file for http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease is not valid yet (invalid for another 8h 12min 22s). Updates for this repository will not be applied.\nE: Release file for http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease is not valid yet (invalid for another 8h 13min 43s). Updates for this repository will not be applied.'"}
    
[/code]


CC BY-SA 4.0
2020-05-04T02:35:35.037
66267
2020-05-09T03:54:47.403
2020-05-04T08:09:37.147
39856
39856
question
linux github kubernetes
vagrantのLinux上でマルチノードのK8sクラスタを構築したいがエラーとなる


こちらGitHub（<https://github.com/takara9/vagrant-
kubernetes/issues/6>）にて、回答をいただき、解決しました。同様の箇所で行き詰った方はご参照ください。

node2のGlusterFSのリポジトリを追加しようとして止まっているのですが、Ansibleがここで止まっているので、master と
node1の二つのノードは、成功してると考えられます。  
他のノードの起動確認として、以下のコマンドを実行。

[code]

    vagrant global-status
    
[/code]

このとき、古いnode2が生き残っていることが確認できたので、以下のコマンドを実行しました。

[code]

    vagrant destroy id
    
[/code]

＜補足＞  
それから、もし、カレントディレクトリの仮想マシンが動作していれば、以下の順番でコマンドを実行します。

[code]

    vagrant destroy -f
    vagrant up
    
[/code]

* * *

この回答は、質問者さんによるコメントとして投稿されていた回答をコミュニティ wiki によるものという形で回答化したものです。


CC BY-SA 4.0
2020-05-09T03:49:05.677
66448
2020-05-09T03:54:47.403
2020-05-09T03:54:47.403
19110
19110
66267
answer