Kubernetes the hard way lab setup: различия между версиями
Материал из noname.com.ua
Перейти к навигацииПерейти к поискуSirmax (обсуждение | вклад) |
Sirmax (обсуждение | вклад) |
||
Строка 87: | Строка 87: | ||
* Три ноды которые будут играть роль как master так и worker нод |
* Три ноды которые будут играть роль как master так и worker нод |
||
* Для лучшего понимания для каждого отдельного сервиса будет назначена своя сеть |
* Для лучшего понимания для каждого отдельного сервиса будет назначена своя сеть |
||
+ | |||
+ | ==master1=== |
||
+ | <PRE> |
||
+ | network: |
||
+ | ethernets: |
||
+ | eth0: |
||
+ | dhcp4: false |
||
+ | optional: true |
||
+ | version: 2 |
||
+ | wifis: |
||
+ | wlan0: |
||
+ | access-points: |
||
+ | ssid-name: |
||
+ | password: access-point-password |
||
+ | dhcp4: true |
||
+ | optional: true |
||
+ | vlans: |
||
+ | eth0.101: |
||
+ | id: 101 |
||
+ | link: eth0 |
||
+ | addresses: [ "10.0.11.1/30"] |
||
+ | eth0.102: |
||
+ | id: 102 |
||
+ | link: eth0 |
||
+ | addresses: [ "10.0.12.1/30"] |
||
+ | eth0.103: |
||
+ | id: 103 |
||
+ | link: eth0 |
||
+ | addresses: [ "10.0.13.1/30"] |
||
+ | |||
+ | </PRE> |
||
+ | ==master2== |
||
+ | <PRE> |
||
+ | network: |
||
+ | ethernets: |
||
+ | eth0: |
||
+ | dhcp4: true |
||
+ | optional: true |
||
+ | version: 2 |
||
+ | wifis: |
||
+ | wlan0: |
||
+ | access-points: |
||
+ | ssid-name: |
||
+ | password: access-point-password |
||
+ | dhcp4: true |
||
+ | optional: true |
||
+ | vlans: |
||
+ | eth0.201: |
||
+ | id: 201 |
||
+ | link: eth0 |
||
+ | addresses: [ "10.0.21.1/30"] |
||
+ | eth0.202: |
||
+ | id: 202 |
||
+ | link: eth0 |
||
+ | addresses: [ "10.0.22.1/30"] |
||
+ | eth0.203: |
||
+ | id: 203 |
||
+ | link: eth0 |
||
+ | addresses: [ "10.0.23.1/30"] |
||
+ | |||
+ | </PRE> |
||
+ | ==master3== |
||
+ | <PRE> |
||
+ | network: |
||
+ | ethernets: |
||
+ | eth0: |
||
+ | dhcp4: true |
||
+ | optional: true |
||
+ | version: 2 |
||
+ | wifis: |
||
+ | wlan0: |
||
+ | access-points: |
||
+ | ssid-name: |
||
+ | password: access-point-password |
||
+ | dhcp4: true |
||
+ | optional: true |
||
+ | vlans: |
||
+ | eth0.301: |
||
+ | id: 301 |
||
+ | link: eth0 |
||
+ | addresses: [ "10.0.31.1/30"] |
||
+ | eth0.302: |
||
+ | id: 302 |
||
+ | link: eth0 |
||
+ | addresses: [ "10.0.32.1/30"] |
||
+ | eth0.303: |
||
+ | id: 303 |
||
+ | link: eth0 |
||
+ | addresses: [ "10.0.33.1/30"] |
||
+ | |||
+ | </PRE> |
||
+ | |||
+ | |||
+ | |||
+ | |||
+ | <PRE> |
||
+ | frr version 8.1 |
||
+ | frr defaults traditional |
||
+ | hostname master-az1 |
||
+ | log syslog informational |
||
+ | no ipv6 forwarding |
||
+ | service integrated-vtysh-config |
||
+ | ! |
||
+ | ip route 10.0.21.0/30 10.0.11.2 |
||
+ | ip route 10.0.22.0/30 10.0.12.2 |
||
+ | ip route 10.0.23.0/30 10.0.13.2 |
||
+ | ip route 10.0.31.0/30 10.0.11.2 |
||
+ | ip route 10.0.32.0/30 10.0.12.2 |
||
+ | ip route 10.0.33.0/30 10.0.13.2 |
||
+ | ! |
||
+ | end |
||
+ | </PRE> |
||
+ | |||
+ | <PRE> |
||
+ | master-az2# sh run |
||
+ | Building configuration... |
||
+ | |||
+ | Current configuration: |
||
+ | ! |
||
+ | frr version 8.1 |
||
+ | frr defaults traditional |
||
+ | hostname master-az2 |
||
+ | log syslog informational |
||
+ | no ipv6 forwarding |
||
+ | service integrated-vtysh-config |
||
+ | ! |
||
+ | ip route 10.0.11.0/30 10.0.21.2 |
||
+ | ip route 10.0.12.0/30 10.0.22.2 |
||
+ | ip route 10.0.13.0/30 10.0.23.2 |
||
+ | ip route 10.0.31.0/30 10.0.21.2 |
||
+ | ip route 10.0.32.0/30 10.0.22.2 |
||
+ | ip route 10.0.33.0/30 10.0.23.2 |
||
+ | ! |
||
+ | end |
||
+ | </PRE> |
||
+ | |||
+ | <PRE> |
||
+ | master-az3# show run |
||
+ | Building configuration... |
||
+ | |||
+ | Current configuration: |
||
+ | ! |
||
+ | frr version 8.1 |
||
+ | frr defaults traditional |
||
+ | hostname master-az3 |
||
+ | log syslog informational |
||
+ | no ipv6 forwarding |
||
+ | service integrated-vtysh-config |
||
+ | ! |
||
+ | ip route 10.0.11.0/30 10.0.31.2 |
||
+ | ip route 10.0.12.0/30 10.0.32.2 |
||
+ | ip route 10.0.13.0/30 10.0.33.2 |
||
+ | ip route 10.0.21.0/30 10.0.31.2 |
||
+ | ip route 10.0.22.0/30 10.0.32.2 |
||
+ | ip route 10.0.23.0/30 10.0.33.2 |
||
+ | ! |
||
+ | end |
||
+ | </PRE> |
||
=Worker Nodes= |
=Worker Nodes= |
Версия 10:24, 21 сентября 2022
Настойка лаборатории для K8s
Касается всех нод
- Hardware: RaspberryPi 4, 8GB
- OS: Ubuntu 22.04
Пакеты
apt -y install mc apt -y install iw apt -y install i2c-tools apt -y install python3-smbus python3-netifaces python3-willow apt -y install python3-rpi.gpio apt -y install net-tools apt -y install frr
Ядро
uname -a Linux master-az3 5.15.0-1014-raspi #16-Ubuntu SMP PREEMPT Thu Aug 25 09:50:55 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux
Температура и управление вентилятором
systemctl enable poe-hat-screen.service
unattended-upgrades
dpkg-reconfigure unattended-upgrades
nano /etc/apt/apt.conf.d/20auto-upgrades APT::Periodic::Download-Upgradeable-Packages "0"; APT::Periodic::AutocleanInterval "0"; APT::Periodic::Update-Package-Lists "0"; APT::Periodic::Unattended-Upgrade "0";
Схема сети
+--------------+ +--------------------- | Master 1 eth0 | Catalyst 3560G | | | | eth0.101 -- 10.0.11.1/30------VLAN101---10.0.11.2/30 ---+ wifi0-+ | | | eth0.102 -- 10.0.12.1/30------VLAN102---10.0.12.2/30 ---+ Gi 0/43 | | | | eth0.103 -- 10.0.13.1/30------VLAN101---10.0.13.2/30 ---+ | | | | | | +--------------+ | | +--------------+ | | Master 2 eth0 | | | | | eth0.201 -- 10.0.21.1/30------VLAN201---10.0.21.2/30 ---+ wifi0-+ | | | eth0.202 -- 10.0.22.1/30------VLAN202---10.0.22.2/30 ---+ Gi 0/44 | | | | eth0.203 -- 10.0.23.1/30------VLAN201---10.0.23.2/30 ---+ | | | | | | +--------------+ | | +--------------+ | | Master 3 eth0 | | | | | eth0.301 -- 10.0.31.1/30------VLAN301---10.0.31.2/30 ---+ wifi0-+ | | | eth0.302 -- 10.0.32.1/30------VLAN302---10.0.32.2/30 ---+ Gi 0/45 | | | | eth0.303 -- 10.0.33.1/30------VLAN301---10.0.33.2/30 ---+ | | | | | | +--------------+ +---------------------
WiFi0 используется исключительно для настройки, в процессе работы никакой траффик через него ходить не будет
- В номерах VLAN для каждой ноды используется номер ноды что бы проще было запомнить
- Vlan 101, 201, 301 - используется для etcd
Master Nodes
- Три ноды которые будут играть роль как master так и worker нод
- Для лучшего понимания для каждого отдельного сервиса будет назначена своя сеть
master1=
network: ethernets: eth0: dhcp4: false optional: true version: 2 wifis: wlan0: access-points: ssid-name: password: access-point-password dhcp4: true optional: true vlans: eth0.101: id: 101 link: eth0 addresses: [ "10.0.11.1/30"] eth0.102: id: 102 link: eth0 addresses: [ "10.0.12.1/30"] eth0.103: id: 103 link: eth0 addresses: [ "10.0.13.1/30"]
master2
network: ethernets: eth0: dhcp4: true optional: true version: 2 wifis: wlan0: access-points: ssid-name: password: access-point-password dhcp4: true optional: true vlans: eth0.201: id: 201 link: eth0 addresses: [ "10.0.21.1/30"] eth0.202: id: 202 link: eth0 addresses: [ "10.0.22.1/30"] eth0.203: id: 203 link: eth0 addresses: [ "10.0.23.1/30"]
master3
network: ethernets: eth0: dhcp4: true optional: true version: 2 wifis: wlan0: access-points: ssid-name: password: access-point-password dhcp4: true optional: true vlans: eth0.301: id: 301 link: eth0 addresses: [ "10.0.31.1/30"] eth0.302: id: 302 link: eth0 addresses: [ "10.0.32.1/30"] eth0.303: id: 303 link: eth0 addresses: [ "10.0.33.1/30"]
frr version 8.1 frr defaults traditional hostname master-az1 log syslog informational no ipv6 forwarding service integrated-vtysh-config ! ip route 10.0.21.0/30 10.0.11.2 ip route 10.0.22.0/30 10.0.12.2 ip route 10.0.23.0/30 10.0.13.2 ip route 10.0.31.0/30 10.0.11.2 ip route 10.0.32.0/30 10.0.12.2 ip route 10.0.33.0/30 10.0.13.2 ! end
master-az2# sh run Building configuration... Current configuration: ! frr version 8.1 frr defaults traditional hostname master-az2 log syslog informational no ipv6 forwarding service integrated-vtysh-config ! ip route 10.0.11.0/30 10.0.21.2 ip route 10.0.12.0/30 10.0.22.2 ip route 10.0.13.0/30 10.0.23.2 ip route 10.0.31.0/30 10.0.21.2 ip route 10.0.32.0/30 10.0.22.2 ip route 10.0.33.0/30 10.0.23.2 ! end
master-az3# show run Building configuration... Current configuration: ! frr version 8.1 frr defaults traditional hostname master-az3 log syslog informational no ipv6 forwarding service integrated-vtysh-config ! ip route 10.0.11.0/30 10.0.31.2 ip route 10.0.12.0/30 10.0.32.2 ip route 10.0.13.0/30 10.0.33.2 ip route 10.0.21.0/30 10.0.31.2 ip route 10.0.22.0/30 10.0.32.2 ip route 10.0.23.0/30 10.0.33.2 ! end