Skip to content
1 change: 1 addition & 0 deletions api/core/v1alpha2/cluster_virtual_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const (
//
// With this resource in the cluster, a container image is created and stored in a dedicated Deckhouse Virtualization Container Registry (DVCR).
//
// **Note:** The `metadata.name` field must comply with [Kubernetes object naming conventions](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/) and must not exceed 48 characters.
// +kubebuilder:object:root=true
// +kubebuilder:metadata:labels={heritage=deckhouse,module=virtualization,backup.deckhouse.io/cluster-config=true}
// +kubebuilder:resource:categories={virtualization-cluster},scope=Cluster,shortName={cvi},singular=clustervirtualimage
Expand Down
4 changes: 3 additions & 1 deletion api/core/v1alpha2/virtual_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ const (

// The VirtualDisk resource describes the desired virtual machine disk configuration. A VirtualDisk can be mounted statically in the virtual machine by specifying it in the `.spec.blockDeviceRefs` disk list, or mounted on-the-fly using the VirtualMachineBlockDeviceAttachments resource.
//
// Once a VirtualDisk is created, only the disk size field `.spec.persistentVolumeClaim.size` can be changed. All other fields are immutable.
// Once a VirtualDisk is created, the following fields in `.spec.persistentVolumeClaim` can be changed: `size` and `storageClassName`. All other fields are immutable.
//
// **Note:** The `metadata.name` field must comply with [Kubernetes object naming conventions](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/) and must not exceed 60 characters.
// +kubebuilder:object:root=true
// +kubebuilder:metadata:labels={heritage=deckhouse,module=virtualization}
// +kubebuilder:resource:categories={virtualization},scope=Namespaced,shortName={vd},singular=virtualdisk
Expand Down
2 changes: 2 additions & 0 deletions api/core/v1alpha2/virtual_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ const (
// > This resource cannot be modified once it has been created.
//
// With this resource in the cluster, a container image is created and stored in a dedicated Deckhouse Virtualization Container Registry (DVCR) or PVC, with the data filled in from the source.
//
// **Note:** The `metadata.name` field must comply with [Kubernetes object naming conventions](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/) and must not exceed 49 characters.
// +genclient
// +kubebuilder:object:root=true
// +kubebuilder:metadata:labels={heritage=deckhouse,module=virtualization}
Expand Down
2 changes: 1 addition & 1 deletion crds/doc-ru-virtualdisks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ spec:
description: |
Ресурс VirtualDisk описывает желаемую конфигурацию диска виртуальной машины. VirtualDisk можно смонтировать в виртуальной машине статически, указав его в списке дисков `.spec.blockDeviceRefs`, или «на лету» – с помощью ресурса VirtualMachineBlockDeviceAttachments.

После создания VirtualDisk можно изменить только размер диска с помощью поля `.spec.persistentVolumeClaim.size`. Все остальные поля изменить нельзя.
После создания VirtualDisk в `.spec.persistentVolumeClaim` можно изменить поля `size` и `storageClassName`. Все остальные поля неизменяемы.

**Важно:** Поле `metadata.name` должно соответствовать [правилам именования объектов Kubernetes](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/) и не должно превышать 60 символов.
properties:
Expand Down
2 changes: 1 addition & 1 deletion crds/virtualdisks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ spec:
description: |-
The VirtualDisk resource describes the desired virtual machine disk configuration. A VirtualDisk can be mounted statically in the virtual machine by specifying it in the `.spec.blockDeviceRefs` disk list, or mounted on-the-fly using the VirtualMachineBlockDeviceAttachments resource.

Once a VirtualDisk is created, only the disk size field `.spec.persistentVolumeClaim.size` can be changed. All other fields are immutable.
Once a VirtualDisk is created, the following fields in `.spec.persistentVolumeClaim` can be changed: `size` and `storageClassName`. All other fields are immutable.

**Note:** The `metadata.name` field must comply with [Kubernetes object naming conventions](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/) and must not exceed 60 characters.
properties:
Expand Down
2 changes: 1 addition & 1 deletion crds/virtualmachineipaddresses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ spec:

* `Pending`: The resource is being created.
* `Bound`: The VirtualMachineIPAddress has been bound to the VirtualMachineIPAddressLease resource.
* `Attached`: The VirtualMachineIPAddress resource has been bound to the VirtualMachine resource.
* `Attached`: The VirtualMachineIPAddress is attached to the VirtualMachine resource.
observedGeneration:
type: integer
description: |
Expand Down
65 changes: 52 additions & 13 deletions docs/ADMIN_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,26 +194,65 @@ Where:
Not available in CE edition.
{{< /alert >}}

{{< alert level="warning" >}}
To set up auditing, the following modules must be enabled:
To enable security event auditing:

- `log-shipper`,
- `runtime-audit-engine`.
{{< /alert >}}
1. Enable `log-shipper` and `runtime-audit-engine` modules.
1. Enable Kubernetes API audit by setting `.spec.settings.apiserver.auditPolicyEnabled: true` in the `control-plane-manager` module.
1. Set `.spec.settings.audit.enabled: true` in the `virtualization` module:

To enable security event auditing, set the module’s `.spec.settings.audit.enabled` parameter to `true`:
```yaml
spec:
settings:
audit:
enabled: true
```

For a complete list of configuration options, see [Configuration](./configuration.html).

Events are collected by the `virtualization-audit-*` pod in the `d8-virtualization` namespace. To forward events to the cluster logging system (e.g., Loki), create a ClusterLoggingConfig:

```yaml
apiVersion: deckhouse.io/v1alpha1
kind: ClusterLoggingConfig
metadata:
name: virtualization-audit-logs
spec:
enabled: true
settings:
audit:
enabled: true
destinationRefs:
- d8-loki
kubernetesPods:
namespaceSelector:
matchNames:
- d8-virtualization
labelSelector:
matchLabels:
app: virtualization-audit
type: KubernetesPods
```

{{< alert level="info" >}}
For a complete list of configuration options, see [Configuration](./configuration.html).
{{< /alert >}}
To view events in Grafana, use a Loki query:

```logql
{namespace="d8-virtualization", pod=~"virtualization-audit-.*"}
```

Available fields in the logs:
- `type`: Event type (Access to VM, VM Management, etc.).
- `name`: Human-readable description.
- `request_subject`: Username or ServiceAccount.
- `datetime`: Event timestamp.
- `virtualmachine_name`: Affected VM.
- `source_ip`: Request source IP (for forbidden operations).

### Security events

The audit system logs the following events:

- Access to VM: Connection via console, VNC, or port forward. Includes VM name, OS, versions, storage, and node address.
- VM Management: Create, update, patch, or delete operations on [VirtualMachine](/modules/virtualization/cr.html#virtualmachine) resources.
- VM Control Operations: Start, stop, restart, migrate, or evict via [VirtualMachineOperation](/modules/virtualization/cr.html#virtualmachineoperation) resource.
- Integrity Check: SHA256 verification of VM configuration. Logs when checksum changes.
- Module Control: Create, update, or delete operations on ModuleConfig.
- Forbidden Operations: Operations blocked by the platform. Includes user, operation, resource, source IP, and denial reason.

## Images

Expand Down
65 changes: 52 additions & 13 deletions docs/ADMIN_GUIDE.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,26 +194,65 @@ spec:
Недоступно в CE-редакции.
{{< /alert >}}

{{< alert level="warning" >}}
Для активации аудита требуется, чтобы были включены следующие модули:
Для активации аудита событий безопасности:

- `log-shipper`,
- `runtime-audit-engine`.
{{< /alert >}}
1. Включить модули `log-shipper` и `runtime-audit-engine`.
1. Включить аудит Kubernetes API, установив `.spec.settings.apiserver.auditPolicyEnabled: true` в модуле `control-plane-manager`.
1. Установить `.spec.settings.audit.enabled: true` в модуле `virtualization`:

```yaml
spec:
settings:
audit:
enabled: true
```

Полный перечень параметров конфигурации приведён в разделе [Настройки](./configuration.html).

Чтобы включить аудит событий безопасности, установите параметр `.spec.settings.audit.enabled` настроек модуля в `true`:
События собираются подом `virtualization-audit-*` в пространстве имён `d8-virtualization`. Чтобы перенаправить события в систему логирования кластера (например, Loki), создайте ClusterLoggingConfig:

```yaml
apiVersion: deckhouse.io/v1alpha1
kind: ClusterLoggingConfig
metadata:
name: virtualization-audit-logs
spec:
enabled: true
settings:
audit:
enabled: true
destinationRefs:
- d8-loki
kubernetesPods:
namespaceSelector:
matchNames:
- d8-virtualization
labelSelector:
matchLabels:
app: virtualization-audit
type: KubernetesPods
```

{{< alert level="info" >}}
Полный перечень параметров конфигурации приведен в разделе [Настройки](./configuration.html).
{{< /alert >}}
Для просмотра событий в Grafana используйте запрос к Loki:

```logql
{namespace="d8-virtualization", pod=~"virtualization-audit-.*"}
```

Доступные поля в логах:
- `type` — тип события (Access to VM, VM Management и т.д.);
- `name` — описание события;
- `request_subject` — username или ServiceAccount;
- `datetime` — время события;
- `virtualmachine_name` — имя ВМ;
- `source_ip` — IP-адрес источника (для запрещённых операций).

### События безопасности

Система аудита фиксирует следующие события:

- Доступ к ВМ — подключение через console, VNC или port forward. Включает имя ВМ, ОС, версии, хранилище и адрес узла.
- Управление ВМ — создание, обновление, изменение или удаление ресурсов [VirtualMachine](/modules/virtualization/cr.html#virtualmachine).
- Управление ВМ через операции — Start, Stop, Restart, Migrate или Evict через ресурс [VirtualMachineOperation](/modules/virtualization/cr.html#virtualmachineoperation).
- Проверка целостности — проверка SHA256 конфигурации ВМ. Логируется при изменении контрольной суммы.
- Управление модулем — создание, обновление или удаление ModuleConfig.
- Запрещённые операции — операции, заблокированные платформой. Включает пользователя, операцию, ресурс, IP-адрес и причину отказа.

## Образы

Expand Down
Loading
Loading