How do I add a master nodes to a cloud cluster (single-master to a multi-master)? | |||||||||||||||||||||||||||||||||||||||||||||||||||||
Как добавить master-узлы в облачном кластере? | |||||||||||||||||||||||||||||||||||||||||||||||||||||
Как конвертировать кластер с одним master-узлом в мультикластерный описано в FAQ модуля control-plane-manager. | How do I reduce the number of master nodes in a cloud cluster (multi-master to single-master)? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как уменьшить число master-узлов в облачном кластере? | Static nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как конвертировать мультимастерный кластер в кластер с одним master-узлом описано в FAQ модуля control-plane-manager. |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Статические узлы | You can add a static node to the cluster manually (an example) or by using Cluster API Provider Static. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| How do I add a static node to a cluster (Cluster API Provider Static)? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Добавить статический узел в кластер можно вручную (пример) или с помощью Cluster API Provider Static. | To add a static node to a cluster (bare metal server or virtual machine), follow these steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как добавить статический узел в кластер (Cluster API Provider Static)? |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Чтобы добавить статический узел в кластер (сервер bare-metal или виртуальную машину), выполните следующие шаги: |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
| shell useradd -m -s /bin/bash caps usermod -aG sudo caps | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell useradd -m -s /bin/bash caps usermod -aG sudo caps | shell caps ALL=(ALL) NOPASSWD: ALL | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell caps ALL=(ALL) NOPASSWD: ALL | shell sudo systemctl restart sshd | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell sudo systemctl restart sshd | shell ssh-keygen -t rsa -f caps-id -C “” -N “” | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| The public and private keys of the caps user will be stored in the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell ssh-keygen -t rsa -f caps-id -C “” -N “” |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Приватный и публичный ключи будут сохранены в файлах | shell mkdir -p /home/caps/.ssh cat caps-id.pub » /home/caps/.ssh/authorized_keys chmod 700 /home/caps/.ssh chmod 600 /home/caps/.ssh/authorized_keys chown -R caps:caps /home/caps/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell mkdir -p /home/caps/.ssh cat caps-id.pub » /home/caps/.ssh/authorized_keys chmod 700 /home/caps/.ssh chmod 600 /home/caps/.ssh/authorized_keys chown -R caps:caps /home/caps/ | An example of adding a static node. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| How do I add a batch of static nodes to a cluster manually? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Пример добавления статического узла. | Use an existing one or create a new NodeGroup custom resource (example of the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как добавить несколько статических узлов в кластер вручную? | You can automate the bootstrap process with any automation platform you prefer. The following is an example for Ansible. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Используйте существующий или создайте новый кастомный ресурс (Custom Resource) NodeGroup (пример |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Автоматизировать процесс добавления узлов можно с помощью любой платформы автоматизации. Далее приведен пример для Ansible. | shell kubectl -n default get ep kubernetes -o json | jq ‘.subsets[0].addresses[0].ip + “:” + (.subsets[0].ports[0].port | tostring)’ -r | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Check the K8s version. If the version >= 1.25, create | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell kubectl -n default get ep kubernetes -o json | jq ‘.subsets[0].addresses[0].ip + “:” + (.subsets[0].ports[0].port | tostring)’ -r | shell kubectl create token node-group –namespace d8-cloud-instance-manager –duration 1h | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Проверьте версию K8s. Если версия >= 1.25, создайте токен | Save the token you got and add it to the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell kubectl create token node-group –namespace d8-cloud-instance-manager –duration 1h |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Сохраните полученный токен, и добавьте в поле | shell
kubectl -n d8-cloud-instance-manager get $(kubectl -n d8-cloud-instance-manager get secret -o name | grep node-group-token) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell
kubectl -n d8-cloud-instance-manager get $(kubectl -n d8-cloud-instance-manager get secret -o name | grep node-group-token) | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| yaml
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
text [system] system-0 system-1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| [system:vars] node_group=system | ||||||||||||||||||||||||||||||||||||||||||||||||||||
text [system] system-0 system-1 | [worker] worker-0 worker-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
[system:vars] node_group=system | [worker:vars] node_group=worker | ||||||||||||||||||||||||||||||||||||||||||||||||||||
[worker] worker-0 worker-1 |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
[worker:vars] node_group=worker | How do I clean up a static node manually? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| This method is valid for both manually configured nodes (using the bootstrap script) and nodes configured using CAPS. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как вручную очистить статический узел? | To decommission a node from the cluster and clean up the server (VM), run the following command on the node: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| shell bash /var/lib/bashible/cleanup_static_node.sh –yes-i-am-sane-and-i-understand-what-i-am-doing | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Инструкция справедлива как для узла, настроенного вручную (с помощью бутстрап-скрипта), так и для узла, настроенного с помощью CAPS. | Can I delete a StaticInstance? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Чтобы вывести из кластера узел и очистить сервер (ВМ), выполните следующую команду на узле: | A | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell bash /var/lib/bashible/cleanup_static_node.sh –yes-i-am-sane-and-i-understand-what-i-am-doing | To delete a | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Можно ли удалить StaticInstance? |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
| How do I change the IP address of a StaticInstance? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Чтобы удалить | You cannot change the IP address in the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| How do I migrate a manually configured static node under CAPS control? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как изменить IP-адрес StaticInstance? | You need to clean up the node, then hand over the node under CAPS control. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Изменить IP-адрес в ресурсе | How do I change the NodeGroup of a static node? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как мигрировать статический узел настроенный вручную под управление CAPS? | Note that if a node is under CAPS control, you cannot change the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Необходимо выполнить очистку узла, затем добавить узел под управление CAPS. | To switch an existing manually created static node to another | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как изменить NodeGroup у статического узла? | shell
kubectl label node –overwrite | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Applying the changes will take some time. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Если узел находится под управлением CAPS, то изменить принадлежность к | How to clean up a node for adding to the cluster? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Чтобы перенести существующий статический узел созданный вручную из одной | This is only needed if you have to move a static node from one cluster to another. Be aware these operations remove local storage data. If you just need to change a NodeGroup, follow this instruction. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell
kubectl label node –overwrite | Evict resources from the node and remove the node from LINSTOR/DRBD using the instruction if the node you are cleaning up has LINSTOR/DRBD storage pools. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Применение изменений потребует некоторого времени. |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как зачистить узел для последующего ввода в кластер? | shell
kubectl drain | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Это необходимо только в том случае, если нужно переместить статический узел из одного кластера в другой. Имейте в виду, что эти операции удаляют данные локального хранилища. Если необходимо просто изменить |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Если на зачищаемом узле есть пулы хранения LINSTOR/DRBD, то предварительно перенесите ресурсы с узла и удалите узел LINSTOR/DRBD, следуя инструкции. | shell bash /var/lib/bashible/cleanup_static_node.sh –yes-i-am-sane-and-i-understand-what-i-am-doing | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell
kubectl drain | How do I know if something went wrong? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| If a node in a nodeGroup is not updated (the value of | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell bash /var/lib/bashible/cleanup_static_node.sh –yes-i-am-sane-and-i-understand-what-i-am-doing | To view the logs of the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| shell journalctl -fu bashible | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как понять, что что-то пошло не так? | Example of output when the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Если узел в NodeGroup не обновляется (значение | console May 25 04:39:16 kube-master-0 systemd[1]: Started Bashible service. May 25 04:39:16 kube-master-0 bashible.sh[1976339]: Configuration is in sync, nothing to do. May 25 04:39:16 kube-master-0 systemd[1]: bashible.service: Succeeded. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Чтобы проверить логи сервиса | How do I know what is running on a node while it is being created? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell journalctl -fu bashible | You can analyze | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Пример вывода, когда все необходимые действия выполнены: |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
console May 25 04:39:16 kube-master-0 systemd[1]: Started Bashible service. May 25 04:39:16 kube-master-0 bashible.sh[1976339]: Configuration is in sync, nothing to do. May 25 04:39:16 kube-master-0 systemd[1]: bashible.service: Succeeded. | shell kubectl get instances | grep Pending | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как посмотреть, что в данный момент выполняется на узле при его создании? | An example: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Если необходимо узнать, что происходит на узле (например, узел долго создается), можно проверить логи | shell $ kubectl get instances | grep Pending dev-worker-2a6158ff-6764d-nrtbj Pending 46s | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell kubectl get instances | grep Pending | shell kubectl get instances dev-worker-2a6158ff-6764d-nrtbj -o yaml | grep ‘bootstrapStatus’ -B0 -A2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Пример: | An example: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell $ kubectl get instances | grep Pending dev-worker-2a6158ff-6764d-nrtbj Pending 46s | shell $ kubectl get instances dev-worker-2a6158ff-6764d-nrtbj -o yaml | grep ‘bootstrapStatus’ -B0 -A2 bootstrapStatus: description: Use ‘nc 192.168.199.178 8000’ to get bootstrap logs. logsEndpoint: 192.168.199.178:8000 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell kubectl get instances dev-worker-2a6158ff-6764d-nrtbj -o yaml | grep ‘bootstrapStatus’ -B0 -A2 | The logs of the initial node configuration are located at | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Пример: | How do I update kernel on nodes? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell $ kubectl get instances dev-worker-2a6158ff-6764d-nrtbj -o yaml | grep ‘bootstrapStatus’ -B0 -A2 bootstrapStatus: description: Use ‘nc 192.168.199.178 8000’ to get bootstrap logs. logsEndpoint: 192.168.199.178:8000 | Debian-based distros | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Create a | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Логи первоначальной настройки узла находятся в | yaml apiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: install-kernel.sh spec: bundles:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как обновить ядро на узлах? | desired_version=”5.15.0-53-generic” | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Для дистрибутивов, основанных на Debian | bb-event-on ‘bb-package-installed’ ‘post-install’ post-install() { bb-log-info “Setting reboot flag due to kernel was updated” bb-flag-set reboot } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Создайте ресурс | version_in_use=”$(uname -r)” | ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml apiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: install-kernel.sh spec: bundles:
| if [[ “$version_in_use” == “$desired_version” ]]; then exit 0 fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||
desired_version=”5.15.0-53-generic” | bb-deckhouse-get-disruptive-update-approval bb-apt-install “linux-image-${desired_version}” | ||||||||||||||||||||||||||||||||||||||||||||||||||||
bb-event-on ‘bb-package-installed’ ‘post-install’ post-install() { bb-log-info “Setting reboot flag due to kernel was updated” bb-flag-set reboot } | CentOS-based distros | ||||||||||||||||||||||||||||||||||||||||||||||||||||
version_in_use=”$(uname -r)” | Create a | ||||||||||||||||||||||||||||||||||||||||||||||||||||
if [[ “$version_in_use” == “$desired_version” ]]; then exit 0 fi | yaml apiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: install-kernel.sh spec: bundles:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
bb-deckhouse-get-disruptive-update-approval bb-apt-install “linux-image-${desired_version}” | desired_version=”3.10.0-1160.42.2.el7.x86_64” | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Для дистрибутивов, основанных на CentOS | bb-event-on ‘bb-package-installed’ ‘post-install’ post-install() { bb-log-info “Setting reboot flag due to kernel was updated” bb-flag-set reboot } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Создайте ресурс | version_in_use=”$(uname -r)” | ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml apiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: install-kernel.sh spec: bundles:
| if [[ “$version_in_use” == “$desired_version” ]]; then exit 0 fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||
desired_version=”3.10.0-1160.42.2.el7.x86_64” | bb-deckhouse-get-disruptive-update-approval bb-yum-install “kernel-${desired_version}” | ||||||||||||||||||||||||||||||||||||||||||||||||||||
bb-event-on ‘bb-package-installed’ ‘post-install’ post-install() { bb-log-info “Setting reboot flag due to kernel was updated” bb-flag-set reboot } | NodeGroup parameters and their result | ||||||||||||||||||||||||||||||||||||||||||||||||||||
version_in_use=”$(uname -r)” |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
if [[ “$version_in_use” == “$desired_version” ]]; then exit 0 fi | Refer to the description of the NodeGroup custom resource for more information about the parameters. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
bb-deckhouse-get-disruptive-update-approval bb-yum-install “kernel-${desired_version}” | Changing the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Какие параметры NodeGroup к чему приводят? | During the disruption update, an evict of the pods from the node is performed. If any pod failes to evict, the evict is repeated every 20 seconds until a global timeout of 5 minutes is reached. After that, the pods that failed to evict are removed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| How do I redeploy ephemeral machines in the cloud with a new configuration? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Подробно о всех параметрах можно прочитать в описании кастомного ресурса NodeGroup. | If the Deckhouse configuration is changed (both in the node-manager module and in any of the cloud providers), the VMs will not be redeployed. The redeployment is performed only in response to changing | ||||||||||||||||||||||||||||||||||||||||||||||||||||
В случае изменения параметров | To force the redeployment of all Machines, you need to add/modify the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
При обновлении, которое требует прерывания работы узла (disruption update), выполняется процесс вытеснения подов с узла. Если какой-либо под не может быть вытеснен, попытка повторяется каждые 20 секунд до достижения глобального таймаута в 5 минут. После истечения этого времени, поды, которые не удалось вытеснить, удаляются принудительно. | How do I allocate nodes to specific loads? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как пересоздать эфемерные машины в облаке с новой конфигурацией? | You cannot use the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
При изменении конфигурации Deckhouse (как в модуле | There are two ways to solve this problem: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Чтобы принудительно пересоздать все узлы, связанные с ресурсом |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как выделить узлы под специфические нагрузки? | Deckhouse tolerates the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Запрещено использование домена | To use custom keys for | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Для решений данной задачи существуют два механизма: | How to allocate nodes to system components? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Frontend | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Deckhouse по умолчанию поддерживает использование taint’а с ключом | For Ingress controllers, use the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Если требуется использовать другие ключи для taints (например, | yaml nodeTemplate: labels: node-role.deckhouse.io/frontend: “” taints:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Подробности в статье на Habr. | System components | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как выделить узлы под системные компоненты? |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Фронтенд | yaml nodeTemplate: labels: node-role.deckhouse.io/system: “” taints:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Для Ingress-контроллеров используйте | How do I speed up node provisioning on the cloud when scaling applications horizontally? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml nodeTemplate: labels: node-role.deckhouse.io/frontend: “” taints:
| The most efficient way is to have some extra nodes “ready”. In this case, you can run new application replicas on them almost instantaneously. The obvious disadvantage of this approach is the additional maintenance costs related to these nodes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Системные | Here is how you should configure the target | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Для компонентов подсистем Deckhouse параметр |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml nodeTemplate: labels: node-role.deckhouse.io/system: “” taints:
| An example: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как ускорить заказ узлов в облаке при горизонтальном масштабировании приложений? | yaml cloudInstances: maxPerZone: 10 minPerZone: 1 standby: 10% standbyHolder: overprovisioningRate: 30% | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Самое действенное — держать в кластере некоторое количество предварительно подготовленных узлов, которые позволят новым репликам ваших приложений запускаться мгновенно. Очевидным минусом данного решения будут дополнительные расходы на содержание этих узлов. | How do I disable machine-controller-manager in the case of potentially cluster-damaging changes? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Необходимые настройки целевой | Use this switch only if you know what you are doing and clearly understand the consequences. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Set the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Пример: | yaml mcmEmergencyBrake: true | ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml cloudInstances: maxPerZone: 10 minPerZone: 1 standby: 10% standbyHolder: overprovisioningRate: 30% | How do I restore the master node if kubelet cannot load the control plane components? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как выключить machine-controller-manager в случае выполнения потенциально деструктивных изменений в кластере? | Such a situation may occur if images of the control plane components on the master were deleted in a cluster that has a single master node (e.g., the directory | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Использовать эту настройку допустимо только тогда, когда вы четко понимаете, зачем это необходимо. | Below is an instruction on how you can restore the master node. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Для того чтобы временно отключить machine-controller-manager (MCM) и предотвратить его автоматические действия, которые могут повлиять на инфраструктуру кластера (например, удаление или пересоздание узлов), установите следующий параметр в конфигурации: | containerd | ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml mcmEmergencyBrake: true | Execute the following command to restore the master node in any cluster running under Deckhouse: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как восстановить master-узел, если kubelet не может загрузить компоненты control plane? | shell kubectl -n d8-system get secrets deckhouse-registry -o json | jq -r ‘.data.”.dockerconfigjson”’ | base64 -d | jq -r ‘.auths.”registry.deckhouse.io”.auth’ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Подобная ситуация может возникнуть, если в кластере с одним master-узлом на нем были удалены образы компонентов control plane (например, удалена директория | Copy the command’s output and use it for setting the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Далее приведена инструкция по восстановлению master-узла. | Next, you need to pull images of | ||||||||||||||||||||||||||||||||||||||||||||||||||||
containerd | shell for image in $(grep “image:” /etc/kubernetes/manifests/* | awk ‘{print $3}’); do crictl pull –auth $AUTH $image done | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Для восстановления работоспособности master-узла нужно в любом рабочем кластере под управлением Deckhouse выполнить команду: | You need to restart | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell kubectl -n d8-system get secrets deckhouse-registry -o json | jq -r ‘.data.”.dockerconfigjson”’ | base64 -d | jq -r ‘.auths.”registry.deckhouse.io”.auth’ | How to change CRI for NodeGroup? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Вывод команды нужно скопировать и присвоить переменной | CRI can only be switched from | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Далее на поврежденном master-узле нужно загрузить образы компонентов | Set NodeGroup | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell for image in $(grep “image:” /etc/kubernetes/manifests/* | awk ‘{print $3}’); do crictl pull –auth $AUTH $image done | NodeGroup YAML example: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
После загрузки образов необходимо перезапустить | yaml apiVersion: deckhouse.io/v1 kind: NodeGroup metadata: name: worker spec: nodeType: Static cri: type: Containerd | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как изменить CRI для NodeGroup? | Also, this operation can be done with patch: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Смена CRI возможна только между |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Для изменения CRI для NodeGroup, установите параметр cri.type в | shell
kubectl patch nodegroup | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Пример YAML-манифеста NodeGroup: |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml apiVersion: deckhouse.io/v1 kind: NodeGroup metadata: name: worker spec: nodeType: Static cri: type: Containerd | shell
kubectl patch nodegroup | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Также эту операцию можно выполнить с помощью патча: | While changing | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| After setting up a new CRI for NodeGroup, the node-manager module drains nodes one by one and installs a new CRI on them. Node update
is accompanied by downtime (disruption). Depending on the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell kubectl patch nodegroup <имя NodeGroup=""> --type merge -p '{"spec":{"cri":{"type":"Containerd"}}}' | How to change CRI for the whole cluster? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| CRI can only be switched from | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell kubectl patch nodegroup <имя NodeGroup=""> --type merge -p '{"spec":{"cri":{"type":"NotManaged"}}}' | It is necessary to use the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
При изменении | Also, this operation can be done with the following patch: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
После изменения CRI для NodeGroup модуль |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как изменить CRI для всего кластера? | shell data=”$(kubectl -n kube-system get secret d8-cluster-configuration -o json | jq -r ‘.data.”cluster-configuration.yaml”’ | base64 -d | sed “s/NotManaged/Containerd/” | base64 -w0)” kubectl -n kube-system patch secret d8-cluster-configuration -p “{"data":{"cluster-configuration.yaml":"$data"}}” | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Смена CRI возможна только между |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Для изменения CRI для всего кластера, необходимо с помощью утилиты | shell data=”$(kubectl -n kube-system get secret d8-cluster-configuration -o json | jq -r ‘.data.”cluster-configuration.yaml”’ | base64 -d | sed “s/Containerd/NotManaged/” | base64 -w0)” kubectl -n kube-system patch secret d8-cluster-configuration -p “{"data":{"cluster-configuration.yaml":"$data"}}” | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Также возможно выполнить эту операцию с помощью | If it is necessary to leave some NodeGroup on another CRI, then before changing the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Changing | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell data=”$(kubectl -n kube-system get secret d8-cluster-configuration -o json | jq -r ‘.data.”cluster-configuration.yaml”’ | base64 -d | sed “s/NotManaged/Containerd/” | base64 -w0)” kubectl -n kube-system patch secret d8-cluster-configuration -p “{"data":{"cluster-configuration.yaml":"$data"}}” | When changing the CRI in the cluster, additional steps are required for the master nodes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell data=”$(kubectl -n kube-system get secret d8-cluster-configuration -o json | jq -r ‘.data.”cluster-configuration.yaml”’ | base64 -d | sed “s/Containerd/NotManaged/” | base64 -w0)” kubectl -n kube-system patch secret d8-cluster-configuration -p “{"data":{"cluster-configuration.yaml":"$data"}}” | shell kubectl get nodes -l node-role.kubernetes.io/control-plane=”” -o json | jq ‘.items[] | select(.metadata.annotations.”update.node.deckhouse.io/approved”==””) | .metadata.name’ -r | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Если необходимо, чтобы отдельные NodeGroup использовали другой CRI, перед изменением |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Изменение | shell
kubectl annotate node | ||||||||||||||||||||||||||||||||||||||||||||||||||||
При изменении CRI в кластере для master-узлов необходимо выполнить дополнительные шаги: |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
| How to add node configuration step? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell kubectl get nodes -l node-role.kubernetes.io/control-plane=”” -o json | jq ‘.items[] | select(.metadata.annotations.”update.node.deckhouse.io/approved”==””) | .metadata.name’ -r | Additional node configuration steps are set via the NodeGroupConfiguration custom resource. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| How to automatically put custom labels on the node? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell kubectl annotate node <имя master-узла=""> update.node.deckhouse.io/disruption-approved= |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как добавить шаг для конфигурации узлов? |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Дополнительные шаги для конфигурации узлов задаются с помощью кастомного ресурса NodeGroupConfiguration. | console example-label=test | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как автоматически проставить на узел кастомные лейблы? |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
| When adding a node to the cluster, the labels specified in the files will be automatically affixed to the node. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Please note that it is not possible to add labels used in DKP in this way. This method will only work with custom labels that do not overlap with those reserved for Deckhouse. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| How to use containerd with Nvidia GPU support? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
console example-label=test | Create NodeGroup for GPU-nodes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| yaml apiVersion: deckhouse.io/v1 kind: NodeGroup metadata: name: gpu spec: chaos: mode: Disabled disruptions: approvalMode: Automatic nodeType: CloudStatic | ||||||||||||||||||||||||||||||||||||||||||||||||||||
При добавлении узла в кластер указанные в файлах лейблы будут автоматически проставлены на узел. | Create NodeGroupConfiguration for containerd configuration of NodeGroup | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Обратите внимание, что добавить таким образом лейблы, использующиеся в DKP, невозможно. Работать такой метод будет только с кастомными лейблами, не пересекающимися с зарезервированными для Deckhouse. | yaml apiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: containerd-additional-config.sh spec: bundles:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как использовать containerd с поддержкой Nvidia GPU? | mkdir -p /etc/containerd/conf.d bb-sync-file /etc/containerd/conf.d/nvidia_gpu.toml - « “EOF” [plugins] [plugins.”io.containerd.grpc.v1.cri”] [plugins.”io.containerd.grpc.v1.cri”.containerd] default_runtime_name = “nvidia” [plugins.”io.containerd.grpc.v1.cri”.containerd.runtimes] [plugins.”io.containerd.grpc.v1.cri”.containerd.runtimes.runc] [plugins.”io.containerd.grpc.v1.cri”.containerd.runtimes.nvidia] privileged_without_host_devices = false runtime_engine = “” runtime_root = “” runtime_type = “io.containerd.runc.v1” [plugins.”io.containerd.grpc.v1.cri”.containerd.runtimes.nvidia.options] BinaryName = “/usr/bin/nvidia-container-runtime” SystemdCgroup = false EOF nodeGroups:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Необходимо создать отдельную NodeGroup для GPU-узлов: | Create NodeGroupConfiguration for Nvidia drivers setup on NodeGroup | ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml apiVersion: deckhouse.io/v1 kind: NodeGroup metadata: name: gpu spec: chaos: mode: Disabled disruptions: approvalMode: Automatic nodeType: CloudStatic | Ubuntu | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Далее создайте NodeGroupConfiguration для NodeGroup | yaml apiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: install-cuda.sh spec: bundles:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml apiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: containerd-additional-config.sh spec: bundles:
| if [ ! -f “/etc/apt/sources.list.d/nvidia-container-toolkit.list” ]; then distribution=$(. /etc/os-release;echo $ID$VERSION_ID) curl -s -L https://nvidia.github.io/libnvidia-container/gpgkey | sudo apt-key add - curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list fi bb-apt-install nvidia-container-toolkit nvidia-driver-535-server nvidia-ctk config –set nvidia-container-runtime.log-level=error –in-place nodeGroups:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
mkdir -p /etc/containerd/conf.d bb-sync-file /etc/containerd/conf.d/nvidia_gpu.toml - « “EOF” [plugins] [plugins.”io.containerd.grpc.v1.cri”] [plugins.”io.containerd.grpc.v1.cri”.containerd] default_runtime_name = “nvidia” [plugins.”io.containerd.grpc.v1.cri”.containerd.runtimes] [plugins.”io.containerd.grpc.v1.cri”.containerd.runtimes.runc] [plugins.”io.containerd.grpc.v1.cri”.containerd.runtimes.nvidia] privileged_without_host_devices = false runtime_engine = “” runtime_root = “” runtime_type = “io.containerd.runc.v1” [plugins.”io.containerd.grpc.v1.cri”.containerd.runtimes.nvidia.options] BinaryName = “/usr/bin/nvidia-container-runtime” SystemdCgroup = false EOF nodeGroups:
| Centos | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Добавьте NodeGroupConfiguration для установки драйверов Nvidia для NodeGroup | yaml apiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: install-cuda.sh spec: bundles:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Ubuntu | if [ ! -f “/etc/yum.repos.d/nvidia-container-toolkit.repo” ]; then
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml apiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: install-cuda.sh spec: bundles:
| Bootstrap and reboot node. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
if [ ! -f “/etc/apt/sources.list.d/nvidia-container-toolkit.list” ]; then distribution=$(. /etc/os-release;echo $ID$VERSION_ID) curl -s -L https://nvidia.github.io/libnvidia-container/gpgkey | sudo apt-key add - curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list fi bb-apt-install nvidia-container-toolkit nvidia-driver-535-server nvidia-ctk config –set nvidia-container-runtime.log-level=error –in-place nodeGroups:
| How to check if it was successful? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Centos | Deploy the Job: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml apiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: install-cuda.sh spec: bundles:
| yaml apiVersion: batch/v1 kind: Job metadata: name: nvidia-cuda-test namespace: default spec: completions: 1 template: spec: restartPolicy: Never nodeSelector: node.deckhouse.io/group: gpu containers:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
if [ ! -f “/etc/yum.repos.d/nvidia-container-toolkit.repo” ]; then
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
| And check the logs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
После того как конфигурации будут применены, необходимо провести бутстрап и перезагрузить узлы, чтобы применить настройки и установить драйвера. | shell $ kubectl logs job/nvidia-cuda-test Tue Jan 24 11:36:18 2023 +—————————————————————————–+ | NVIDIA-SMI 525.60.13 Driver Version: 525.60.13 CUDA Version: 12.0 | |——————————-+———————-+———————-+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |===============================+======================+======================| | 0 Tesla T4 Off | 00000000:8B:00.0 Off | 0 | | N/A 45C P0 25W / 70W | 0MiB / 15360MiB | 0% Default | | | | N/A | +——————————-+———————-+———————-+ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как проверить, что все прошло успешно? | +—————————————————————————–+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=============================================================================| | No running processes found | +—————————————————————————–+ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Создайте в кластере Job: | Deploy the Job: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml apiVersion: batch/v1 kind: Job metadata: name: nvidia-cuda-test namespace: default spec: completions: 1 template: spec: restartPolicy: Never nodeSelector: node.deckhouse.io/group: gpu containers:
| yaml apiVersion: batch/v1 kind: Job metadata: name: gpu-operator-test namespace: default spec: completions: 1 template: spec: restartPolicy: Never nodeSelector: node.deckhouse.io/group: gpu containers:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Проверьте логи командой: | And check the logs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell $ kubectl logs job/nvidia-cuda-test Tue Jan 24 11:36:18 2023 +—————————————————————————–+ | NVIDIA-SMI 525.60.13 Driver Version: 525.60.13 CUDA Version: 12.0 | |——————————-+———————-+———————-+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |===============================+======================+======================| | 0 Tesla T4 Off | 00000000:8B:00.0 Off | 0 | | N/A 45C P0 25W / 70W | 0MiB / 15360MiB | 0% Default | | | | N/A | +——————————-+———————-+———————-+ | shell $ kubectl logs job/gpu-operator-test [Vector addition of 50000 elements] Copy input data from the host memory to the CUDA device CUDA kernel launch with 196 blocks of 256 threads Copy output data from the CUDA device to the host memory Test PASSED Done | ||||||||||||||||||||||||||||||||||||||||||||||||||||
+—————————————————————————–+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=============================================================================| | No running processes found | +—————————————————————————–+ | How to deploy custom containerd configuration? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Создайте в кластере Job: | The example of | ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml apiVersion: batch/v1 kind: Job metadata: name: gpu-operator-test namespace: default spec: completions: 1 template: spec: restartPolicy: Never nodeSelector: node.deckhouse.io/group: gpu containers:
| Adding custom settings causes a restart of the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Проверьте логи командой: | Bashible on nodes merges main Deckhouse containerd config with configs from | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell $ kubectl logs job/gpu-operator-test [Vector addition of 50000 elements] Copy input data from the host memory to the CUDA device CUDA kernel launch with 196 blocks of 256 threads Copy output data from the CUDA device to the host memory Test PASSED Done | You can override the values of the parameters that are specified in the file | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как развернуть кастомный конфигурационный файл containerd? | yaml apiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: containerd-option-config.sh spec: bundles:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Пример | mkdir -p /etc/containerd/conf.d bb-sync-file /etc/containerd/conf.d/additional_option.toml - « EOF oom_score = 500 [metrics] address = “127.0.0.1” grpc_histogram = true EOF nodeGroups:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Добавление кастомных настроек вызывает перезапуск сервиса | How to add additional registry auth? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Bashible на узлах объединяет конфигурацию containerd для Deckhouse с конфигурацией из файла | Deploy | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Вы можете переопределять значения параметров, которые заданы в файле | yamlapiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: containerd-additional-config.sh spec: bundles:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml apiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: containerd-option-config.sh spec: bundles:
| mkdir -p /etc/containerd/conf.d bb-sync-file /etc/containerd/conf.d/additional_registry.toml - « EOF [plugins] [plugins.”io.containerd.grpc.v1.cri”] [plugins.”io.containerd.grpc.v1.cri”.registry] [plugins.”io.containerd.grpc.v1.cri”.registry.mirrors] [plugins.”io.containerd.grpc.v1.cri”.registry.mirrors.”docker.io”] endpoint = [“https://registry-1.docker.io”] [plugins.”io.containerd.grpc.v1.cri”.registry.mirrors.”${REGISTRY_URL}”] endpoint = [“https://${REGISTRY_URL}”] [plugins.”io.containerd.grpc.v1.cri”.registry.configs] [plugins.”io.containerd.grpc.v1.cri”.registry.configs.”${REGISTRY_URL}”.auth] auth = “AAAABBBCCCDDD==” EOF nodeGroups:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
mkdir -p /etc/containerd/conf.d bb-sync-file /etc/containerd/conf.d/additional_option.toml - « EOF oom_score = 500 [metrics] address = “127.0.0.1” grpc_histogram = true EOF nodeGroups:
| How to configure a certificate for an additional registry? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как добавить авторизацию в дополнительный registry? | In addition to containerd, the certificate can be simultaneously added into the OS. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Разверните скрипт | Example of the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml apiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: containerd-additional-config.sh spec: bundles:
| yaml apiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: configure-cert-containerd.sh spec: bundles:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
mkdir -p /etc/containerd/conf.d bb-sync-file /etc/containerd/conf.d/additional_registry.toml - « EOF [plugins] [plugins.”io.containerd.grpc.v1.cri”] [plugins.”io.containerd.grpc.v1.cri”.registry] [plugins.”io.containerd.grpc.v1.cri”.registry.mirrors] [plugins.”io.containerd.grpc.v1.cri”.registry.mirrors.”docker.io”] endpoint = [“https://registry-1.docker.io”] [plugins.”io.containerd.grpc.v1.cri”.registry.mirrors.”${REGISTRY_URL}”] endpoint = [“https://${REGISTRY_URL}”] [plugins.”io.containerd.grpc.v1.cri”.registry.configs] [plugins.”io.containerd.grpc.v1.cri”.registry.configs.”${REGISTRY_URL}”.auth] auth = “AAAABBBCCCDDD==” EOF nodeGroups:
| REGISTRY_URL=private.registry.example CERT_FILE_NAME=${REGISTRY_URL} CERTS_FOLDER=”/var/lib/containerd/certs/” CERT_CONTENT=$(cat «“EOF” —–BEGIN CERTIFICATE—– MIIDSjCCAjKgAwIBAgIRAJ4RR/WDuAym7M11JA8W7D0wDQYJKoZIhvcNAQELBQAw JTEjMCEGA1UEAxMabmV4dXMuNTEuMjUwLjQxLjIuc3NsaXAuaW8wHhcNMjQwODAx MTAzMjA4WhcNMjQxMDMwMTAzMjA4WjAlMSMwIQYDVQQDExpuZXh1cy41MS4yNTAu NDEuMi5zc2xpcC5pbzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL1p WLPr2c4SZX/i4IS59Ly1USPjRE21G4pMYewUjkSXnYv7hUkHvbNL/P9dmGBm2Jsl WFlRZbzCv7+5/J+9mPVL2TdTbWuAcTUyaG5GZ/1w64AmAWxqGMFx4eyD1zo9eSmN G2jis8VofL9dWDfUYhRzJ90qKxgK6k7tfhL0pv7IHDbqf28fCEnkvxsA98lGkq3H fUfvHV6Oi8pcyPZ/c8ayIf4+JOnf7oW/TgWqI7x6R1CkdzwepJ8oU7PGc0ySUWaP G5bH3ofBavL0bNEsyScz4TFCJ9b4aO5GFAOmgjFMMUi9qXDH72sBSrgi08Dxmimg Hfs198SZr3br5GTJoAkCAwEAAaN1MHMwDgYDVR0PAQH/BAQDAgWgMAwGA1UdEwEB /wQCMAAwUwYDVR0RBEwwSoIPbmV4dXMuc3ZjLmxvY2FsghpuZXh1cy41MS4yNTAu NDEuMi5zc2xpcC5pb4IbZG9ja2VyLjUxLjI1MC40MS4yLnNzbGlwLmlvMA0GCSqG SIb3DQEBCwUAA4IBAQBvTjTTXWeWtfaUDrcp1YW1pKgZ7lTb27f3QCxukXpbC+wL dcb4EP/vDf+UqCogKl6rCEA0i23Dtn85KAE9PQZFfI5hLulptdOgUhO3Udluoy36 D4WvUoCfgPgx12FrdanQBBja+oDsT1QeOpKwQJuwjpZcGfB2YZqhO0UcJpC8kxtU by3uoxJoveHPRlbM2+ACPBPlHu/yH7st24sr1CodJHNt6P8ugIBAZxi3/Hq0wj4K aaQzdGXeFckWaxIny7F1M3cIWEXWzhAFnoTgrwlklf7N7VWHPIvlIh1EYASsVYKn iATq8C7qhUOGsknDh3QSpOJeJmpcBwln11/9BGRP —–END CERTIFICATE—– EOF ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как настроить сертификат для дополнительного registry? | CONFIG_CONTENT=$(cat «EOF [plugins] [plugins.”io.containerd.grpc.v1.cri”.registry.configs.”${REGISTRY_URL}”.tls] ca_file = “${CERTS_FOLDER}/${CERT_FILE_NAME}.crt” EOF ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Помимо containerd, сертификат можно одновременно добавить и в операционной системе. | mkdir -p ${CERTS_FOLDER} mkdir -p /etc/containerd/conf.d | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Пример | bb-tmp-file - Create temp file function. More information: http://www.bashbooster.net/#tmp | ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml apiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: configure-cert-containerd.sh spec: bundles:
| CERT_TMP_FILE=”$( bb-tmp-file )”
echo -e “${CERT_CONTENT}” > “${CERT_TMP_FILE}” | ||||||||||||||||||||||||||||||||||||||||||||||||||||
REGISTRY_URL=private.registry.example CERT_FILE_NAME=${REGISTRY_URL} CERTS_FOLDER=”/var/lib/containerd/certs/” CERT_CONTENT=$(cat «“EOF” —–BEGIN CERTIFICATE—– MIIDSjCCAjKgAwIBAgIRAJ4RR/WDuAym7M11JA8W7D0wDQYJKoZIhvcNAQELBQAw JTEjMCEGA1UEAxMabmV4dXMuNTEuMjUwLjQxLjIuc3NsaXAuaW8wHhcNMjQwODAx MTAzMjA4WhcNMjQxMDMwMTAzMjA4WjAlMSMwIQYDVQQDExpuZXh1cy41MS4yNTAu NDEuMi5zc2xpcC5pbzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL1p WLPr2c4SZX/i4IS59Ly1USPjRE21G4pMYewUjkSXnYv7hUkHvbNL/P9dmGBm2Jsl WFlRZbzCv7+5/J+9mPVL2TdTbWuAcTUyaG5GZ/1w64AmAWxqGMFx4eyD1zo9eSmN G2jis8VofL9dWDfUYhRzJ90qKxgK6k7tfhL0pv7IHDbqf28fCEnkvxsA98lGkq3H fUfvHV6Oi8pcyPZ/c8ayIf4+JOnf7oW/TgWqI7x6R1CkdzwepJ8oU7PGc0ySUWaP G5bH3ofBavL0bNEsyScz4TFCJ9b4aO5GFAOmgjFMMUi9qXDH72sBSrgi08Dxmimg Hfs198SZr3br5GTJoAkCAwEAAaN1MHMwDgYDVR0PAQH/BAQDAgWgMAwGA1UdEwEB /wQCMAAwUwYDVR0RBEwwSoIPbmV4dXMuc3ZjLmxvY2FsghpuZXh1cy41MS4yNTAu NDEuMi5zc2xpcC5pb4IbZG9ja2VyLjUxLjI1MC40MS4yLnNzbGlwLmlvMA0GCSqG SIb3DQEBCwUAA4IBAQBvTjTTXWeWtfaUDrcp1YW1pKgZ7lTb27f3QCxukXpbC+wL dcb4EP/vDf+UqCogKl6rCEA0i23Dtn85KAE9PQZFfI5hLulptdOgUhO3Udluoy36 D4WvUoCfgPgx12FrdanQBBja+oDsT1QeOpKwQJuwjpZcGfB2YZqhO0UcJpC8kxtU by3uoxJoveHPRlbM2+ACPBPlHu/yH7st24sr1CodJHNt6P8ugIBAZxi3/Hq0wj4K aaQzdGXeFckWaxIny7F1M3cIWEXWzhAFnoTgrwlklf7N7VWHPIvlIh1EYASsVYKn iATq8C7qhUOGsknDh3QSpOJeJmpcBwln11/9BGRP —–END CERTIFICATE—– EOF ) | bb-sync-file - File synchronization function. More information: http://www.bashbooster.net/#sync “${CERTS_FOLDER}/${CERT_FILE_NAME}.crt” - Destination file ${CERT_TMP_FILE} - Source file | ||||||||||||||||||||||||||||||||||||||||||||||||||||
CONFIG_CONTENT=$(cat «EOF [plugins] [plugins.”io.containerd.grpc.v1.cri”.registry.configs.”${REGISTRY_URL}”.tls] ca_file = “${CERTS_FOLDER}/${CERT_FILE_NAME}.crt” EOF ) | bb-sync-file | ||||||||||||||||||||||||||||||||||||||||||||||||||||
mkdir -p ${CERTS_FOLDER} mkdir -p /etc/containerd/conf.d | bb-sync-file
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
bb-tmp-file - Create temp file function. More information: http://www.bashbooster.net/#tmp | How to use NodeGroup’s priority feature | ||||||||||||||||||||||||||||||||||||||||||||||||||||
CERT_TMP_FILE=”$( bb-tmp-file )”
echo -e “${CERT_CONTENT}” > “${CERT_TMP_FILE}” | The priority field of the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
bb-sync-file - File synchronization function. More information: http://www.bashbooster.net/#sync “${CERTS_FOLDER}/${CERT_FILE_NAME}.crt” - Destination file ${CERT_TMP_FILE} - Source file | Here is an example of creating two | ||||||||||||||||||||||||||||||||||||||||||||||||||||
bb-sync-file | yamlapiVersion: deckhouse.io/v1 kind: NodeGroup metadata: name: worker-spot spec: cloudInstances: classReference: kind: AWSInstanceClass name: worker-spot maxPerZone: 5 minPerZone: 0 priority: 50 nodeType: CloudEphemeral — apiVersion: deckhouse.io/v1 kind: NodeGroup metadata: name: worker spec: cloudInstances: classReference: kind: AWSInstanceClass name: worker maxPerZone: 5 minPerZone: 0 priority: 30 nodeType: CloudEphemeral | ||||||||||||||||||||||||||||||||||||||||||||||||||||
bb-sync-file
| In the above example, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как использовать NodeGroup с приоритетом? | Once the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
С помощью параметра priority кастомного ресурса | Note that node templates (labels/taints) for | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Пример создания двух | How to interpret Node Group states? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
yamlapiVersion: deckhouse.io/v1 kind: NodeGroup metadata: name: worker-spot spec: cloudInstances: classReference: kind: AWSInstanceClass name: worker-spot maxPerZone: 5 minPerZone: 0 priority: 50 nodeType: CloudEphemeral — apiVersion: deckhouse.io/v1 kind: NodeGroup metadata: name: worker spec: cloudInstances: classReference: kind: AWSInstanceClass name: worker maxPerZone: 5 minPerZone: 0 priority: 30 nodeType: CloudEphemeral | Ready — the node group contains the minimum required number of scheduled nodes with the status Ready for all zones. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
В приведенном выше примере, | Example 1. A group of nodes in the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
После того как NodeGroup | yaml apiVersion: deckhouse.io/v1 kind: NodeGroup metadata: name: ng1 spec: nodeType: CloudEphemeral cloudInstances: maxPerZone: 5 minPerZone: 1 status: conditions:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Шаблоны узлов (labels/taints) для NodeGroup | Example 2. A group of nodes in the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как интерпретировать состояние группы узлов? | yaml apiVersion: deckhouse.io/v1 kind: NodeGroup metadata: name: ng1 spec: nodeType: CloudEphemeral cloudInstances: maxPerZone: 5 minPerZone: 2 status: conditions:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Ready — группа узлов содержит минимально необходимое число запланированных узлов с состоянием | Updating — a node group contains at least one node in which there is an annotation with the prefix update.node.deckhouse.io (for example, update.node.deckhouse.io/waiting-for-approval). | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Пример 1. Группа узлов в состоянии | WaitingForDisruptiveApproval - a node group contains at least one node that has an annotation update.node.deckhouse.io/disruption-required and there is no annotation update.node.deckhouse.io/disruption-approved. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml apiVersion: deckhouse.io/v1 kind: NodeGroup metadata: name: ng1 spec: nodeType: CloudEphemeral cloudInstances: maxPerZone: 5 minPerZone: 1 status: conditions:
| Scaling — calculated only for node groups with the type CloudEphemeral. The state True can be in two cases: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Пример 2. Группа узлов в состоянии |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml apiVersion: deckhouse.io/v1 kind: NodeGroup metadata: name: ng1 spec: nodeType: CloudEphemeral cloudInstances: maxPerZone: 5 minPerZone: 2 status: conditions:
| The desired number of nodes is the sum of all replicas in the node group. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Updating — группа узлов содержит как минимум один узел, в котором присутствует аннотация с префиксом | Example. The desired number of nodes is 2: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
WaitingForDisruptiveApproval — группа узлов содержит как минимум один узел, в котором присутствует аннотация | yaml apiVersion: deckhouse.io/v1 kind: NodeGroup metadata: name: ng1 spec: nodeType: CloudEphemeral cloudInstances: maxPerZone: 5 minPerZone: 2 status: … desired: 2 … | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Scaling — рассчитывается только для групп узлов с типом | Error — contains the last error that occurred when creating a node in a node group. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| How do I make werf ignore the Ready conditions in a node group? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Желаемое число узлов — это сумма всех реплик, входящих в группу узлов. | werf checks the Ready status of resources and, if available, waits for the value to become True. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Пример. Желаемое число узлов равно 2: | Creating (updating) a nodeGroup resource in a cluster can take a significant amount of time to create the required number of nodes. When deploying such a resource in a cluster using werf (e.g., as part of a CI/CD process), deployment may terminate when resource readiness timeout is exceeded. To make werf ignore the nodeGroup status, the following | ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml apiVersion: deckhouse.io/v1 kind: NodeGroup metadata: name: ng1 spec: nodeType: CloudEphemeral cloudInstances: maxPerZone: 5 minPerZone: 2 status: … desired: 2 … | yaml metadata: annotations: werf.io/fail-mode: IgnoreAndContinueDeployProcess werf.io/track-termination-mode: NonBlocking | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Error — содержит последнюю ошибку, возникшую при создании узла в группе узлов. | What is an Instance resource? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Как заставить werf игнорировать состояние Ready в группе узлов? | An Instance resource contains a description of an implementation-independent ephemeral machine resource. For example, machines created by MachineControllerManager or Cluster API Provider Static will have a corresponding Instance resource. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
werf проверяет состояние | The object does not contain a specification. The status contains: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Создание (обновление) ресурса nodeGroup в кластере может потребовать значительного времени на развертывание необходимого количества узлов. При развертывании такого ресурса в кластере с помощью werf (например, в рамках процесса CI/CD) развертывание может завершиться по превышении времени ожидания готовности ресурса. Чтобы заставить werf игнорировать состояние |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml metadata: annotations: werf.io/fail-mode: IgnoreAndContinueDeployProcess werf.io/track-termination-mode: NonBlocking | When a machine is created/deleted, the Instance object is created/deleted accordingly. You cannot create an Instance resource yourself, but you can delete it. In this case, the machine will be removed from the cluster (the removal process depends on implementation details). | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Что такое ресурс Instance? | When is a node reboot required? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Ресурс | Node reboots may be required after configuration changes. For example, after changing certain sysctl settings, specifically when modifying the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Объект не содержит спецификации. Статус содержит: | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
При создании или удалении машины создается или удаляется соответствующий объект Instance.
Самостоятельно ресурс | |||||||||||||||||||||||||||||||||||||||||||||||||||||
Когда требуется перезагрузка узлов? | |||||||||||||||||||||||||||||||||||||||||||||||||||||
Некоторые операции по изменению конфигурации узлов могут потребовать перезагрузки. | |||||||||||||||||||||||||||||||||||||||||||||||||||||
Перезагрузка узла может потребоваться при изменении некоторых настроек sysctl, например, при изменении параметра |