Skip to content
Draft
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
158 changes: 158 additions & 0 deletions docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,10 @@ spec:

Cloud-Init is a tool for automatically configuring virtual machines on first boot. The configuration is written in YAML format and must start with the `#cloud-config` header.

{{< alert level="warning" >}}
When using cloud images (for example, official images from distributions), you must provide a cloud-init configuration. Without it, on some distributions, network connectivity is not configured, and the virtual machine becomes unavailable on the network, even if the main network (Main) is connected. In addition, cloud images do not allow login by default — you must either add SSH keys for the default user or create a new user with SSH access. Without this, it will be impossible to access the virtual machine.
{{< /alert >}}

### Updating and installing packages

Example configuration for updating the system and installing packages:
Expand Down Expand Up @@ -439,6 +443,96 @@ mounts:
- ["/dev/sdb1", "/mnt/data", "ext4", "defaults", "0", "2"]
```

### Configuring network interfaces for additional networks

For more information on connecting additional networks to a virtual machine, see the [Additional network interfaces](./user_guide.html#additional-network-interfaces) section.

{{< alert level="warning" >}}
The settings described in this section apply only to additional networks. The main network (Main) is configured automatically via cloud-init and does not require manual configuration.
{{< /alert >}}

If additional networks are connected to a virtual machine, they must be configured manually via cloud-init. Use `write_files` to create configuration files and `runcmd` to apply the settings.

#### For systemd-networkd

```yaml
#cloud-config
write_files:
- path: /etc/systemd/network/10-eth1.network
content: |
[Match]
Name=eth1

[Network]
Address=192.168.1.10/24
Gateway=192.168.1.1
DNS=8.8.8.8

runcmd:
- systemctl restart systemd-networkd
```

#### For Netplan (Ubuntu)

```yaml
#cloud-config
write_files:
- path: /etc/netplan/99-custom.yaml
content: |
network:
version: 2
ethernets:
eth1:
addresses:
- 10.0.0.5/24
gateway4: 10.0.0.1
nameservers:
addresses: [8.8.8.8]
eth2:
dhcp4: true

runcmd:
- netplan apply
```

#### For ifcfg (RHEL/CentOS)

```yaml
#cloud-config
write_files:
- path: /etc/sysconfig/network-scripts/ifcfg-eth1
content: |
DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.1.10
PREFIX=24
GATEWAY=192.168.1.1
DNS1=8.8.8.8

runcmd:
- nmcli connection reload
- nmcli connection up eth1
```

#### For Alpine Linux

```yaml
#cloud-config
write_files:
- path: /etc/network/interfaces
append: true
content: |
auto eth1
iface eth1 inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1

runcmd:
- /etc/init.d/networking restart
```

## How to use Ansible to provision virtual machines?

[Ansible](https://docs.ansible.com/ansible/latest/index.html) is an automation tool that helps you to run tasks on remote servers via SSH. In this example, we will show you how to use Ansible to manage virtual machines in a demo-app project.
Expand Down Expand Up @@ -823,3 +917,67 @@ A golden image is a pre-configured virtual machine image that can be used to qui
```

After completing these steps, you will have a golden image that can be used to quickly create new virtual machines with pre-installed software and configurations.

## How to restore the cluster if images from registry.deckhouse.io cannot be pulled after a license change?

After a license change on a cluster with `containerd v1` and removal of the outdated license, images from `registry.deckhouse.io` may stop being pulled. In that case, nodes still have the outdated config file `/etc/containerd/conf.d/dvcr.toml`, which is not removed automatically. Because of it, the `registry` module does not start, and without it DVCR does not work.

To fix this, apply a NodeGroupConfiguration (NGC) manifest: it will remove the file on the nodes. After the `registry` module starts, remove the manifest, since this is a one-time fix.

1. Save the manifest to a file (for example, `containerd-dvcr-remove-old-config.yaml`):

