Compare languages | Cloud provider — AWS: examples

An example of the AWSInstanceClass custom resource

Пример custom resource AWSInstanceClass

Below is a simple example of custom resource AWSInstanceClass configuration:

Ниже представлен простой пример конфигурации custom resource AWSInstanceClass:

yaml apiVersion: deckhouse.io/v1 kind: AWSInstanceClass metadata: name: worker spec: instanceType: t3.large ami: ami-040a1551f9c9d11ad diskSizeGb: 15 diskType: gp2

yaml apiVersion: deckhouse.io/v1 kind: AWSInstanceClass metadata: name: worker spec: instanceType: t3.large ami: ami-040a1551f9c9d11ad diskSizeGb: 15 diskType: gp2

LoadBalancer

LoadBalancer

Service object Annotations

Аннотации объекта Service

The following parameters are supported in addition to the existing upstream ones:

Поддерживаются следующие параметры в дополнение к существующим в upstream:

  1. service.beta.kubernetes.io/aws-load-balancer-type — if it has the none value, then the Target Group will only be created (without any LoadBalancer).
  2. service.beta.kubernetes.io/aws-load-balancer-backend-protocol — this parameter is used together with service.beta.kubernetes.io/aws-load-balancer-type: none:
    • Possible values:
    • tcp (default);
    • tls;
    • http;
    • https.
    • Caution! The cloud-controller-manager (CCM) will try to recreate the Target Group in response to changes in this field. If the Target Group has NLB or ALB attached to it, the CCM will fail to delete it and get stuck in this state forever. You have to manually disconnect NLB or ALB from the Target Group.
  1. service.beta.kubernetes.io/aws-load-balancer-type — может иметь значение none, что приведет к созданию только Target Group, без какого-либо LoadBalanacer’а.
  2. service.beta.kubernetes.io/aws-load-balancer-backend-protocol — используется в связке с service.beta.kubernetes.io/aws-load-balancer-type: none:
    • Возможные значения:
    • tcp (по умолчанию);
    • tls;
    • http;
    • https.
    • Внимание! При изменении этого параметра cloud-controller-manager попытается пересоздать Target Group. Если к ней уже привязаны NLB или ALB, удалить Target Group не получится и он будет бесконечно пытаться это сделать. В таком случае необходимо вручную отсоединить NLB или ALB от Target Group.

Configuring security policies on nodes

Настройка политик безопасности на узлах

There may be many reasons why you may need to restrict or expand incoming/outgoing traffic on cluster VMs in AWS:

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

  • Allow VMs on a different subnet to connect to cluster nodes.
  • Allow connecting to the ports of the static node so that the application can work.
  • Restrict access to external resources or other VMs in the cloud for security reasons.
  • Разрешить подключение к узлам кластера с виртуальных машин из другой подсети.
  • Разрешить подключение к портам статического узла для работы приложения.
  • Ограничить доступ к внешним ресурсам или другим виртуальным машинам в облаке по требованию службы безопасности.

For all this, additional security groups should be used. You can only use security groups that are created in the cloud tentatively.

Для всех них следует применять дополнительные группы безопасности (security group). Можно использовать только предварительно созданные в облаке группы безопасности.

Enabling additional security groups on static and master nodes

Установка дополнительных security groups на статических и master-узлах

This parameter can be set either in an existing cluster or when creating one. In both cases, additional security groups are declared in the AWSClusterConfiguration:

  • for master nodes, in the additionalSecurityGroups field of the masterNodeGroup section;
  • for static nodes, in the additionalSecurityGroups field of the nodeGroups subsection that corresponds to the target nodeGroup.

Данный параметр можно задать либо при создании кластера, либо в уже существующем кластере. В обоих случаях дополнительные группы безопасности (security group) указываются в AWSClusterConfiguration:

  • для master-узлов — в секции masterNodeGroup в поле additionalSecurityGroups;
  • для статических узлов — в секции nodeGroups в конфигурации, описывающей соответствующую nodeGroup, в поле additionalSecurityGroups.

The additionalSecurityGroups field contains an array of strings with security group names.

Поле additionalSecurityGroups содержит массив строк с именами групп безопасности.

Enabling additional security groups on ephemeral nodes

Установка дополнительных security groups на эфемерных узлах

You have to set the additionalSecurityGroups parameter for all AWSInstanceClass that require additional security groups.

Необходимо указать параметр additionalSecurityGroups для всех AWSInstanceClass в кластере, которым нужны дополнительные группы безопасности (security group).

Configuring the load balancer if Ingress nodes are not available in all zones

Настройка балансировщика в случае наличия Ingress-узлов не во всех зонах

Set the following annotation for the Service object: service.beta.kubernetes.io/aws-load-balancer-subnets: subnet-foo, subnet-bar.

Необходимо указать аннотацию на объекте Service: service.beta.kubernetes.io/aws-load-balancer-subnets: subnet-foo, subnet-bar.

You can get current subnets for a particular installation as follows:

Чтобы получить список текущих подсетей, используемых для конкретной установки, выполните следующую команду:

bash kubectl -n d8-system exec deploy/deckhouse -c deckhouse – deckhouse-controller module values cloud-provider-aws -o json
| jq -r ‘.cloudProviderAws.internal.zoneToSubnetIdMap’

bash kubectl -n d8-system exec deploy/deckhouse -c deckhouse – deckhouse-controller module values cloud-provider-aws -o json
| jq -r ‘.cloudProviderAws.internal.zoneToSubnetIdMap’