Compare languages | Cloud provider — Yandex Cloud: FAQ

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

How do I set up the INTERNAL LoadBalancer?

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

Attach the following annotation to the service:

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

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

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

The annotation links the LoadBalancer with the appropriate Subnet.

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

How to reserve a public IP address?

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

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

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 и пути их решения

dhcpOptions-related problems and ways to address them

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

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.

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

Editing parameters

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

Pay attention to the following nuances:

  1. При изменении данных параметров требуется выполнить netplan apply или аналог, форсирующий обновление DHCP lease.
  2. Потребуется перезапуск всех подов hostNetwork (особенно kube-dns), чтобы перечитать новый resolv.conf.
  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.

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

Aspects of the use

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

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.

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

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.

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

How to set a custom StorageClass as default?

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

Do the following to set a custom StorageClass as default:

  1. Добавьте на StorageClass аннотацию storageclass.kubernetes.io/is-default-class='true':
  1. Add storageclass.kubernetes.io/is-default-class='true' annotation to the StorageClass:

shell kubectl annotate sc $STORAGECLASS storageclass.kubernetes.io/is-default-class=’true’

shell kubectl annotate sc $STORAGECLASS storageclass.kubernetes.io/is-default-class=’true’

  1. Укажите имя StorageClass’а в параметре storageClass.default в настройках модуля cloud-provider-yandex. Обратите внимание, что после этого аннотация storageclass.kubernetes.io/is-default-class='true' снимется со StorageClass’а, который ранее был указан в настройках модуля как используемый по умолчанию.
  1. Specify the StorageClass name in the storageClass.default parameter in the cloud-provider-yandex 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 listed in the module settings as the default one.

shell kubectl edit mc cloud-provider-yandex

shell kubectl edit mc cloud-provider-yandex

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

Adding CloudStatic nodes to a cluster

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

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.

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

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

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’

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

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

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

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

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

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

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

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 –resources=/resources.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 –resources=/resources.yml