```yaml
apiVersion: deckhouse.io/v1alpha1
kind: NodeGroupConfiguration
metadata:
name: containerd-dvcr-remove-old-config.sh
spec:
weight: 32 # Must be in range 32–90
nodeGroups: ["*"]
bundles: ["*"]
content: |
# Copyright 2023 Flant JSC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

rm -f /etc/containerd/conf.d/dvcr.toml
```

1. Apply the manifest:

```bash
d8 k apply -f containerd-dvcr-remove-old-config.yaml
```

1. Verify that the `registry` module is running:

```bash
d8 k -n d8-system -o yaml get secret registry-state | yq -C -P '.data | del .state | map_values(@base64d) | .conditions = (.conditions | from_yaml)'
```

Example output when the `registry` module is running:

```yaml
conditions:
# ...
- lastTransitionTime: "..."
message: ""
reason: ""
status: "True"
type: Ready
```

1. Delete the NGC manifest:

```bash
d8 k delete -f containerd-dvcr-remove-old-config.yaml
```

For more information on migration, see [Migrating container runtime to containerd v2](/products/virtualization-platform/documentation/admin/platform-management/platform-scaling/node/migrating.html).
160 changes: 158 additions & 2 deletions docs/FAQ.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,10 @@ spec:

Cloud-Init — это инструмент для автоматической настройки виртуальных машин при первом запуске. Конфигурация записывается в формате YAML и должна начинаться с заголовка `#cloud-config`.

{{< alert level="warning" >}}
При использовании cloud-образов (например, официальных образов от дистрибутивов) необходимо обязательно предоставить конфигурацию cloud-init. Без неё на некоторых дистрибутивах не настраивается сетевое подключение, и виртуальная машина становится недоступна в сети, даже если подключена основная сеть (Main). Кроме того, в cloud-образах по умолчанию отсутствует возможность входа в систему — необходимо либо добавить SSH-ключи для пользователя по умолчанию, либо создать нового пользователя с SSH-доступом. Без этого войти в виртуальную машину будет невозможно.
{{< /alert >}}

### Обновление и установка пакетов

Пример конфигурации для обновления системы и установки пакетов:
Expand Down Expand Up @@ -436,6 +440,94 @@ mounts:
- ["/dev/sdb1", "/mnt/data", "ext4", "defaults", "0", "2"]
```

### Настройка сетевых интерфейсов для дополнительных сетей

Подробнее о подключении дополнительных сетей к виртуальной машине см. в разделе [Дополнительные сетевые интерфейсы](./user_guide.html#дополнительные-сетевые-интерфейсы).

{{< alert level="warning" >}}
Настройки, описанные в этом разделе, применяются только для дополнительных сетей. Основная сеть (Main) настраивается автоматически через cloud-init и не требует ручной конфигурации.
{{< /alert >}}

#### Для systemd-networkd

```yaml
#cloud-config
write_files:
- path: /etc/systemd/network/10-eth1.network
content: |
[Match]
Name=eth1

[Network]
Address=192.168.1.10/24
Gateway=192.168.1.1
DNS=8.8.8.8

runcmd:
- systemctl restart systemd-networkd
```

#### Для Netplan (Ubuntu)

```yaml
#cloud-config
write_files:
- path: /etc/netplan/99-custom.yaml
content: |
network:
version: 2
ethernets:
eth1:
addresses:
- 10.0.0.5/24
gateway4: 10.0.0.1
nameservers:
addresses: [8.8.8.8]
eth2:
dhcp4: true

runcmd:
- netplan apply
```

#### Для ifcfg (RHEL/CentOS)

```yaml
#cloud-config
write_files:
- path: /etc/sysconfig/network-scripts/ifcfg-eth1
content: |
DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.1.10
PREFIX=24
GATEWAY=192.168.1.1
DNS1=8.8.8.8

