Skip to content

Commit 0fe3bbf

Browse files
committed
docs: creating a virtual router
Signed-off-by: Nick Volynkin <[email protected]>
1 parent b0dde67 commit 0fe3bbf

1 file changed

Lines changed: 44 additions & 99 deletions

File tree

‎content/en/docs/virtualization.md‎

Lines changed: 44 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -338,117 +338,62 @@ windows.2k25.virtio | Microsoft Windows Server 2025 (virtio)
338338

339339
## Virtual Routers
340340

341-
Since version v0.27.0, Cozystack provides a virtual routers functionality.
342-
This feature allows you to create a virtual router that can be used to route traffic between different networks.
343-
Virtual router backed by a virtual machine instance with a special configuration.
344-
345-
346-
### Virtual Router Creation
347-
348-
You can create a virtual machine instance using standard `vm-instance` and `virtual-machine` packages.
349-
Later, you need to contact your administrator to enable the virtual router functionality for this instance.
350-
351-
### Enabling Virtual Router functionality for the Tenant
352-
353-
These actions should be done by Cozystack administrator and are not available for end-users yet.
354-
355-
First, you need to disable anti-spoofiging protection for the vm-instance:
356-
357-
```
358-
kubectl patch virtualmachines.kubevirt.io virtual-machine-example --type=merge -p '{"spec":{"template":{"metadata":{"annotations":{"ovn.kubernetes.io/port_security": "false"}}}}}'
359-
```
360-
361-
Then restart the virtual machine:
362-
363-
```
364-
virtctl stop virtual-machine-example
365-
virtctl start virtual-machine-example
366-
```
367-
368-
Get IP-address for your virtual router:
369-
```
370-
kubectl get vmi
371-
```
372-
373-
After that you can configure custom routes for the tenant namespace:
374-
375-
Run
376-
377-
```
378-
kubectl edit namespace tenant-example
379-
```
380-
381-
382-
and add annotation as following:
383-
```
384-
ovn.kubernetes.io/routes: |
385-
[{
386-
"dst": "10.10.13.0/24",
387-
"gw": "10.244.3.12"
388-
}]
389-
```
390-
391-
Custom routes will be applied to all pods in the tenant namespace.
392-
393-
394-
## Virtual Routers
395-
396-
Starting with version v0.27.0, Cozystack provides virtual router functionality.
397-
This feature allows you to create a virtual router backed by a specialized virtual machine instance.
341+
Starting with version [v0.27.0](https://github.com/cozystack/cozystack/releases/tag/v0.27.0),
342+
Cozystack can deploy virtual routers (also known as "router appliances" or "middlebox appliances").
343+
This feature allows you to create a virtual router based on a virtual machine instance.
398344
The virtual router can route traffic between different networks.
399345

400-
## Creating a Virtual Router
346+
### Creating a Virtual Router
401347

402-
- **Create a VM Instance**
403-
Use the standard vm-instance and virtual-machine packages to create a virtual machine instance.
404-
- **Request Virtual Router Enablement**
405-
After you have created the VM instance, contact your administrator to enable the virtual router functionality for that instance.
348+
Creating a virtual router requires a Cozystack administrator account.
406349

407-
## Enabling Virtual Router Functionality for a Tenant
350+
1. **Create a VM Instance**<br/>
351+
Use the standard `vm-instance` and `virtual-machine` packages to create a virtual machine instance.
352+
353+
1. **Disable Anti-Spoofing Protection**<br/>
354+
To act as a virtual router, the VM instance should have anti-spoofing protection disabled:
408355

409-
The following steps must be performed by a Cozystack administrator. They are not currently available to end users.
410-
- **Disable Anti-Spoofing Protection**
411-
Run the following command to disable anti-spoofing protection for the VM instance:
356+
```bash
357+
kubectl patch virtualmachines.kubevirt.io virtual-machine-example --type=merge \
358+
-p '{"spec":{"template":{"metadata":{"annotations":{"ovn.kubernetes.io/port_security": "false"}}}}}'
359+
```
412360

413-
```bash
414-
kubectl patch virtualmachines.kubevirt.io virtual-machine-example --type=merge -p '{"spec":{"template":{"metadata":{"annotations":{"ovn.kubernetes.io/port_security": "false"}}}}}'
415-
```
361+
1. **Restart the Virtual Machine**
416362

417-
- **Restart the Virtual Machine**
363+
```bash
364+
virtctl stop virtual-machine-example
365+
virtctl start virtual-machine-example
366+
```
418367

419-
```bash
420-
virtctl stop virtual-machine-example
421-
virtctl start virtual-machine-example
422-
```
368+
1. **Retrieve the IP Address of the VM**
423369

424-
- **Retrieve the VM IP Address**
370+
```bash
371+
kubectl get vmi
372+
```
425373

426-
```bash
427-
kubectl get vmi
428-
```
374+
The output will have a line with the new VM's IP address:
429375
430-
The output would be similar to the following:
431-
```console
432-
NAME AGE PHASE IP NODENAME READY
433-
virtual-machine-example 3d4h Running 10.244.8.56 gld-csxhk-003 True
434-
```
376+
```console
377+
NAME AGE PHASE IP NODENAME READY
378+
virtual-machine-example 3d4h Running 10.244.8.56 gld-csxhk-003 True
379+
```
435380
436-
- **Configure Custom Routes**
381+
1. **Configure Custom Routes for a Tenant**<br/>
382+
Edit the tenant namespace:
437383
438-
Edit the tenant namespace:
384+
```bash
385+
kubectl edit namespace tenant-example
386+
```
439387
440-
```bash
441-
kubectl edit namespace tenant-example
442-
```
443-
444-
Add the following annotation:
445-
446-
```yaml
447-
ovn.kubernetes.io/routes: |
448-
[{
449-
"dst": "10.10.13.0/24",
450-
"gw": "10.244.8.56"
451-
}]
452-
```
388+
Add the following annotation using the router IP you found earlier as `gw`
389+
and the subnet mask for the router to handle as `dst`:
390+
391+
```yaml
392+
ovn.kubernetes.io/routes: |
393+
[{
394+
"gw": "10.244.8.56",
395+
"dst": "10.10.13.0/24"
396+
}]
397+
```
453398
454-
These custom routes will be applied to all pods within the tenant namespace.
399+
These custom routes will now be applied to all pods within the tenant namespace.

0 commit comments

Comments
 (0)