Kubespray: Current install documentation is incorrect and does not work due to inventory script changes

Created on 4 Mar 2019  路  15Comments  路  Source: kubernetes-sigs/kubespray

The install/usage documentation here: https://github.com/kubernetes-sigs/kubespray#usage doesn't seem to current as of this PR: https://github.com/kubernetes-sigs/kubespray/pull/4303

The step CONFIG_FILE=inventory/mycluster/hosts.ini python3 contrib/inventory_builder/inventory.py ${IPS[@]} fails due to:

$ CONFIG_FILE=inventory/prodkubcluster/hosts.ini python36 contrib/inventory_builder/inventory.py ${IPS[@]}
Traceback (most recent call last):
  File "contrib/inventory_builder/inventory.py", line 34, in <module>
    from ruamel.yaml import YAML
ModuleNotFoundError: No module named 'ruamel'

It seems that ruamel is now a required package, but it's not listed in requirements.txt.

lifecyclrotten

Most helpful comment

@elfiii

apt-get install python3-pip
pip3  install -r contrib/inventory_builder/requirements.txt
cp -rfp inventory/sample inventory/mycluster
declare -a IPS=(192.168.122.134 192.168.122.216 192.168.122.193)  #example...
CONFIG_FILE=inventory/mycluster/hosts.yaml python3 contrib/inventory_builder/inventory.py ${IPS[@]}

good luck.

All 15 comments

Furthermore, it would appear that any references to hosts.ini needs to be updated to hosts.yaml.

I am having the same issue. I tried _pip install ruamel.yaml_ but it didn't help.

@elfiii

apt-get install python3-pip
pip3  install -r contrib/inventory_builder/requirements.txt
cp -rfp inventory/sample inventory/mycluster
declare -a IPS=(192.168.122.134 192.168.122.216 192.168.122.193)  #example...
CONFIG_FILE=inventory/mycluster/hosts.yaml python3 contrib/inventory_builder/inventory.py ${IPS[@]}

good luck.

For ruamel.yaml error install it as follow: sudo pip3.6 install ruamel.yaml
New script is made to use hosts.yaml instead of hosts.ini
I found this structure in a commit, but can't seem to find it again:

## Configure 'ip' variable to bind kubernetes services on a
## different ip than the default iface
## We should set etcd_member_name for etcd cluster. The node that is not a etcd member do not need to set the value, or can set the empty string value.
all:
  hosts:
    node1:
      ansible_host: 95.54.0.12
      ip: 10.3.0.1
      access_ip: 10.3.0.1
      ansible_ssh_private_key_file: /Users/someuser/.ssh/id-rsa
    node2:
      ansible_host: 95.54.0.13
      ip: 10.3.0.2
      access_ip: 10.3.0.2
      ansible_ssh_private_key_file: /Users/someuser/.ssh/id-rsa
    node3:
      ansible_host: 95.54.0.14
      ip: 10.3.0.3
      access_ip: 10.3.0.3
      ansible_ssh_private_key_file: /Users/someuser/.ssh/id-rsa
    node4:
      ansible_host: 95.54.0.15
      ip: 10.3.0.4
      access_ip: 10.3.0.4
      ansible_ssh_private_key_file: /Users/someuser/.ssh/id-rsa
    node5:
      ansible_host: 95.54.0.16
      ip: 10.3.0.5
      access_ip: 10.3.0.5
      ansible_ssh_private_key_file: /Users/someuser/.ssh/id-rsa

## configure a bastion host if your nodes are not directly reachable
      bastion:
        ansible_host=x.x.x.x
        ansible_user=some_user


  vars:
## configure a ansible_user
    ansible_user: centos

  children:
    kube-master:
      hosts:
        node1:
        node2:

    kube-node:
      hosts:
        node1:
        node2:
        node3:
        node4:
        node5:
    etcd:
      hosts:
        node1:
        node2:
        node3:

    vsphere:
      hosts:

    k8s-cluster:
      children:
        kube-master:
        kube-node:

    calico-rr:
      hosts:

I think it was from @tikitavi , can you confirm?

We also found this problem as below. Not surly what file need to operate. "host.ini" or "host.yaml". Please kindly advise


CONFIG_FILE=inventory/k8scis/hosts.ini python3 contrib/inventory_builder/inventory.py ${IPS[@]}
Traceback (most recent call last):
File "contrib/inventory_builder/inventory.py", line 36, in
from ruamel.yaml import YAML
ImportError: No module named 'ruamel'

We also found this problem as below. Not surly what file need to operate. "host.ini" or "host.yaml". Please kindly advise

CONFIG_FILE=inventory/k8scis/hosts.ini python3 contrib/inventory_builder/inventory.py ${IPS[@]}
Traceback (most recent call last):
File "contrib/inventory_builder/inventory.py", line 36, in
from ruamel.yaml import YAML
ImportError: No module named 'ruamel'

If you follow what @xulis said you should use hosts.yaml
I'm commenting to see updates on this.

apt-get install python3-pip
pip3  install -r contrib/inventory_builder/requirements.txt

retry.

Hello,
Facing the same issue, fixed the dependecies issues.
Is it possible to add a sample file host.yaml in inventory/sample/
Thank you for your help.
Regards,

Update for all. As @xulis and @wolkjesmaker mension. We're try to use host.yaml instend with apply like normal procedure. This work like charm krab.

Recently i got the exact same error.. here is what i did to resolve it.

apt install python3-pip

export LC_ALL=C

sudo pip3 install ruamel.yaml

Hope it resolves your issue.

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

I faced the same issue with MAC 10.15.2.
I did the following to resolve the issue, I uninstalled python3, reinstalled homebrew and python back again.
brew uninstall python3
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install python ## This will install both the python 2.7 and python 3.7
brew postinstall python3

Was this page helpful?
0 / 5 - 0 ratings