runcmd:
- nmcli connection reload
- nmcli connection up eth1
```

#### Для Alpine Linux

```yaml
#cloud-config
write_files:
- path: /etc/network/interfaces
append: true
content: |
auto eth1
iface eth1 inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1

runcmd:
- /etc/init.d/networking restart
```

## Как использовать Ansible для конфигурирования виртуальных машин?

[Ansible](https://docs.ansible.com/ansible/latest/index.html) — это инструмент автоматизации, который позволяет выполнять задачи на удаленных серверах с использованием протокола SSH. В данном примере мы рассмотрим, как использовать Ansible для управления виртуальными машинами расположенных в проекте demo-app.
Expand Down Expand Up @@ -490,7 +582,7 @@ ansible -m shell -a "uptime" \
{{< /alert >}}

{{< alert level="warning" >}}
Команда работает только для виртуальных машин, у которых подключена основная сеть кластера (Main).
Команда работает только для виртуальных машин, у которых подключена основная сеть кластера (Main).
{{< /alert >}}

Вместо ручного создания inventory-файла можно использовать команду `d8 v ansible-inventory`, которая автоматически генерирует инвентарь Ansible из виртуальных машин в указанном неймспейсе. Команда совместима с интерфейсом [ansible inventory script](https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#inventory-scripts).
Expand All @@ -500,7 +592,7 @@ ansible -m shell -a "uptime" \
При необходимости настройте переменные хоста через аннотации (например, пользователя для SSH):

```bash
d8 k -n demo-app annotate vm frontend provisioning.virtualization.deckhouse.io/ansible_user="cloud"
d8 k -n demo-app annotate vm frontend provisioning.virtualization.deckhouse.io/ansible_user="cloud"
```

Используйте команду напрямую:
Expand Down Expand Up @@ -822,3 +914,67 @@ Golden image — это предварительно настроенный об
```

После выполнения этих шагов у вас будет golden image, который можно использовать для быстрого создания новых виртуальных машин с предустановленным программным обеспечением и настройками.

## Как восстановить кластер, если после смены лицензии образы из registry.deckhouse.io не загружаются?

После смены лицензии на кластере с `containerd v1` и удаления устаревшей лицензии образы из `registry.deckhouse.io` могут перестать загружаться. При этом на узлах остаётся устаревший файл конфигурации `/etc/containerd/conf.d/dvcr.toml`, который не удаляется автоматически. Из-за него не запускается модуль `registry`, без которого не работает DVCR.

Чтобы это исправить, примените манифест NodeGroupConfiguration (NGC): он удалит файл на узлах. После запуска модуля `registry` манифест нужно удалить, так как это разовое исправление.

1. Сохраните манифест в файл (например, `containerd-dvcr-remove-old-config.yaml`):

```yaml
apiVersion: deckhouse.io/v1alpha1
kind: NodeGroupConfiguration
metadata:
name: containerd-dvcr-remove-old-config.sh
spec:
weight: 32 # Должен быть в диапазоне 32–90
nodeGroups: ["*"]
bundles: ["*"]
content: |
# Copyright 2023 Flant JSC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

rm -f /etc/containerd/conf.d/dvcr.toml
```

1. Примените манифест:

```bash
d8 k apply -f containerd-dvcr-remove-old-config.yaml
```

1. Проверьте, что модуль `registry` запущен:

```bash
d8 k -n d8-system -o yaml get secret registry-state | yq -C -P '.data | del .state | map_values(@base64d) | .conditions = (.conditions | from_yaml)'
```

Пример вывода при успешном запуске:

```yaml
conditions:
# ...
- lastTransitionTime: "..."
message: ""
reason: ""
status: "True"
type: Ready
```

1. Удалите манифест NGC:

```bash
d8 k delete -f containerd-dvcr-remove-old-config.yaml
```

Подробнее о миграции см. в статье [Миграция container runtime на containerd v2](/products/virtualization-platform/documentation/admin/platform-management/platform-scaling/node/migrating.html).
Loading
Loading