Skip to content

Commit

Permalink
docs: update hyper-v
Browse files Browse the repository at this point in the history
Some clarifications and rewording.

Signed-off-by: suse-coder <wayootest003@protonmail.com>
Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
  • Loading branch information
suse-coder authored and smira committed Jan 31, 2025
1 parent b716561 commit aea90cb
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,73 +5,75 @@ aliases:
- ../../../virtualized-platforms/hyper-v
---

## Pre-requisities
## Prerequisites

1. Download the latest `metal-amd64.iso` ISO from github [releases page](https://github.com/siderolabs/talos/releases)
2. Create a New-TalosVM folder in any of your PS Module Path folders `$env:PSModulePath -split ';'` and save the [New-TalosVM.psm1](https://github.com/nebula-it/New-TalosVM/blob/main/Talos/1.0.0/Talos.psm1) there
1. Download the latest `metal-amd64.iso` from the [GitHub releases page](https://github.com/siderolabs/talos/releases).
2. Create a `New-TalosVM` folder in one of your PS Module Path folders (`$env:PSModulePath -split ';'`) and save the [New-TalosVM.psm1](https://github.com/nebula-it/New-TalosVM/blob/main/Talos/1.0.0/Talos.psm1) there.

## Plan Overview

Here we will create a basic 3 node cluster with a single control-plane node and two worker nodes.
The only difference between control plane and worker node is the amount of RAM and an additional storage VHD.
This is personal preference and can be configured to your liking.
We will create a basic 3-node cluster with one control-plane node and two worker nodes.
The main difference between the control plane and worker nodes is the amount of RAM and an additional storage VHD for the worker nodes.
This can be customized to your preference.

We are using a `VMNamePrefix` argument for a VM Name prefix and not the full hostname.
This command will find any existing VM with that prefix and "+1" the highest suffix it finds.
For example, if VMs `talos-cp01` and `talos-cp02` exist, this will create VMs starting from `talos-cp03`, depending on NumberOfVMs argument.
We use a `VMNamePrefix` argument for the VM name prefix, not the full hostname.
This command will find any existing VM with that prefix and increment the highest suffix found.
For example, if `talos-cp01` and `talos-cp02` exist, it will create VMs starting from `talos-cp03`, depending on the `NumberOfVMs` argument.

## Setup a Control Plane Node

Use the following command to create a single control plane node:
> Note: Ensure the `LAB` adapter exists in Hyper-V and is set to external.
Create a single control plane node with the following command:

```powershell
New-TalosVM -VMNamePrefix talos-cp -CPUCount 2 -StartupMemory 4GB -SwitchName LAB -TalosISOPath C:\ISO\metal-amd64.iso -NumberOfVMs 1 -VMDestinationBasePath 'D:\Virtual Machines\Test VMs\Talos'
```

This will create `talos-cp01` VM and power it on.
This will create the `talos-cp01` VM and power it on.

## Setup Worker Nodes

Use the following command to create 2 worker nodes:
Create two worker nodes with the following command:

```powershell
New-TalosVM -VMNamePrefix talos-worker -CPUCount 4 -StartupMemory 8GB -SwitchName LAB -TalosISOPath C:\ISO\metal-amd64.iso -NumberOfVMs 2 -VMDestinationBasePath 'D:\Virtual Machines\Test VMs\Talos' -StorageVHDSize 50GB
```

This will create two VMs: `talos-worker01` and `talos-worker02` and attach an additional VHD of 50GB for storage (which in my case will be passed to Mayastor).
This will create `talos-worker01` and `talos-worker02` VMs, each with an additional 50GB VHD for storage (which can be used for Mayastor).

## Pushing Config to the Nodes
## Push Config to the Nodes

Now that our VMs are ready, find their IP addresses from console of VM.
With that information, push config to the control plane node with:
Once the VMs are ready, find their IP addresses from the VM console.
Push the config to the control plane node with:

```powershell
# set control plane IP variable
# Set control plane IP variable
$CONTROL_PLANE_IP='10.10.10.x'
# Generate talos config
# Generate Talos config
talosctl gen config talos-cluster https://$($CONTROL_PLANE_IP):6443 --output-dir .
# Apply config to control plane node
talosctl apply-config --insecure --nodes $CONTROL_PLANE_IP --file .\controlplane.yaml
```

## Pushing Config to Worker Nodes
## Push Config to Worker Nodes

Similarly, for the workers:
Similarly, for the worker nodes:

```powershell
talosctl apply-config --insecure --nodes 10.10.10.x --file .\worker.yaml
```

Apply the config to both nodes.
Apply the config to both worker nodes.

## Bootstrap Cluster

Now that our nodes are ready, we are ready to bootstrap the Kubernetes cluster.
With the nodes ready, bootstrap the Kubernetes cluster:

```powershell
# Use following command to set node and endpoint permanantly in config so you dont have to type it everytime
# Set node and endpoint permanently in config
talosctl config endpoint $CONTROL_PLANE_IP
talosctl config node $CONTROL_PLANE_IP
Expand All @@ -82,4 +84,9 @@ talosctl bootstrap
talosctl kubeconfig .
```

This will generate the `kubeconfig` file, you can use to connect to the cluster.
## Remove ISO

After a successful bootstrap, remove the ISO from the Hyper-V instances (both worker and control plane).
Otherwise, Talos might fail to boot.

This will generate the `kubeconfig` file, which you can use to connect to the cluster.
Original file line number Diff line number Diff line change
Expand Up @@ -5,73 +5,75 @@ aliases:
- ../../../virtualized-platforms/hyper-v
---

## Pre-requisities
## Prerequisites

1. Download the latest `metal-amd64.iso` ISO from github [releases page](https://github.com/siderolabs/talos/releases)
2. Create a New-TalosVM folder in any of your PS Module Path folders `$env:PSModulePath -split ';'` and save the [New-TalosVM.psm1](https://github.com/nebula-it/New-TalosVM/blob/main/Talos/1.0.0/Talos.psm1) there
1. Download the latest `metal-amd64.iso` from the [GitHub releases page](https://github.com/siderolabs/talos/releases).
2. Create a `New-TalosVM` folder in one of your PS Module Path folders (`$env:PSModulePath -split ';'`) and save the [New-TalosVM.psm1](https://github.com/nebula-it/New-TalosVM/blob/main/Talos/1.0.0/Talos.psm1) there.

## Plan Overview

Here we will create a basic 3 node cluster with a single control-plane node and two worker nodes.
The only difference between control plane and worker node is the amount of RAM and an additional storage VHD.
This is personal preference and can be configured to your liking.
We will create a basic 3-node cluster with one control-plane node and two worker nodes.
The main difference between the control plane and worker nodes is the amount of RAM and an additional storage VHD for the worker nodes.
This can be customized to your preference.

We are using a `VMNamePrefix` argument for a VM Name prefix and not the full hostname.
This command will find any existing VM with that prefix and "+1" the highest suffix it finds.
For example, if VMs `talos-cp01` and `talos-cp02` exist, this will create VMs starting from `talos-cp03`, depending on NumberOfVMs argument.
We use a `VMNamePrefix` argument for the VM name prefix, not the full hostname.
This command will find any existing VM with that prefix and increment the highest suffix found.
For example, if `talos-cp01` and `talos-cp02` exist, it will create VMs starting from `talos-cp03`, depending on the `NumberOfVMs` argument.

## Setup a Control Plane Node

Use the following command to create a single control plane node:
> Note: Ensure the `LAB` adapter exists in Hyper-V and is set to external.
Create a single control plane node with the following command:

```powershell
New-TalosVM -VMNamePrefix talos-cp -CPUCount 2 -StartupMemory 4GB -SwitchName LAB -TalosISOPath C:\ISO\metal-amd64.iso -NumberOfVMs 1 -VMDestinationBasePath 'D:\Virtual Machines\Test VMs\Talos'
```

This will create `talos-cp01` VM and power it on.
This will create the `talos-cp01` VM and power it on.

## Setup Worker Nodes

Use the following command to create 2 worker nodes:
Create two worker nodes with the following command:

```powershell
New-TalosVM -VMNamePrefix talos-worker -CPUCount 4 -StartupMemory 8GB -SwitchName LAB -TalosISOPath C:\ISO\metal-amd64.iso -NumberOfVMs 2 -VMDestinationBasePath 'D:\Virtual Machines\Test VMs\Talos' -StorageVHDSize 50GB
```

This will create two VMs: `talos-worker01` and `talos-worker02` and attach an additional VHD of 50GB for storage (which in my case will be passed to Mayastor).
This will create `talos-worker01` and `talos-worker02` VMs, each with an additional 50GB VHD for storage (which can be used for Mayastor).

## Pushing Config to the Nodes
## Push Config to the Nodes

Now that our VMs are ready, find their IP addresses from console of VM.
With that information, push config to the control plane node with:
Once the VMs are ready, find their IP addresses from the VM console.
Push the config to the control plane node with:

```powershell
# set control plane IP variable
# Set control plane IP variable
$CONTROL_PLANE_IP='10.10.10.x'
# Generate talos config
# Generate Talos config
talosctl gen config talos-cluster https://$($CONTROL_PLANE_IP):6443 --output-dir .
# Apply config to control plane node
talosctl apply-config --insecure --nodes $CONTROL_PLANE_IP --file .\controlplane.yaml
```

## Pushing Config to Worker Nodes
## Push Config to Worker Nodes

Similarly, for the workers:
Similarly, for the worker nodes:

```powershell
talosctl apply-config --insecure --nodes 10.10.10.x --file .\worker.yaml
```

Apply the config to both nodes.
Apply the config to both worker nodes.

## Bootstrap Cluster

Now that our nodes are ready, we are ready to bootstrap the Kubernetes cluster.
With the nodes ready, bootstrap the Kubernetes cluster:

```powershell
# Use following command to set node and endpoint permanantly in config so you dont have to type it everytime
# Set node and endpoint permanently in config
talosctl config endpoint $CONTROL_PLANE_IP
talosctl config node $CONTROL_PLANE_IP
Expand All @@ -82,4 +84,9 @@ talosctl bootstrap
talosctl kubeconfig .
```

This will generate the `kubeconfig` file, you can use to connect to the cluster.
## Remove ISO

After a successful bootstrap, remove the ISO from the Hyper-V instances (both worker and control plane).
Otherwise, Talos might fail to boot.

This will generate the `kubeconfig` file, which you can use to connect to the cluster.

0 comments on commit aea90cb

Please sign in to comment.