How do I add a master nodes to a cloud cluster (single-master to a multi-master)? | |||||||||||||||||||||||||||||||||||||||||||||||||||||
Как добавить master-узлы в облачном кластере? | |||||||||||||||||||||||||||||||||||||||||||||||||||||
How do I reduce the number of master nodes in a cloud cluster (multi-master to single-master)? | Как конвертировать кластер с одним master-узлом в мультикластерный описано в FAQ модуля control-plane-manager. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Static nodes | Как уменьшить число master-узлов в облачном кластере? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Как конвертировать мультимастерный кластер в кластер с одним 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)? |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
To add a static node to a cluster (bare metal server or virtual machine), follow these steps: | Добавить статический узел в кластер можно вручную (пример) или с помощью Cluster API Provider Static. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Как добавить статический узел в кластер (Cluster API Provider Static)? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Чтобы добавить статический узел в кластер (сервер bare-metal или виртуальную машину), выполните следующие шаги: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell useradd -m -s /bin/bash caps usermod -aG sudo caps |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell caps ALL=(ALL) NOPASSWD: ALL | shell useradd -m -s /bin/bash caps usermod -aG sudo caps | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell sudo systemctl restart sshd | shell caps ALL=(ALL) NOPASSWD: ALL | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell ssh-keygen -t rsa -f caps-id -C “” -N “” | shell sudo systemctl restart sshd | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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/ | Приватный и публичный ключи будут сохранены в файлах | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
An example of adding a static node. | 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/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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 (пример | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell kubectl -n default get ep kubernetes -o json | jq ‘.subsets[0].addresses[0].ip + “:” + (.subsets[0].ports[0].port | tostring)’ -r | Автоматизировать процесс добавления узлов можно с помощью любой платформы автоматизации. Далее приведен пример для Ansible. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Check the K8s version. If the version >= 1.25, create |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell kubectl create token node-group –namespace d8-cloud-instance-manager –duration 1h | shell kubectl -n default get ep kubernetes -o json | jq ‘.subsets[0].addresses[0].ip + “:” + (.subsets[0].ports[0].port | tostring)’ -r | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Save the token you got and add it to the | Проверьте версию K8s. Если версия >= 1.25, создайте токен | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
[worker] worker-0 worker-1 | text [system] system-0 system-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
[worker:vars] node_group=worker | [system:vars] node_group=system | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| [worker] worker-0 worker-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
How do I clean up a static node manually? | [worker:vars] node_group=worker | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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 |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Can I delete a StaticInstance? | Инструкция справедлива как для узла, настроенного вручную (с помощью бутстрап-скрипта), так и для узла, настроенного с помощью CAPS. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
A | Чтобы вывести из кластера узел и очистить сервер (ВМ), выполните следующую команду на узле: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
To delete a | shell bash /var/lib/bashible/cleanup_static_node.sh –yes-i-am-sane-and-i-understand-what-i-am-doing | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Можно ли удалить 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? |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
You need to clean up the node, then hand over the node under CAPS control. | Как изменить IP-адрес StaticInstance? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
How do I change the NodeGroup of a static node? | Изменить IP-адрес в ресурсе | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Note that if a node is under CAPS control, you cannot change the | Как мигрировать статический узел настроенный вручную под управление CAPS? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
To switch an existing manually created static node to another | Необходимо выполнить очистку узла, затем добавить узел под управление CAPS. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell
kubectl label node –overwrite | Как изменить NodeGroup у статического узла? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Applying the changes will take some time. |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
How to clean up a node for adding to the cluster? | Если узел находится под управлением CAPS, то изменить принадлежность к | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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. | Чтобы перенести существующий статический узел созданный вручную из одной | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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 label node –overwrite | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Применение изменений потребует некоторого времени. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell
kubectl drain | Как очистить узел для последующего ввода в кластер? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Это необходимо только в том случае, если нужно переместить статический узел из одного кластера в другой. Имейте в виду, что эти операции удаляют данные локального хранилища. Если необходимо просто изменить | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell bash /var/lib/bashible/cleanup_static_node.sh –yes-i-am-sane-and-i-understand-what-i-am-doing | Если на зачищаемом узле есть пулы хранения LINSTOR/DRBD, то предварительно перенесите ресурсы с узла и удалите узел LINSTOR/DRBD, следуя инструкции. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
How do I know if something went wrong? | shell
kubectl drain | ||||||||||||||||||||||||||||||||||||||||||||||||||||
If a node in a nodeGroup is not updated (the value of |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
To view the logs of the | shell bash /var/lib/bashible/cleanup_static_node.sh –yes-i-am-sane-and-i-understand-what-i-am-doing | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell journalctl -fu bashible |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Example of output when the | Как понять, что что-то пошло не так? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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. | Если узел в NodeGroup не обновляется (значение | ||||||||||||||||||||||||||||||||||||||||||||||||||||
How do I know what is running on a node while it is being created? | Чтобы проверить логи сервиса | ||||||||||||||||||||||||||||||||||||||||||||||||||||
You can analyze | shell journalctl -fu bashible | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Пример вывода, когда все необходимые действия выполнены: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell kubectl get instances | grep Pending | 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. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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 | shell kubectl get instances | grep Pending | ||||||||||||||||||||||||||||||||||||||||||||||||||||
An example: | Пример: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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 | grep Pending dev-worker-2a6158ff-6764d-nrtbj Pending 46s | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
The logs of the initial node configuration are located at | shell kubectl get instances dev-worker-2a6158ff-6764d-nrtbj -o yaml | grep ‘bootstrapStatus’ -B0 -A2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
How do I update kernel on nodes? | Пример: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Debian-based distros | 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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Create a |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml apiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: install-kernel.sh spec: bundles:
| Логи первоначальной настройки узла находятся в | ||||||||||||||||||||||||||||||||||||||||||||||||||||
desired_version=”5.15.0-53-generic” | Как обновить ядро на узлах? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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 } | Для дистрибутивов, основанных на Debian | ||||||||||||||||||||||||||||||||||||||||||||||||||||
version_in_use=”$(uname -r)” | Создайте ресурс | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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=”5.15.0-53-generic” | ||||||||||||||||||||||||||||||||||||||||||||||||||||
CentOS-based distros | 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 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Create a | 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-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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
version_in_use=”$(uname -r)” | Создайте ресурс | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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-yum-install “kernel-${desired_version}” | desired_version=”3.10.0-1160.42.2.el7.x86_64” | ||||||||||||||||||||||||||||||||||||||||||||||||||||
NodeGroup parameters and their result | 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)” | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Refer to the description of the NodeGroup custom resource for more information about the parameters. | if [[ “$version_in_use” == “$desired_version” ]]; then exit 0 fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Changing the | bb-deckhouse-get-disruptive-update-approval bb-yum-install “kernel-${desired_version}” | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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. | Какие параметры NodeGroup к чему приводят? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
How do I redeploy ephemeral machines in the cloud with a new configuration? |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
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 | Подробно о всех параметрах можно прочитать в описании кастомного ресурса NodeGroup. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
To force the redeployment of all Machines, you need to add/modify the | В случае изменения параметров | ||||||||||||||||||||||||||||||||||||||||||||||||||||
How do I allocate nodes to specific loads? | При обновлении, которое требует прерывания работы узла (disruption update), выполняется процесс вытеснения подов с узла. Если какой-либо под не может быть вытеснен, попытка повторяется каждые 20 секунд до достижения глобального таймаута в 5 минут. После истечения этого времени, поды, которые не удалось вытеснить, удаляются принудительно. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
You cannot use the | Как пересоздать эфемерные машины в облаке с новой конфигурацией? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
There are two ways to solve this problem: | При изменении конфигурации Deckhouse (как в модуле | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Чтобы принудительно пересоздать все узлы, связанные с ресурсом | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Deckhouse tolerates the | Как выделить узлы под специфические нагрузки? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
To use custom keys for | Запрещено использование домена | ||||||||||||||||||||||||||||||||||||||||||||||||||||
How to allocate nodes to system components? | Для решений данной задачи существуют два механизма: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Frontend |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
For Ingress controllers, use the | Deckhouse по умолчанию поддерживает использование taint’а с ключом | ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml nodeTemplate: labels: node-role.deckhouse.io/frontend: “” taints:
| Если требуется использовать другие ключи для taints (например, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
System components | Подробности в статье на Habr. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Как выделить узлы под системные компоненты? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml nodeTemplate: labels: node-role.deckhouse.io/system: “” taints:
| Фронтенд | ||||||||||||||||||||||||||||||||||||||||||||||||||||
How do I speed up node provisioning on the cloud when scaling applications horizontally? | Для Ingress-контроллеров используйте | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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. | yaml nodeTemplate: labels: node-role.deckhouse.io/frontend: “” taints:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Here is how you should configure the target | Системные | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Для компонентов подсистем Deckhouse параметр | ||||||||||||||||||||||||||||||||||||||||||||||||||||
An example: | yaml nodeTemplate: labels: node-role.deckhouse.io/system: “” taints:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
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 | Пример: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
How do I restore the master node if kubelet cannot load the control plane components? | yaml cloudInstances: maxPerZone: 10 minPerZone: 1 standby: 10% standbyHolder: overprovisioningRate: 30% | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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 | Как выключить machine-controller-manager в случае выполнения потенциально деструктивных изменений в кластере? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Below is an instruction on how you can restore the master node. | Использовать эту настройку допустимо только тогда, когда вы четко понимаете, зачем это необходимо. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
containerd | Для того чтобы временно отключить machine-controller-manager (MCM) и предотвратить его автоматические действия, которые могут повлиять на инфраструктуру кластера (например, удаление или пересоздание узлов), установите следующий параметр в конфигурации: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Execute the following command to restore the master node in any cluster running under Deckhouse: | yaml mcmEmergencyBrake: true | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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-узел, если kubelet не может загрузить компоненты control plane? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Copy the command’s output and use it for setting the | Подобная ситуация может возникнуть, если в кластере с одним master-узлом на нем были удалены образы компонентов control plane (например, удалена директория | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Next, you need to pull images of | Далее приведена инструкция по восстановлению master-узла. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell for image in $(grep “image:” /etc/kubernetes/manifests/* | awk ‘{print $3}’); do crictl pull –auth $AUTH $image done | containerd | ||||||||||||||||||||||||||||||||||||||||||||||||||||
You need to restart | Для восстановления работоспособности master-узла нужно в любом рабочем кластере под управлением Deckhouse выполнить команду: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
How to change CRI for NodeGroup? | shell kubectl -n d8-system get secrets deckhouse-registry -o json | jq -r ‘.data.”.dockerconfigjson”’ | base64 -d | jq -r ‘.auths.”registry.deckhouse.io”.auth’ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
CRI can only be switched from | Вывод команды нужно скопировать и присвоить переменной | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Set NodeGroup | Далее на поврежденном master-узле нужно загрузить образы компонентов | ||||||||||||||||||||||||||||||||||||||||||||||||||||
NodeGroup YAML example: | shell for image in $(grep “image:” /etc/kubernetes/manifests/* | awk ‘{print $3}’); do crictl pull –auth $AUTH $image done | ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml apiVersion: deckhouse.io/v1 kind: NodeGroup metadata: name: worker spec: nodeType: Static cri: type: Containerd | После загрузки образов необходимо перезапустить | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Also, this operation can be done with patch: | Как изменить CRI для NodeGroup? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Смена CRI возможна только между | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell
kubectl patch nodegroup | Для изменения CRI для NodeGroup, установите параметр cri.type в | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Пример YAML-манифеста NodeGroup: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell
kubectl patch nodegroup | yaml apiVersion: deckhouse.io/v1 kind: NodeGroup metadata: name: worker spec: nodeType: Static cri: type: Containerd | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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 |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
How to change CRI for the whole cluster? | shell kubectl patch nodegroup <имя NodeGroup=""> --type merge -p '{"spec":{"cri":{"type":"Containerd"}}}' | ||||||||||||||||||||||||||||||||||||||||||||||||||||
CRI can only be switched from |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
It is necessary to use the | shell kubectl patch nodegroup <имя NodeGroup=""> --type merge -p '{"spec":{"cri":{"type":"NotManaged"}}}' | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Also, this operation can be done with the following patch: | При изменении | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| После изменения CRI для NodeGroup модуль | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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"}}” | Для изменения CRI для всего кластера, необходимо с помощью утилиты | ||||||||||||||||||||||||||||||||||||||||||||||||||||
If it is necessary to leave some NodeGroup on another CRI, then before changing the | Также возможно выполнить эту операцию с помощью | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Changing |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
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/NotManaged/Containerd/” | 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 | 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"}}” | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Если необходимо, чтобы отдельные NodeGroup использовали другой CRI, перед изменением | ||||||||||||||||||||||||||||||||||||||||||||||||||||
shell
kubectl annotate node | Изменение | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| При изменении CRI в кластере для master-узлов необходимо выполнить дополнительные шаги: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
How to add node configuration step? |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Additional node configuration steps are set via the NodeGroupConfiguration custom resource. | 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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
How to automatically put custom labels on the node? |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
| shell kubectl annotate node <имя master-узла=""> update.node.deckhouse.io/disruption-approved= | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Как добавить шаг для конфигурации узлов? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
console example-label=test | Дополнительные шаги для конфигурации узлов задаются с помощью кастомного ресурса NodeGroupConfiguration. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Как автоматически проставить на узел кастомные лейблы? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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? |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Create NodeGroup for GPU-nodes. | console example-label=test | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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 | При добавлении узла в кластер указанные в файлах лейблы будут автоматически проставлены на узел. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml apiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: containerd-additional-config.sh spec: bundles:
| Обратите внимание, что добавить таким образом лейблы, использующиеся в DKP, невозможно. Работать такой метод будет только с кастомными лейблами, не пересекающимися с зарезервированными для Deckhouse. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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:
| Как использовать containerd с поддержкой Nvidia GPU? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Create NodeGroupConfiguration for Nvidia drivers setup on NodeGroup | Необходимо создать отдельную NodeGroup для GPU-узлов: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Ubuntu | yaml apiVersion: deckhouse.io/v1 kind: NodeGroup metadata: name: gpu spec: chaos: mode: Disabled disruptions: approvalMode: Automatic nodeType: CloudStatic | ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml apiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: install-cuda.sh spec: bundles:
| Далее создайте NodeGroupConfiguration для NodeGroup | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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:
| yaml apiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: containerd-additional-config.sh spec: bundles:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Centos | 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:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml apiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: install-cuda.sh spec: bundles:
| Добавьте NodeGroupConfiguration для установки драйверов Nvidia для NodeGroup | ||||||||||||||||||||||||||||||||||||||||||||||||||||
if [ ! -f “/etc/yum.repos.d/nvidia-container-toolkit.repo” ]; then
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
| Ubuntu | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Bootstrap and reboot node. | yaml apiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: install-cuda.sh spec: bundles:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
How to check if it was successful? | 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:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Deploy the Job: | Centos | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: install-cuda.sh spec: bundles:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
And check the logs: | if [ ! -f “/etc/yum.repos.d/nvidia-container-toolkit.repo” ]; then
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
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 | +—————————————————————————–+ | Как проверить, что все прошло успешно? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Deploy the Job: | Создайте в кластере Job: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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:
| 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:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
And check the logs: | Проверьте логи командой: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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 | 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 | +——————————-+———————-+———————-+ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
How to deploy custom containerd configuration? | +—————————————————————————–+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=============================================================================| | No running processes found | +—————————————————————————–+ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
The example of | Создайте в кластере Job: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Adding custom settings causes a restart of the | 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:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Bashible on nodes merges main Deckhouse containerd config with configs from | Проверьте логи командой: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
You can override the values of the parameters that are specified in the file | 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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml apiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: containerd-option-config.sh spec: bundles:
| Как развернуть кастомный конфигурационный файл containerd? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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? | Добавление кастомных настроек вызывает перезапуск сервиса | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Deploy | Bashible на узлах объединяет конфигурацию containerd для Deckhouse с конфигурацией из файла | ||||||||||||||||||||||||||||||||||||||||||||||||||||
yamlapiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: containerd-additional-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:
| yaml apiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: containerd-option-config.sh spec: bundles:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
How to configure a certificate for an additional registry? | 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:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
In addition to containerd, the certificate can be simultaneously added into the OS. | Как добавить авторизацию в дополнительный registry? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Example of the | Разверните скрипт | ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml apiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: configure-cert-containerd.sh spec: bundles:
| yaml apiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: containerd-additional-config.sh spec: bundles:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
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 ) | 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:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
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 ) | Как настроить сертификат для дополнительного registry? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
mkdir -p ${CERTS_FOLDER} mkdir -p /etc/containerd/conf.d | Помимо containerd, сертификат можно одновременно добавить и в операционной системе. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
bb-tmp-file - Create temp file function. More information: http://www.bashbooster.net/#tmp | Пример | ||||||||||||||||||||||||||||||||||||||||||||||||||||
CERT_TMP_FILE=”$( bb-tmp-file )”
echo -e “${CERT_CONTENT}” > “${CERT_TMP_FILE}” | yaml apiVersion: deckhouse.io/v1alpha1 kind: NodeGroupConfiguration metadata: name: configure-cert-containerd.sh spec: bundles:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
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 | 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 | 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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
How to use NodeGroup’s priority feature | bb-tmp-file - Create temp file function. More information: http://www.bashbooster.net/#tmp | ||||||||||||||||||||||||||||||||||||||||||||||||||||
The priority field of the | CERT_TMP_FILE=”$( bb-tmp-file )”
echo -e “${CERT_CONTENT}” > “${CERT_TMP_FILE}” | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Here is an example of creating two | 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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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, | bb-sync-file
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Once the | Как использовать NodeGroup с приоритетом? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Note that node templates (labels/taints) for | С помощью параметра priority кастомного ресурса | ||||||||||||||||||||||||||||||||||||||||||||||||||||
How to interpret Node Group states? | Пример создания двух | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Ready — the node group contains the minimum required number of scheduled nodes with the status Ready for all zones. | 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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Example 1. A group of nodes in the | В приведенном выше примере, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml apiVersion: deckhouse.io/v1 kind: NodeGroup metadata: name: ng1 spec: nodeType: CloudEphemeral cloudInstances: maxPerZone: 5 minPerZone: 1 status: conditions:
| После того как NodeGroup | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Example 2. A group of nodes in the | Шаблоны узлов (labels/taints) для NodeGroup | ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml apiVersion: deckhouse.io/v1 kind: NodeGroup metadata: name: ng1 spec: nodeType: CloudEphemeral cloudInstances: maxPerZone: 5 minPerZone: 2 status: conditions:
| Как интерпретировать состояние группы узлов? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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). | Ready — группа узлов содержит минимально необходимое число запланированных узлов с состоянием | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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. | Пример 1. Группа узлов в состоянии | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Scaling — calculated only for node groups with the type CloudEphemeral. The state True can be in two cases: | yaml apiVersion: deckhouse.io/v1 kind: NodeGroup metadata: name: ng1 spec: nodeType: CloudEphemeral cloudInstances: maxPerZone: 5 minPerZone: 1 status: conditions:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Пример 2. Группа узлов в состоянии | ||||||||||||||||||||||||||||||||||||||||||||||||||||
The desired number of nodes is the sum of all replicas in the node group. | yaml apiVersion: deckhouse.io/v1 kind: NodeGroup metadata: name: ng1 spec: nodeType: CloudEphemeral cloudInstances: maxPerZone: 5 minPerZone: 2 status: conditions:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Example. The desired number of nodes is 2: | Updating — группа узлов содержит как минимум один узел, в котором присутствует аннотация с префиксом | ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml apiVersion: deckhouse.io/v1 kind: NodeGroup metadata: name: ng1 spec: nodeType: CloudEphemeral cloudInstances: maxPerZone: 5 minPerZone: 2 status: … desired: 2 … | WaitingForDisruptiveApproval — группа узлов содержит как минимум один узел, в котором присутствует аннотация | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Error — contains the last error that occurred when creating a node in a node group. | Scaling — рассчитывается только для групп узлов с типом | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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. | Желаемое число узлов — это сумма всех реплик, входящих в группу узлов. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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 | Пример. Желаемое число узлов равно 2: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
yaml metadata: annotations: werf.io/fail-mode: IgnoreAndContinueDeployProcess werf.io/track-termination-mode: NonBlocking | yaml apiVersion: deckhouse.io/v1 kind: NodeGroup metadata: name: ng1 spec: nodeType: CloudEphemeral cloudInstances: maxPerZone: 5 minPerZone: 2 status: … desired: 2 … | ||||||||||||||||||||||||||||||||||||||||||||||||||||
What is an Instance resource? | Error — содержит последнюю ошибку, возникшую при создании узла в группе узлов. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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 игнорировать состояние Ready в группе узлов? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
The object does not contain a specification. The status contains: | werf проверяет состояние | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Создание (обновление) ресурса nodeGroup в кластере может потребовать значительного времени на развертывание необходимого количества узлов. При развертывании такого ресурса в кластере с помощью werf (например, в рамках процесса CI/CD) развертывание может завершиться по превышении времени ожидания готовности ресурса. Чтобы заставить werf игнорировать состояние | ||||||||||||||||||||||||||||||||||||||||||||||||||||
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). | yaml metadata: annotations: werf.io/fail-mode: IgnoreAndContinueDeployProcess werf.io/track-termination-mode: NonBlocking | ||||||||||||||||||||||||||||||||||||||||||||||||||||
When is a node reboot required? | Что такое ресурс Instance? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Node reboots may be required after configuration changes. For example, after changing certain sysctl settings, specifically when modifying the | Ресурс | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Объект не содержит спецификации. Статус содержит: | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
При создании или удалении машины создается или удаляется соответствующий объект Instance.
Самостоятельно ресурс | |||||||||||||||||||||||||||||||||||||||||||||||||||||
Когда требуется перезагрузка узлов? | |||||||||||||||||||||||||||||||||||||||||||||||||||||
Некоторые операции по изменению конфигурации узлов могут потребовать перезагрузки. | |||||||||||||||||||||||||||||||||||||||||||||||||||||
Перезагрузка узла может потребоваться при изменении некоторых настроек sysctl, например, при изменении параметра |