Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proofread getting started chapter #10

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions content/en/docs/getting-started-with-kubevirt/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@ title: "Getting started with KubeVirt"
weight: 1
labfoldernumber: "01"
description: >
Create and run your first Virtual Machine.
Create and run your first virtual machine
---


## Lab Goals
## Lab goals

* Get familiar with the lab environment
* Create your first VM using KubeVirt
* Start and Stop a VM using `virtctl` or `kubectl`
* Connect to the console of the VM
* Start and stop a VM using `virtctl` or `kubectl`
* Connect to the VM's console
* Expose and access ports of your VM
* Changing a file inside of a VM and observe behaviour
* Change a file inside a VM and observe the behaviour


## Folder structure

This is your first lab where you will create and apply files to the kubernetes cluster. It may make sense to structure
your files according to the labs. Feel free to create a folder structure something like
This is your first lab where you will create and apply files to the Kubernetes cluster. It may make sense to structure
your files according to the labs. Feel free to create a folder structure something like this:

```text
{{% param "labsfoldername" %}}
Expand All @@ -30,19 +30,20 @@ your files according to the labs. Feel free to create a folder structure somethi
[...]
```

Make sure you're in the correct directory
```shell
Make sure you're in the correct directory:

```bash
cd {{% param "projecthome" %}}
```

And initialize the lab structure by executing the following command
Initialize the directory structure by executing the following command:

```shell
```bash
mkdir -p {{% param "labsfoldername" %}}/{{% param "labsubfolderprefix" %}}{01..{{% param "maxlabnumber" %}}}/
```

And verify the structure:
Finally, verify the structure:

```shell
```bash
tree {{% param "labsfoldername" %}}
```
26 changes: 14 additions & 12 deletions content/en/docs/getting-started-with-kubevirt/console.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,35 @@ description: >
---


## Console Access
## Console access

If your VM is running you can open a console to the VM using the `virtctl` tool.
If your VM is running, you can open a console on the VM using the `virtctl` tool.

First list your VMs to get the name of your VirtualMachine.
First, list your VMs to get the name of your VirtualMachine:

```shell
```bash
kubectl get vm --namespace=$USER
```

The output should be:

```shell
```bash
NAME AGE STATUS READY
{{% param "labsubfolderprefix" %}}{{% param "labfoldernumber" %}}-firstvm 10m Running True
```


### {{% task %}} Entering the console

Now enter the console with
```shell
Enter the console using:

```bash
virtctl console {{% param "labsubfolderprefix" %}}{{% param "labfoldernumber" %}}-firstvm --namespace=$USER
```

Congratulations. You successfully connected to your VMs console. The expected output is:
Congratulations, you successfully connected to your VMs console! The expected output is:

```shell
```bash
Successfully connected to {{% param "labsubfolderprefix" %}}{{% param "labfoldernumber" %}}-firstvm console. The escape sequence is ^]

login as 'cirros' user. default password: 'gocubsgo'. use 'sudo' for root.
Expand All @@ -45,13 +46,14 @@ training-worker-0 login:
You probably have to hit `Enter` to get to the login prompt.
{{% /alert %}}

Now use the default credentials to login.
You can now use the default credentials to log in:

* User: `cirros`
* Password: `gocubsgo`

And execute a couple of commands
```shell
Try executing a couple of commands, such as:

```bash
whoami
ping acend.ch
```
Expand Down
32 changes: 16 additions & 16 deletions content/en/docs/getting-started-with-kubevirt/create-vm.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ description: >
---


## Creating a Virtual Machine
## Creating a virtual machine

To create a Virtual Machine in our kubernetes cluster we have to create and apply a `VirtualMachine` yaml manifest.
To create a virtual machine in our Kubernetes cluster we have to create and apply a `VirtualMachine` manifest.

This is a very basic example of a bootable virtual machine manifest.
This is a very basic example of a bootable virtual machine manifest:

```yaml
apiVersion: kubevirt.io/v1
Expand All @@ -35,40 +35,40 @@ spec:


