Деплой в закрытом контуре
Варианты развертывания ALT Orchestra в закрытом контуре:
- Организовать локальный контур с сервером сетевой загрузки в одной подсети с узлами кластера. У сервера сетевой загрузки должен быть доступ в интернет, либо на нем надо локально разместить заранее скачанные образы (ядро, initramfs и скрипт ipxe). Далее необходимо выполнять установку по ipxe.
- Развернуть локальный реестр образов с доступом в интернет, скачать в его хранилище необходимые образы с image factory, далее при генерации конфига для инсталляции ALT Orchestra указывать путь к образам в локальном реестре.
Подготовка Стенда
Установка Необходимых Пакетов
# apt-get install -y dhcp-server \
bind \
bind-utils \
chrony \
podman \
docker-registry \
containers-common \
net-tools \
curl \
jq \
podman \
grpcurl \
git \
talosctl \
wget \
yq \
kubernetes1.33-client \
discovery-service-rs \
trivy \
helmНастройка DHCP
Создать каталог для конфигурации сетевого интерфейса ens20:
IFACE="ens20" && mkdir -p /etc/net/ifaces/${IFACE}Назначить статический IPv4-адрес и маску подсети для интерфейса:
# echo 192.168.1.1/24 > /etc/net/ifaces/${IFACE}/ipv4addressНастроить параметры интерфейса (тип, протокол, автозагрузка):
# cat > /etc/net/ifaces/${IFACE}/options <<EOF
TYPE=eth
CONFIG_WIRELESS=no
BOOTPROTO=static
SYSTEMD_BOOTPROTO=static
CONFIG_IPV4=yes
DISABLED=no
NM_CONTROLLED=no
SYSTEMD_CONTROLLED=no
ONBOOT=yes
EOFПерезапустить сетевую службу и проверить назначенные адреса:
# systemctl restart network && ip aСоздать конфигурацию DHCP-сервера с диапазоном адресов и параметрами:
# cat > /etc/dhcp/dhcpd.conf << EOF
option space altlinux;
option altlinux.keydata code 2 = string;
vendor-option-space altlinux;
subnet 192.168.1.0 netmask 255.255.255.0 {
next-server 192.168.1.1;
option routers 192.168.1.1;
option domain-name-servers 192.168.1.1;
option ntp-servers 192.168.1.1;
default-lease-time 3600;
max-lease-time 3600;
range 192.168.1.2 192.168.1.254;
}
EOFВключить автозапуск DHCP-сервера, запустить его и проверить статус:
# systemctl enable --now dhcpd && sleep 5; systemctl status dhcpd --no-pager -lНастройка DNS
Настроить подсети для прослушивания DNS-запросов:
# sed -i 's|listen-on {.*|listen-on { 127.0.0.1; 192.168.1.0/24; };|g' /etc/bind/options.confДобавить зоны прямого и обратного просмотра в конфигурацию BIND:
# cat >> /etc/bind/local.conf <<'EOF'
zone "internal.local" {
type master;
file "/etc/bind/zone/db.internal.local";
allow-update { 192.168.1.0/24; };
};
zone "1.168.192.in-addr.arpa" {
type master;
file "/etc/bind/zone/db.192.168.1";
allow-update { 192.168.1.0/24; };
};
EOFСоздать файл зоны прямого просмотра (A-записи):
# cat > /etc/bind/zone/db.internal.local <<'EOF'
$TTL 604800
@ IN SOA ns1.internal.local. admin.internal.local. (
2025010101 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ; Negative Cache TTL
)
IN NS ns1.internal.local.
ns1 IN A 192.168.1.1
EOFСоздать файл зоны обратного просмотра (PTR-записи):
# cat > /etc/bind/zone/db.192.168.1 <<'EOF'
$TTL 604800
@ IN SOA ns1.internal.local. admin.internal.local. (
2025010101 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ; Negative Cache TTL
)
IN NS ns1.internal.local.
EOFВключить автозапуск BIND, запустить службу и проверить статус:
# systemctl enable --now bind && sleep 5; systemctl status bind --no-pager -lНастройка NTP
Настроить разрешение доступа для всех клиентов и указать NTP-пулы:
# cat >> /etc/chrony.conf <<'EOF'
allow all
pool pool.ntp.org iburst
EOFВключить автозапуск службы Chrony:
# systemctl enable chronydПерезапустить службу Chrony и проверить её статус:
# systemctl restart chronyd && sleep 5; systemctl status chronyd --no-pager -lНастройка Прокси И Кэша Для Необходимых Образов
registry.altlinux.org (по умолчанию)
Настроить клиент Podman:
# cat >> /etc/containers/registries.conf <<'EOF'
[[registry]]
prefix = "registry.altlinux.org"
location = "registry.altlinux.org"
[[registry.mirror]]
prefix = "registry.altlinux.org"
location = "localhost:5000"
insecure = true
EOFНастроить Docker Registry:
# cat > /etc/docker-registry/config.yml << 'EOF'
version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: /var/lib/docker-registry
http:
addr: :5000
headers:
X-Content-Type-Options: [nosniff]
proxy:
remoteurl: https://registry.altlinux.org
EOFПерезагрузить конфигурацию systemd:
# systemctl daemon-reloadВключить автозапуск Docker Registry, запустить службу и проверить статус:
# systemctl enable --now docker-registry.service && sleep 5; systemctl status docker-registry.service --no-pager -lПроверить работу сервиса на порту 5000:
# netstat -nlpt | grep 5000Протестировать прокси-кэш (дополнительные проверки):
$ podman pull --tls-verify=false registry.altlinux.org/p11/kube-apiserver && \
$ curl http://localhost:5000/v2/_catalog | jq && \
$ curl http://localhost:5000/v2/p11/kube-apiserver/tags/list | jq && \
$ podman pull --tls-verify=false localhost:5000/p11/kube-apiserveraltlinux.space
Настроить клиент Podman на использование Docker-Registry https://altlinux.space:
# cat >> /etc/containers/registries.conf <<'EOF'
[[registry]]
prefix = "altlinux.space"
location = "altlinux.space"
[[registry.mirror]]
prefix = "altlinux.space"
location = "localhost:5001"
insecure = true
EOFНастроить сервер Docker-Registry для https://altlinux.space:
# cat > /etc/docker-registry/config-altlinux.yml << 'EOF'
version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: /var/lib/docker-registry
http:
addr: :5001
headers:
X-Content-Type-Options: [nosniff]
proxy:
remoteurl: https://altlinux.space
EOFНастроить systemd-сервис:
# cp /lib/systemd/system/docker-registry.service /lib/systemd/system/docker-registry-altlinux.service
# sed -i 's|config.yml|config-altlinux.yml|g' /lib/systemd/system/docker-registry-altlinux.serviceПрименить изменения и запустить сервис:
# systemctl daemon-reload
# systemctl enable --now docker-registry-altlinux.service && sleep 5; systemctl status docker-registry-altlinux.service --no-pager -lПроверить работу Docker-Registry:
$ netstat -nlpt | grep 5001
$ curl -s http://localhost:5001/v2/_catalog | jqghcr.io
Настроить клиент Podman на использование Docker-Registry https://ghcr.io:
# cat >> /etc/containers/registries.conf <<'EOF'
[[registry]]
prefix = "ghcr.io"
location = "ghcr.io"
[[registry.mirror]]
prefix = "ghcr.io"
location = "localhost:5002"
insecure = true
EOFНастроить сервер Docker-Registry для https://ghcr.io:
# cat > /etc/docker-registry/config-ghcr.yml << 'EOF'
version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: /var/lib/docker-registry
http:
addr: :5002
headers:
X-Content-Type-Options: [nosniff]
proxy:
remoteurl: https://ghcr.io
EOFНастроить systemd-сервис:
# cp /lib/systemd/system/docker-registry.service /lib/systemd/system/docker-registry-ghcr.service
# sed -i 's|config.yml|config-ghcr.yml|g' /lib/systemd/system/docker-registry-ghcr.serviceПрименить изменения и запустить сервис:
# systemctl daemon-reload
# systemctl enable --now docker-registry-ghcr.service && sleep 5; systemctl status docker-registry-ghcr.service --no-pager -lПроверить работу Docker-Registry:
$ netstat -nlpt | grep 5002
$ curl -s http://localhost:5002/v2/_catalog | jqregistry.k8s.io
Настроить клиент Podman на использование Docker-Registry https://registry.k8s.io:
# cat >> /etc/containers/registries.conf <<'EOF'
[[registry]]
prefix = "registry.k8s.io"
location = "registry.k8s.io"
[[registry.mirror]]
prefix = "registry.k8s.io"
location = "localhost:5003"
insecure = true
EOFНастроить сервер Docker-Registry для https://registry.k8s.io:
# cat > /etc/docker-registry/config-k8s.yml << 'EOF'
version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: /var/lib/docker-registry
http:
addr: :5003
headers:
X-Content-Type-Options: [nosniff]
proxy:
remoteurl: https://registry.k8s.io
EOFНастроить systemd-сервис:
# cp /lib/systemd/system/docker-registry.service /lib/systemd/system/docker-registry-k8s.service
# sed -i 's|config.yml|config-k8s.yml|g' /lib/systemd/system/docker-registry-k8s.serviceПрименить изменения и запустить сервис:
# systemctl daemon-reload
# systemctl enable --now docker-registry-k8s.service && sleep 5; systemctl status docker-registry-k8s.service --no-pager -lПроверить работу Docker-Registry:
$ netstat -nlpt | grep 5003
$ curl -s http://localhost:5003/v2/_catalog | jqdocker.io
Настроить клиент Podman на использование Docker-Registry https://docker.io:
# cat >> /etc/containers/registries.conf <<'EOF'
[[registry]]
prefix = "docker.io"
location = "docker.io"
[[registry.mirror]]
prefix = "docker.io"
location = "localhost:5004"
insecure = true
EOFНастроить сервер Docker-Registry для https://docker.io:
# cat > /etc/docker-registry/config-docker.yml << 'EOF'
version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: /var/lib/docker-registry
http:
addr: :5004
headers:
X-Content-Type-Options: [nosniff]
proxy:
remoteurl: https://registry-1.docker.io
EOFНастроить systemd-сервис:
# cp /lib/systemd/system/docker-registry.service /lib/systemd/system/docker-registry-docker.service
# sed -i 's|config.yml|config-docker.yml|g' /lib/systemd/system/docker-registry-docker.serviceПрименить изменения и запустить сервис:
# systemctl daemon-reload
# systemctl enable --now docker-registry-docker.service && sleep 5; systemctl status docker-registry-docker.service --no-pager -lПроверить работу Docker-Registry:
$ netstat -nlpt | grep 5004
$ curl -s http://localhost:5004/v2/_catalog | jqfactory.altlinux.space
Настроить клиент Podman на использование Docker-Registry https://factory.altlinux.space:
# cat >> /etc/containers/registries.conf <<'EOF'
[[registry]]
prefix = "factory.altlinux.space"
location = "factory.altlinux.space"
[[registry.mirror]]
prefix = "factory.altlinux.space"
location = "localhost:5005"
insecure = true
EOFНастроить сервер Docker-Registry для https://factory.altlinux.space:
# cat > /etc/docker-registry/config-factory.yml << 'EOF'
version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: /var/lib/docker-registry
http:
addr: :5005
headers:
X-Content-Type-Options: [nosniff]
proxy:
remoteurl: https://factory.altlinux.space
EOFНастроить systemd-сервис:
# cp /lib/systemd/system/docker-registry.service /lib/systemd/system/docker-registry-factory.service
# sed -i 's|config.yml|config-factory.yml|g' /lib/systemd/system/docker-registry-factory.serviceПрименить изменения и запустить сервис:
# systemctl daemon-reload
# systemctl enable --now docker-registry-factory.service && sleep 5; systemctl status docker-registry-factory.service --no-pager -lПроверить работу Docker-Registry:
$ netstat -nlpt | grep 5005
$ curl -s http://localhost:5005/v2/_catalog | jqНастройка Discovery Service RS
Запустить сервис:
# systemctl enable --now discovery-service-rs.service && sleep 5; systemctl status discovery-service-rs.service --no-pager -lПроверить, что порты прослушиваются:
$ netstat -tulnp | grep '[32]000'Сервис запущен на портах 3000 / 2000:
tcp 0 0 0.0.0.0:2000 0.0.0.0:* LISTEN 1790/discovery-serv
tcp 0 0 0.0.0.0:3000 0.0.0.0:* LISTEN 1790/discovery-servВыполнить тестирование запросом Hello:
$ mkdir -p proto
$ cat > proto/cluster_grpc.proto << 'EOF'
syntax = "proto3";
package sidero.discovery.server;
import "google/protobuf/duration.proto";
service Cluster {
rpc Hello(HelloRequest) returns (HelloResponse);
rpc AffiliateUpdate(AffiliateUpdateRequest) returns (AffiliateUpdateResponse);
rpc AffiliateDelete(AffiliateDeleteRequest) returns (AffiliateDeleteResponse);
rpc List(ListRequest) returns (ListResponse);
rpc Watch(WatchRequest) returns (stream WatchResponse);
}
message Affiliate {
string id = 1;
bytes data = 2;
repeated bytes endpoints = 3;
}
message HelloRequest {
string cluster_id = 1;
string client_version = 2;
}
message RedirectMessage {
string endpoint = 1;
}
message HelloResponse {
optional RedirectMessage redirect = 1;
bytes client_ip = 2;
}
message AffiliateUpdateRequest {
string cluster_id = 1;
string affiliate_id = 2;
optional bytes affiliate_data = 3;
repeated bytes affiliate_endpoints = 4;
google.protobuf.Duration ttl = 5;
}
message AffiliateUpdateResponse {
}
message AffiliateDeleteRequest {
string cluster_id = 1;
string affiliate_id = 2;
}
message AffiliateDeleteResponse {
}
message ListRequest {
string cluster_id = 1;
}
message ListResponse {
repeated Affiliate affiliates = 1;
}
message WatchRequest {
string cluster_id = 1;
}
message WatchResponse {
repeated Affiliate affiliates = 1;
bool deleted = 2;
}
EOF
$ grpcurl -proto cluster_grpc.proto -import-path ./proto -plaintext -d '{"clusterId": "abc", "clientVersion": "v11.0"}' -H 'X-Real-IP: 1.2.3.4' 192.168.1.1:3000 sidero.discovery.server.Cluster/HelloПримерный вывод:
{
"redirect": {},
"clientIp": "AQIDBA=="
}Далее переходим к настройке кластера