Update docs for using venv (#8842)

Due many patterns of Linux distributions, it is difficult to install
ansible dependencies as system-wide stably.
Apart of Kubespray doc[1] recommends to use venv to avoid such issue,
and this applies venv usage to the other parts of the doc.

[1]: https://github.com/kubernetes-sigs/kubespray/blob/master/docs/setting-up-your-first-cluster.md#set-up-kubespray
This commit is contained in:
Kenichi Omichi 2022-05-19 23:39:12 -07:00 committed by GitHub
parent e42a01f203
commit 0e6b727e53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 9 deletions

View file

@ -19,10 +19,10 @@ To deploy the cluster you can use :
#### Usage #### Usage
```ShellSession Install Ansible according to [Ansible installation guide](/docs/ansible.md#installing-ansible)
# Install dependencies from ``requirements.txt`` then run the following steps:
sudo pip3 install -r requirements.txt
```ShellSession
# Copy ``inventory/sample`` as ``inventory/mycluster`` # Copy ``inventory/sample`` as ``inventory/mycluster``
cp -rfp inventory/sample inventory/mycluster cp -rfp inventory/sample inventory/mycluster
@ -75,10 +75,11 @@ python -V && pip -V
``` ```
If this returns the version of the software, you're good to go. If not, download and install Python from here <https://www.python.org/downloads/source/> If this returns the version of the software, you're good to go. If not, download and install Python from here <https://www.python.org/downloads/source/>
Install the necessary requirements
Install Ansible according to [Ansible installation guide](/docs/ansible.md#installing-ansible)
then run the following step:
```ShellSession ```ShellSession
sudo pip install -r requirements.txt
vagrant up vagrant up
``` ```

View file

@ -47,6 +47,10 @@ If you need to delete all resources from a resource group, simply call:
**WARNING** this really deletes everything from your resource group, including everything that was later created by you! **WARNING** this really deletes everything from your resource group, including everything that was later created by you!
## Installing Ansible and the dependencies
Install Ansible according to [Ansible installation guide](/docs/ansible.md#installing-ansible)
## Generating an inventory for kubespray ## Generating an inventory for kubespray
After you have applied the templates, you can generate an inventory with this call: After you have applied the templates, you can generate an inventory with this call:
@ -59,6 +63,5 @@ It will create the file ./inventory which can then be used with kubespray, e.g.:
```shell ```shell
cd kubespray-root-dir cd kubespray-root-dir
sudo pip3 install -r requirements.txt
ansible-playbook -i contrib/azurerm/inventory -u devops --become -e "@inventory/sample/group_vars/all/all.yml" cluster.yml ansible-playbook -i contrib/azurerm/inventory -u devops --become -e "@inventory/sample/group_vars/all/all.yml" cluster.yml
``` ```

View file

@ -35,7 +35,7 @@ now six total etcd replicas.
## Requirements ## Requirements
- [Install Terraform](https://www.terraform.io/intro/getting-started/install.html) - [Install Terraform](https://www.terraform.io/intro/getting-started/install.html)
- Install dependencies: `sudo pip install -r requirements.txt` - [Install Ansible dependencies](/docs/ansible.md#installing-ansible)
- Account with Equinix Metal - Account with Equinix Metal
- An SSH key pair - An SSH key pair

View file

@ -50,9 +50,12 @@ Pull over Kubespray and setup any required libraries.
```bash ```bash
git clone https://github.com/kubernetes-sigs/kubespray git clone https://github.com/kubernetes-sigs/kubespray
cd kubespray cd kubespray
sudo pip install -r requirements.txt
``` ```
## Install Ansible
Install Ansible according to [Ansible installation guide](/docs/ansible.md#installing-ansible)
## Cluster Definition ## Cluster Definition
In this example, a new cluster called "alpha" will be created. In this example, a new cluster called "alpha" will be created.

View file

@ -130,7 +130,7 @@ $ git checkout v2.7.0
Previous HEAD position was 8b3ce6e4 bump upgrade tests to v2.5.0 commit (#3087) Previous HEAD position was 8b3ce6e4 bump upgrade tests to v2.5.0 commit (#3087)
HEAD is now at 05dabb7e Fix Bionic networking restart error #3430 (#3431) HEAD is now at 05dabb7e Fix Bionic networking restart error #3430 (#3431)
# NOTE: May need to sudo pip3 install -r requirements.txt when upgrading. # NOTE: May need to `pip3 install -r requirements.txt` when upgrading.
ansible-playbook -i inventory/mycluster/hosts.ini -b upgrade-cluster.yml ansible-playbook -i inventory/mycluster/hosts.ini -b upgrade-cluster.yml