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

Add feedback for lab 1 and fix filename lab 2 #1

Merged
merged 1 commit into from
Sep 3, 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
118 changes: 74 additions & 44 deletions content/en/docs/01/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ description: >

## Login

{{% alert title="Note" color="info" %}} Authentication depends on the specific Kubernetes cluster environment. You may need special instructions if you are not using our lab environment. Details will be provided by your teacher. {{% /alert %}}
{{% alert title="Note" color="info" %}} Authentication depends on the specific Kubernetes cluster environment. The **URL** and **Credentials** to access the lab environment will provided by the teacher. Use Chrome for the best experience.{{% /alert %}}


## Webshell

The first thing we're going to do is to explore our lab environment and get in touch with the different components.

The provided lab environment contains an _Eclipse Theia IDE_[^1]. Your IDE will look something like this:

![Eclipse Theia IDE](theia.png)
Expand All @@ -23,40 +25,38 @@ The provided lab environment contains an _Eclipse Theia IDE_[^1]. Your IDE will
* The Terminal is accessible using `Ctrl+Shit+^` or using the Menubar `Terminal > New Terminal`

The available environment in the webshell contains all the needed tools like `kubectl` and `virtctl` as well as
the configuration needed to access the kubernetes cluster. If you have a terminal running you can interact with the
kubernetes cluster. For example, you can list your context or get the pods of the current namespace:
the configuration needed to access the kubernetes cluster.

Let's verify that by executing the following command in a freshly created terminal window:

```shell
theia(user4) /home/project $ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
local local local user4

theia(user4) /home/project $ kubectl get pods
NAME READY STATUS RESTARTS AGE
user4-webshell-885dbc579-lwhtd 2/2 Running 0 11d
kubectl version
```

The files in the home directory under `/home/project` are stored in a persistence volume, so please make sure to store all your persistence data in this directory and use it as starting point for all our lab files.
You can create files within your webshell or using the file explorer. Using the shell they will show up in the file
explorer and vice versa. Your workplace is persistent and is available for the whole training duration.

explorer and vice versa.

### Exiting a console of a virtual machine

In various labs we will connect to the console of a virtual machine using the `virtctl console`. Your terminal will look like this:
If you have a terminal running you can interact with the
kubernetes cluster. For example, you can list your context or get the pods of the current namespace:

```shell
virtctl console kubevirtvm
kubectl config get-contexts
```

When the terminal is connected to the virtual machine vm the following line appears:
should result in something like this:
```shell
Successfully connected to kubevirtvm console. The escape sequence is ^
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
local local local <user>
```

This simple escape sequence `^` does not work within the webshell terminal. You have the following options to exit the console:

* Press `Ctrl+AltGr+]]` (yes, press `]` twice)
* Close the webshell terminal and open a new one with `Ctrl+Shift+^`
```shell
kubectl get pods --namespace=$USER
```
will show that the current webshell is also running as pod within your namespace:
```shell
NAME READY STATUS RESTARTS AGE
<user>-webshell-885dbc579-lwhtd 2/2 Running 0 11d
```


## Namespace
Expand All @@ -67,37 +67,36 @@ We're going to use the following Namespace for the labs

Alternatively there is a namespace `<user>-dev` available.

{{% alert title="Note" color="info" %}}
By using the following command, you can switch into another Namespace instead of specifying it for each `kubectl` command.

```bash
kubectl config set-context $(kubectl config current-context) --namespace <namespace>
```
## General Lab Notes

If you get the following error from the command above you first have to initially set your current context:
```shell
error: current-context is not set
error: you must specify a non-empty context name or --current
```

Set the current context with:
```shell
kubectl config use-context local
```
### Placeholders

Some prefer to explicitly select the Namespace for each `kubectl` command by adding `--namespace <namespace>` or `-n <namespace>`.
{{% /alert %}}
In this lab we will use the following placeholders or naming conventions:

* `<user>` your username (for example `user4`)
* `$USER` the environment variable containing your username. Execute `echo $USER` to verify that in your terminal session
* `[...]` means that some lines in the listing or command have been omitted for readability.

## General Lab Notes

### Exiting a console of a virtual machine

### Placeholders
In various labs we will connect to the console of a virtual machine using the `virtctl console`. Your terminal will look like this:

In this lab we will use the following placeholders or naming conventions:
```shell
virtctl console kubevirtvm
```

* `$USER` your username (for example `user4`)
* `[...]` means that some lines in the listing or command have been omitted for readability.
When the terminal is connected to the virtual machine vm the following line appears:
```shell
Successfully connected to kubevirtvm console. The escape sequence is ^
```

This simple escape sequence `^` does not work within the webshell terminal. You have the following options to exit the console:

* Press `Ctrl+AltGr+]]` (yes, press `]` twice)
* Close the webshell terminal and open a new one with `Ctrl+Shift+^`


### Hints
Expand Down Expand Up @@ -125,6 +124,37 @@ status: {}
{{% /details %}}


### Using Kubernetes Context instead of explicitly specifying the namespace

In our labs we specify the namespace for the commands explicitly by the `--namespace` parameter.

{{% alert title="Note" color="info" %}}

Some engineers prefer to use the context by using the following commands:

```bash
kubectl config set-context $(kubectl config current-context) --namespace $USER
```

If you get the following error from the command above you first have to initially set your current context:
```shell
error: current-context is not set
error: you must specify a non-empty context name or --current
```

Set the current context with:
```shell
kubectl config use-context local
```

And repeat the following command:

```bash
kubectl config set-context $(kubectl config current-context) --namespace $USER
```
{{% /alert %}}


### Highlighting important things

We will use the following styling to highlight various things.
Expand Down
2 changes: 1 addition & 1 deletion content/en/docs/02/21_create-vm.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ spec:
Since you have completed the yaml configuration for the VM it's now time to create it our VM in the kubernetes cluster.

```shell
kubectl create -f {{% param "labsubfolderprefix" %}}{{% param "labfoldernumber" %}}-firstvm.yaml
kubectl create -f vm_{{% param "labsubfolderprefix" %}}{{% param "labfoldernumber" %}}-firstvm.yaml
```

The output should be:
Expand Down
Loading