Compare languages | Cloud provider — Yandex Cloud: FAQ

How do I set up the INTERNAL LoadBalancer?

Как настроить INTERNAL LoadBalancer?

Attach the following annotation to the service:

Для настройки INTERNAL LoadBalancer’а установите аннотацию для сервиса:

yaml yandex.cpi.flant.com/listener-subnet-id: SubnetID

yaml yandex.cpi.flant.com/listener-subnet-id: SubnetID

The annotation links the LoadBalancer with the appropriate Subnet.

Аннотация указывает, какой subnet будет слушать LoadBalancer.

How to reserve a public IP address?

Как зарезервировать публичный IP-адрес?

This on is used in externalIPAddresses and natInstanceExternalAddress. It also can be used for a bastion host.

Для использования в externalIPAddresses и natInstanceExternalAddress (также может быть использован для bastion-хоста) выполните следующую команду:

shell $ yc vpc address create –external-ipv4 zone=ru-central1-a id: e9b4cfmmnc1mhgij75n7 folder_id: b1gog0h9k05lhqe5d88l created_at: “2020-09-01T09:29:33Z” external_ipv4_address: address: 178.154.226.159 zone_id: ru-central1-a requirements: {} reserved: true

shell $ yc vpc address create –external-ipv4 zone=ru-central1-a id: e9b4cfmmnc1mhgij75n7 folder_id: b1gog0h9k05lhqe5d88l created_at: “2020-09-01T09:29:33Z” external_ipv4_address: address: 178.154.226.159 zone_id: ru-central1-a requirements: {} reserved: true

dhcpOptions-related problems and ways to address them

Проблемы dhcpOptions и пути их решения

Using DNS servers that differ from those provided by Yandex Cloud in the DHCP settings is a temporary solution. It will be abandoned after Yandex Cloud will introduce the Managed DNS service. To get around the restrictions described below, we recommend using stubZones from the kube-dns module.

Использование в настройках DHCP-серверов адресов DNS, отличающихся от предоставляемых Yandex Cloud, является временным решением. От него можно будет отказаться, когда Yandex Cloud введет услугу Managed DNS. Чтобы обойти ограничения, описанные ниже, рекомендуется использовать stubZones из модуля kube-dns

Editing parameters

Изменение параметров

Pay attention to the following nuances:

Обратите внимание на следующие особенности:

  1. When changing parameters, you need to invoke netplan apply or a similar command that forces the update of the DHCP lease.
  2. You will need to restart all hostNetwork Pods (especially kube-dns) for the new resolv.conf settings to take effect.
  1. При изменении данных параметров требуется выполнить netplan apply или аналог, форсирующий обновление DHCP lease.
  2. Потребуется перезапуск всех подов hostNetwork (особенно kube-dns), чтобы перечитать новый resolv.conf.

Aspects of the use

Особенности использования

If the dhcpOptions parameter is set, all DNS are routed to the DNS servers specified. These DNS servers must serve DNS requests to the Internet and (if needed) resolve intranet resources.

При использовании опции dhcpOptions все DNS-запросы начнут идти через указанные DNS-серверы. Эти DNS-серверы должны разрешать внешние DNS-имена, а также при необходимости разрешать DNS-имена внутренних ресурсов.

Do not use this option if the recursive DNSs specified cannot resolve the same list of zones that the recursive DNSs in the Yandex Cloud subnet can resolve.

Не используйте эту опцию, если указанные рекурсивные DNS-серверы не могут разрешать тот же список зон, что сможет разрешать рекурсивный DNS-сервер в подсети Yandex Cloud.

How to set a custom StorageClass as default?

Как назначить произвольный StorageClass используемым по умолчанию?

Specify the StorageClass name in the defaultClusterStorageClass parameter in the global module settings. Note that after doing so, the storageclass.kubernetes.io/is-default-class='true' annotation will be removed from the StorageClass that was previously set as the default one.

Чтобы назначить произвольный StorageClass используемым по умолчанию для ваших PVC, укажите его имя в параметре defaultClusterStorageClass модуля global. Обратите внимание, что после этого аннотация storageclass.kubernetes.io/is-default-class='true' снимется со StorageClass’а, который ранее был указан как используемый по умолчанию.

shell kubectl edit mc global

shell kubectl edit mc global

Adding CloudStatic nodes to a cluster

Добавление CloudStatic-узлов в кластер

For VMs that you want to add to the cluster as nodes, add the node-network-cidr key to the metadata (Edit VM -> Metadata) with a value equal to the cluster’s nodeNetworkCIDR.

В метаданные виртуальных машин, которые вы хотите включить в кластер в качестве узлов, добавьте (Изменить ВМ -> Метадата) ключ node-network-cidr со значением nodeNetworkCIDR для кластера.

You can find out the nodeNetworkCIDR of the cluster using the command below:

nodeNetworkCIDR кластера можно узнать, воспользовавшись следующей командой:

shell kubectl -n kube-system get secret d8-provider-cluster-configuration -o json | jq –raw-output ‘.data.”cloud-provider-cluster-configuration.yaml”’ | base64 -d | grep ‘^nodeNetworkCIDR’

shell kubectl -n kube-system get secret d8-provider-cluster-configuration -o json | jq –raw-output ‘.data.”cloud-provider-cluster-configuration.yaml”’ | base64 -d | grep ‘^nodeNetworkCIDR’

How do I create a cluster in a new VPC and set up bastion host to access the nodes?

Как создать кластер в новом VPC и развернуть bastion-хост для доступа к узлам?

  1. Bootstrap the base-infrastructure of the cluster:
  1. Выполните bootstrap базовой инфраструктуры кластера:

shell dhctl bootstrap-phase base-infra –config config.yml

shell dhctl bootstrap-phase base-infra –config config.yml

  1. Create a bastion host:
  1. Создайте bastion-хост:

shell yc compute instance create
–name bastion
–hostname bastion
–create-boot-disk image-family=ubuntu-2204-lts,image-folder-id=standard-images,size=20,type=network-hdd
–memory 2
–cores 2
–core-fraction 100
–ssh-key ~/.ssh/id_rsa.pub
–zone ru-central1-a
–public-address 178.154.226.159

shell yc compute instance create
–name bastion
–hostname bastion
–create-boot-disk image-family=ubuntu-2204-lts,image-folder-id=standard-images,size=20,type=network-hdd
–memory 2
–cores 2
–core-fraction 100
–ssh-key ~/.ssh/id_rsa.pub
–zone ru-central1-a
–public-address 178.154.226.159

  1. Continue installing the cluster by specifying the bastion host data. Answer y to the question about the Terraform cache:
  1. Продолжите установку кластера, указав данные bastion-хоста. На вопрос про кэш Terraform ответьте y:

shell dhctl bootstrap –ssh-bastion-host=178.154.226.159 –ssh-bastion-user=yc-user
–ssh-user=ubuntu –ssh-agent-private-keys=/tmp/.ssh/id_rsa –config=/config.yml

shell dhctl bootstrap –ssh-bastion-host=178.154.226.159 –ssh-bastion-user=yc-user
–ssh-user=ubuntu –ssh-agent-private-keys=/tmp/.ssh/id_rsa –config=/config.yml