Skip to content

Commit

Permalink
docs/libvirt: Add dependency installation.
Browse files Browse the repository at this point in the history
Add a few things to the libvirt howto after my first pass runing it:

 - Add dependency installation
 - Renumber sections after inserting new dependency install section
 - Start libvirtd
 - Show how to create the default libvirt storage pool
 - Fix rhcos imgae name
 - Clarify that when running the --permanent commands for firewalld are
   in addition to running the same commands without the flag
 - change reference to ../libvirt.yaml to libvirt.yaml to match where
   the file will be based on past instructions
  • Loading branch information
russellb committed Sep 24, 2018
1 parent 00862d4 commit 80c534b
Showing 1 changed file with 41 additions and 12 deletions.
53 changes: 41 additions & 12 deletions Documentation/dev/libvirt-howto.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,44 @@ for operator development.
### 1. One-time setup
It's expected that you will create and destroy clusters often in the course of development. These steps only need to be run once (or once per RHCOS update).

#### 1.1 Pick a name and ip range
#### 1.1 Install Dependencies and Enable Libvirt
First install some dependencies needed to complete these instructions and then
enable the libvirt daemon.

```sh
sudo dnf copr enable vbatts/bazel
sudo dnf install bazel golang-bin gcc-c++ libvirt-daemon
sudo systemctl start libvirtd
sudo systemctl enable libvirtd
```

Check to see if a default storage pool has been defined in Libvirt by running
`sudo virsh pool-list`. If it does not exist, create it:

```sh
sudo virsh pool-define /dev/stdin <<EOF
<pool type='dir'>
<name>default</name>
<target>
<path>/var/lib/libvirt/images</path>
</target>
</pool>
EOF

sudo virsh pool-start default
sudo virsh pool-autostart default
```

#### 1.2 Pick a name and ip range
In this example, we'll set the baseDomain to `tt.testing`, the name to `test1` and the ipRange to `192.168.124.0/24`

#### 1.2 Clone the repo
#### 1.3 Clone the repo
```sh
git clone https://github.com/openshift/installer.git
cd installer
```

#### 1.3 (Optional) Download and prepare the operating system image
#### 1.4 (Optional) Download and prepare the operating system image

*By default, the installer will download the latest RHCOS image every time it is invoked. This may be problematic for users who create a large number of clusters or who have limited network bandwidth. The installer allows a local image to be used instead.*

Expand All @@ -27,10 +55,10 @@ wget http://aos-ostree.rhev-ci-vms.eng.rdu2.redhat.com/rhcos/images/cloud/latest
gunzip rhcos-qemu.qcow2.gz
```

#### 1.4 Get a pull secret
#### 1.5 Get a pull secret
Go to https://account.coreos.com/ and obtain a Tectonic *pull secret*.

#### 1.5 Make sure you have permisions for `qemu:///system`
#### 1.6 Make sure you have permisions for `qemu:///system`
You may want to grant yourself permissions to use libvirt as a non-root user. You could allow all users in the wheel group by doing the following:
```sh
cat <<EOF >> /etc/polkit-1/rules.d/80-libvirt.rules
Expand All @@ -42,7 +70,7 @@ polkit.addRule(function(action, subject) {
EOF
```

#### 1.6 Configure libvirt to accept TCP connections
#### 1.7 Configure libvirt to accept TCP connections

The Kubernetes [cluster-api](https://github.com/kubernetes-sigs/cluster-api)
components drive deployment of worker machines. The libvirt cluster-api
Expand Down Expand Up @@ -112,9 +140,10 @@ sudo firewall-cmd --zone=FedoraWorkstation --list-sources

NOTE: When the firewall rules are no longer needed, `sudo firewalld-cmd --reload`
will remove the changes made as they were not permanently added. For persistence,
include the `--permanent` to the commands that add-source and add-port.
add `--permanent` to the commands that add-source and add-port and run them a
second time.

#### 1.7 Prepare the configuration file
#### 1.8 Prepare the configuration file
1. `cp examples/libvirt.yaml ./`
2. Edit the configuration file:
1. Set an email and password in the `admin` section
Expand All @@ -123,9 +152,9 @@ include the `--permanent` to the commands that add-source and add-port.
4. Set the `name` (e.g. test1)
5. Look at the `podCIDR` and `serviceCIDR` fields in the `networking` section. Make sure they don't conflict with anything important.
6. Set the `pullSecret` to your JSON pull secret.
7. (Optional) Change the `image` to the file URL of the operating system image you downloaded (e.g. `file:///home/user/Downloads/rhcos.qcow`). This will allow the installer to re-use that image instead of having to download it every time.
7. (Optional) Change the `image` to the file URL of the operating system image you downloaded (e.g. `file:///home/user/Downloads/rhcos-qemu.qcow2`). This will allow the installer to re-use that image instead of having to download it every time.

#### 1.8 Set up NetworkManager DNS overlay
#### 1.9 Set up NetworkManager DNS overlay
This step is optional, but useful for being able to resolve cluster-internal hostnames from your host.
1. Edit `/etc/NetworkManager/NetworkManager.conf` and set `dns=dnsmasq` in section `[main]`
2. Tell dnsmasq to use your cluster. The syntax is `server=/<baseDomain>/<firstIP>`. For this example:
Expand All @@ -134,7 +163,7 @@ echo server=/tt.testing/192.168.124.1 | sudo tee /etc/NetworkManager/dnsmasq.d/t
```
3. `systemctl restart NetworkManager`

#### 1.9 Install the terraform provider
#### 1.10 Install the terraform provider
1. Make sure you have the `virsh` binary installed: `sudo dnf install libvirt-client libvirt-devel`
2. Install the libvirt terraform provider:
```sh
Expand Down Expand Up @@ -163,7 +192,7 @@ alias tectonic="${PWD}/tectonic-dev/installer/tectonic"

Initialize (the environment variables are a convenience):
```sh
tectonic init --config=../libvirt.yaml
tectonic init --config=libvirt.yaml
export CLUSTER_NAME=<the cluster name>
export BASE_DOMAIN=<the base domain>
```
Expand Down

0 comments on commit 80c534b

Please sign in to comment.