{{% alert title="Note" color="info" %}}
A VirtualMachine yaml requires a memory resource specification. Therefore, we always have `spec.domain.resources.requests.memory` set.
A VirtualMachine manifest requires a memory resource specification. Therefore, we always have `spec.domain.resources.requests.memory` set.
You may also use `spec.domain.memory.guest` or `spec.domain.memory.hugepages.size` as a resource specification.
{{% /alert %}}


### {{% task %}} Review VirtualMachine manifest
### {{% task %}} Review the VirtualMachine manifest

Do you see any problems with the specification above? Try to answer the following questions:

* What happens when you run this vm?
* What happens when you run this VM?
* What is required to successfully boot a machine?

{{% details title="Task Hint" %}}
Our created manifest does not contain any bootable devices. Our vm is able to start, but it will just hang as there are
Our created manifest does not contain any bootable devices. Our VM is able to start, but it will just hang as there are
no bootable devices available.

![No bootable device](../no-bootable-device.png)

Having a bootable disk within your yaml specification is all you need to start the vm. However, as there is no network
interface specified which is connected to the underlying network our system would not be capable of interacting with the
Having a bootable disk within the specification is all you need to start the VM. However, as there is no network
interface specified which is connected to the underlying network, our system would not be capable of interacting with the
outside world.
{{% /details %}}


### {{% task %}} Write your own VirtualMachine manifest

Create a new empty file `firstvm.yaml` in the folder `{{% param "labsfoldername" %}}/{{% param "labsubfolderprefix" %}}{{% param "labfoldernumber" %}}/` and copy the `VirtualMachine` manifest from above as a starting point. Starting from the basic manifest you need to add a bootable disk for your vm and a network and interface specification.
To achieve that you need to specify the following parts in the `VirtualMachine` manifest:
Create a new file `firstvm.yaml` in the folder `{{% param "labsfoldername" %}}/{{% param "labsubfolderprefix" %}}{{% param "labfoldernumber" %}}/` and copy the `VirtualMachine` manifest from above as a starting point. You then need to add a bootable disk for your VM and a network and interface specification.
To achieve this you need to specify the following parts in the `VirtualMachine` manifest:

* `spec.template.spec.domain.devices`
* `spec.template.spec.networks`
* `spec.template.spec.volumes`

The easiest way is to use an ephemeral `containerDisk` mountable as a volume. Regarding the network we connect our VM to the underlying kubernetes default network.
The easiest way is to use an ephemeral `containerDisk` mountable as a volume. Regarding the network, we simply connect our VM to the underlying Kubernetes default network:

```yaml
spec:
Expand All @@ -94,8 +94,9 @@ spec:

Make sure you implement the required parts for a container disk and the network interface specification in you VM manifest.

{{% details title="Task Hint: Resulting yaml" %}}
Your VirtualMachine yaml should look like this:
{{% details title="Task hint: Resulting yaml" %}}
Your VirtualMachine definition should look like this:

```yaml
apiVersion: kubevirt.io/v1
kind: VirtualMachine
Expand Down Expand Up @@ -134,7 +135,7 @@ spec:

### {{% task %}} Create the VirtualMachine

Since you have completed the yaml configuration for the VM it's now time to create it our VM in the kubernetes cluster.
It is now time to create the VM on the Kubernetes cluster using the definition you just created:

```shell
kubectl create -f {{% param "labsfoldername" %}}/{{% param "labsubfolderprefix" %}}{{% param "labfoldernumber" %}}/firstvm.yaml --namespace=$USER
Expand All @@ -145,4 +146,3 @@ The output should be:
```shell
virtualmachine.kubevirt.io/{{% param "labsubfolderprefix" %}}{{% param "labfoldernumber" %}}-firstvm created
```

Loading