Skip to content

Commit b0dde67

Browse files
committed
Describe virtual routers functionality
1 parent baec71a commit b0dde67

1 file changed

Lines changed: 118 additions & 0 deletions

File tree

‎content/en/docs/virtualization.md‎

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,3 +334,121 @@ windows.2k22 | Microsoft Windows Server 2022
334334
windows.2k22.virtio | Microsoft Windows Server 2022 (virtio)
335335
windows.2k25 | Microsoft Windows Server 2025
336336
windows.2k25.virtio | Microsoft Windows Server 2025 (virtio)
337+
338+
339+
## Virtual Routers
340+
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.
398+
The virtual router can route traffic between different networks.
399+
400+
## Creating a Virtual Router
401+
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.
406+
407+
## Enabling Virtual Router Functionality for a Tenant
408+
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:
412+
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+
```
416+
417+
- **Restart the Virtual Machine**
418+
419+
```bash
420+
virtctl stop virtual-machine-example
421+
virtctl start virtual-machine-example
422+
```
423+
424+
- **Retrieve the VM IP Address**
425+
426+
```bash
427+
kubectl get vmi
428+
```
429+
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+
```
435+
436+
- **Configure Custom Routes**
437+
438+
Edit the tenant namespace:
439+
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+
```
453+
454+
These custom routes will be applied to all pods within the tenant namespace.

0 commit comments

Comments
 (0)