Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
62 changes: 24 additions & 38 deletions docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -396,64 +396,50 @@ ansible -m shell -a "uptime" \

## How to redirect traffic to a virtual machine?

Since the virtual machine runs in a Kubernetes cluster, the forwarding of network traffic to it is done similarly to the forwarding of traffic to the pods.
The virtual machine operates within a Kubernetes cluster, so directing network traffic to it is similar to directing traffic to pods. To route network traffic to a virtual machine, the standard Kubernetes mechanism - the Service resource is used, which selects target objects based on labels (selector).

To do this, you just need to create a service with the required settings.
1. Create a service with the required settings.

1. Suppose we have a virtual machine with http service published on port 80 and the following set of labels:
For example, consider a virtual machine with the label `vm: frontend-0`, an HTTP service exposed on port 80/443, and open SSH on port 22:

```yaml
apiVersion: virtualization.deckhouse.io/v1alpha2
kind: VirtualMachine
metadata:
name: web
name: frontend-0
namespace: dev
labels:
vm: web
vm: frontend-0
spec: ...
```

1. In order to direct network traffic to port 80 of the virtual machine - let's create a service:
1. To route network traffic to the virtual machine's ports, create a service:

```yaml
apiVersion: v1
kind: Service
metadata:
name: svc-1
spec:
ports:
- name: http
port: 8080
protocol: TCP
targetPort: 80
selector:
app: old
```

We can change virtual machine label values on the fly, i.e. changing labels does not require restarting the virtual machine, which means that we can configure network traffic redirection from different services dynamically:

Let's imagine that we have created a new service and want to redirect traffic to our virtual machine from it:
The following Service provides access to the virtual machine. The service listens on ports 80/443 and routes traffic to the target virtual machine's ports 80/443, while external SSH access is provided on port 2211:

```yaml
apiVersion: v1
kind: Service
metadata:
name: svc-2
name: frontend-0-svc
namespace: dev
spec:
type: LoadBalancer
ports:
- name: http
port: 8080
protocol: TCP
targetPort: 80
- name: ssh
port: 2211
protocol: TCP
targetPort: 22
- name: http
port: 80
protocol: TCP
targetPort: 80
- name: https
port: 443
protocol: TCP
targetPort: 443
selector:
app: new
```

By changing the labels on the virtual machine, we will redirect network traffic from the `svc-2` service to it:

```yaml
metadata:
labels:
app: old
vm: frontend-0
```

## How to increase the DVCR size?
Expand Down
60 changes: 23 additions & 37 deletions docs/FAQ.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -398,64 +398,50 @@ ansible -m shell -a "uptime" \

## Как перенаправить трафик на виртуальную машину?

Виртуальная машина функционирует в кластере Kubernetes, поэтому направление сетевого трафика осуществляется аналогично направлению трафика на поды.
Виртуальная машина функционирует в кластере Kubernetes, поэтому направление сетевого трафика осуществляется аналогично направлению трафика на поды. Для направления сетевого трафика на виртуальную машину применяется стандартный механизм Kubernetes — ресурс Service, который выбирает целевые объекты по меткам (selector).

1. Создайте сервис с требуемыми настройками.

В качестве примера приведена виртуальная машина с HTTP-сервисом, опубликованным на порте 80, и следующим набором меток:
В качестве примера приведена виртуальная машина с меткой `vm: frontend-0`, HTTP-сервисом опубликованном на порту 80/443 и открытым SSH на порту 22:

```yaml
apiVersion: virtualization.deckhouse.io/v1alpha2
kind: VirtualMachine
metadata:
name: web
name: frontend-0
namespace: dev
labels:
vm: web
vm: frontend-0
spec: ...
```

1. Чтобы направить сетевой трафик на 80-й порт виртуальной машины, создайте сервис:
1. Чтобы направить сетевой трафик на порты виртуальной машины, создайте сервис:

```yaml
apiVersion: v1
kind: Service
metadata:
name: svc-1
spec:
ports:
- name: http
port: 8080
protocol: TCP
targetPort: 80
selector:
app: old
```

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

Предположим, что был создан новый сервис и требуется перенаправить трафик на виртуальную машину от этого сервиса:
Следующий Service обеспечивает доступ к виртуальной машине, сервис слушает порты 80/443 и перенаправляет трафик на порты 80/443 целевой виртуальной машины, SSH доступ из вне предоставляется по порту 2211:

```yaml
apiVersion: v1
kind: Service
metadata:
name: svc-2
name: frontend-0-svc
namespace: dev
spec:
type: LoadBalancer
ports:
- name: http
port: 8080
protocol: TCP
targetPort: 80
- name: ssh
port: 2211
protocol: TCP
targetPort: 22
- name: http
port: 80
protocol: TCP
targetPort: 80
- name: https
port: 443
protocol: TCP
targetPort: 443
selector:
app: new
```

При изменении метки на виртуальной машине, трафик с сервиса `svc-2` будет перенаправлен на виртуальную машину:

```yaml
metadata:
labels:
app: old
vm: frontend-0
```

## Как увеличить размер DVCR?
Expand Down
Loading