Tafula ra Swilo leswi nga endzeni
- Xitori
- Pulani ya kona
- Turing Pi 2. Xihlamusela-marito
- Xiyimiso xa kona
- The Flashing
- Vuhlayiselo bya Vuhlayiselo
- Va ka Kubernetes
- Swikombelo swa kona
- Ku aka ko hetelela
- Vumundzuku
- Makumu
Xitori
Hi June 2022, ndzi hlangane na mayelana na bodo leyi kotaka ku va na ku fika eka 4 hi nkarhi wun’we. Handle ko anakanyisisa ngopfu, ndzi endle xiboho xo seketela ntirho lowu ivi ndzi xava bodo.
Fast-forward two years, na ya mina a ya ha tshamile yi nga pfuriwanga ebokisini ra yona exifelefiniVutomi a byi nghene endleleni, naswona a ndzi nga tiyiseki leswaku hikokwalaho ka yini ndzi yi xavile eku sunguleni. Hambiswiritano, ndzi hetelele ndzi endle xiboho xo ringeta. A ndzi lava ku dyondza swo tala hi ku hlengeletiwa naswona a ndzi nga si tshama ndzi aka xitluletsongo lexi heleleke ku suka eka xiyimo xa le hansi. Kutani, ndzi nghene eka movha wo tirhisa mali kutani ndzi kuma ti-Raspberry Pi 4 tinharhu (8GB RAM, 8GB internal storage) na yin’we ya (4GB).
Loko hi languta ku cinca-cinca ka bodo, ndzi nga hlanganisa Timojula to hambana ta Compute. Ndzi endle xiboho xo katsa Jetson Nano, ndzi ehleketa leswaku yi nga ndzi pfumelela ku ringeta vachayeri va CUDA enkarhini lowu taka ni ku nghenelela eka ku dyondza hi muchini. I mani la tivaka? Ndzi nga ha hetelela ndzi rhurhe mupfuni wa mina wa GPT eka xitluletsongo lexi xa Kubernetes. (Spoilers: It didn't happen)
Pulani ya kona
Pulani ya mina yo sungula a yi katsa 3 Pi 4 CM na Jetson Nano leyi khomiweke eka bodo. Nakambe, ndzi kunguhate ku tirhisa 1TB SSD drive ku hlayisa na khadi ra Wi-Fi ku nghena eka inthanete. Kambe endzhaku ko hlangana na swiphiqo swo tala eka endlelo ro veka Jetson Nano na matsalwa ya yona yo biha, ndzi endle xiboho xo yi tlherisela. Ematshan’weni ya sweswo, ndzi hlawule Raspberry Pi 4 ya vumune.
Ku engetela kwalaho, a ndzi ri na Raspberry Pi 4 ya khale leyi a yi ri na 4GB ya RAM leyi a yi etlele, kutani ndzi endle xiboho xo yi nghenisa tanihi node ya vuntlhanu.
Turing Pi 2. Xihlamusela-marito
Turing Pi 2 i bodo ya Mini ITX form factor leyi nga amukelaka ku fika eka mune wa ti Raspberry Pi Compute Modules (na yona yi fambisana na Jetson Nanos na Turing Compute Module). Yi na xipfalo xa PCI Express, swipfalo swimbirhi swa NVME, swipfalo swimbirhi swa SATA, na xipfalo xa USB xo flashing Compute Modules.
Eku heteleleni, mianakanyo i ku rhurhela Media Server na swin’wana leswi engetelekeke.
Ku Vekiwa ka Swilo
Se ku hundze nkarhi ndzi nga si hlanganisa khompyuta, naswona a ku ri ro sungula ndzi tlanga hi Compute Modules na ti adapter ta tona, kutani sweswo a swi tsakisa ngopfu eka mahelo ya vhiki. Leswi xipachi xa mina a xi hisa kambe xa ha nga pfurhi, ndzi ehlekete leswaku, why the hell not add a nice case for it? Hi ku nyikiwa xivumbeko xa Mini ITX xa bodo, ndzi nga yi nghenisa eka xigwitsirisi xihi na xihi xa ITX xo saseka lexi ndzi nga xi kumaka eka Amazon. yi ndzi endle ndzi hundza. Se a ndzi endla DIY cluster, case leyinene ya nchumu wo tano, a ku ri DIY na yona. Ndzi tlhele ndzi engetela mphakelo wa gezi wa 650W (total overkill), khadi rin’we leritsongo ra Wi-Fi Mini PCI Express, na 1TB SATA SSD.
Ku veka ‘nchumu’ swin’we a swi olova swinene. Xiphemu xa thermal paste exikarhi ka Compute Modules na ti heat sinks ta tona naku ti khoma swin’we na ti Adapter ta tona loko tinga se ti veka hiku landzelelana eka Turing Board; Ndzi boxe oda hikuva a ku ri xiphemu xa nkoka xa ntirho lowu. Turing Pi 2 yi nyika vulawuri bya tiphurotho ta yona leti hangalasiweke eka mimojula hinkwayo ya xibalo. Eka xiyimo lexi, PCI Express 1 a yi lawuriwa hi node yo Sungula kasi SSD drive a yi lawuriwa hi ya vunharhu. 2nd a yi kota ku khoma NVME port na 4th eka SSD IIRC yin’wana, kambe a ndzi nga ri na vuyelo eka vona sweswi.
The Flashing
Ndzi tshame ndzi nghenisa Raspberry Pis kambe a ndzi si tshama ndzi nghenisa Compute Modules. Turing Pi 2 yina USB port endzhaku leyi tirhisiwaka ku flasha Compute Modules.
Khombo ra kona, ndzi ringetile ku tirhisa khebulu ya USB A ku ya eka USB A leyi a yi nga ri khebulu yo hundzisela data, kutani loko ndzi rindzele leswaku Amazon yi tisa khebulu, ndzi kume ndlela yin’wana yo voninga Timojula ta Compute.
Turing Pi 2 yina xitirhisiwa xa CLI lexi nga tirhisiwiki ntsena ku flash ti Compute Modules kambe na ku lawula matimba ya tona, ku ti reset, ku kambela ti stats tin’wana, na swin’wana.
Xileriso lexi tirhisiweke ku nghenisa Timojula ta Xibalo a ku ri:
tpi flash -i /path/to/image -n {nodes 1 to 4}
Pretty straightforward process ndzi ti ehlekete hi mbilu ndzi nga si swi vona leswaku xifaniso xa Raspbian a xi ti na SSH leyi pfuriweke hi ku tiyimisela. Leswi, i ntiyiso, a hi vutihlamuleri bya Turing. A ndzi fanele ndzi yimele khebulu yoleyo, kambe oh well.
Ku lulamisa leswi, ndzi boheke ku khandziya xifaniso eka muchini wa mina wa laha kaya ivi ndzi engetela fayili leyi nga riki na nchumu leyi vuriwaka ssh
eka xiphemu xa ku pfula. Leswi swi ta endla leswaku SSH yi tirha hi ku tiyimisela.
sudo mkdir /mnt/pi-boot sudo mount /dev/sdX1 /mnt/pi-boot sudo touch /mnt/pi-boot/ssh sudo umount /mnt/pi-boot
Sweswi, ti pis ta mina hinkwato a ti lunghekele ku tirhisiwa. Ndzi ti hlanganisile na network kutani ndzi sungula ku ti configure. A ku ri na switsongo leswi a swi fanele ku lulamisiwa tanihileswi a ndzi ta swi tirhisa tanihi ti-node ta Kubernetes.
Kambe swilo swo fana na vim na ku pfuxeta sisiteme a swi laveka. Leswi swi tlhele swi ndzi nyika nkarhi wo dyondza ndlela yo tirhisa . Xitirhisiwa lexinene ngopfu lexi ndzi xi dyondzeke endzhaku ka nkarhinyana.
Vuhlayiselo bya Vuhlayiselo
Loko u tsundzuka tindzimana ti nga ri tingani laha henhla, ndzi boxe leswaku 3rd node yi ta tirhisiwa eka NFS shared drive. A ndzi ri na 1TB SSD drive leyi a ndzi ta yi tirhisa eka xikongomelo lexi. Ndzi boheke ku yi formata ndzi yi mount eka 3rd node.
Kambe ndzi tlhele ndzi lava ku nghenisa sevha ya NFS eka node leyi ni ku yi lulamisa eka ti-node tin’wana. Xana leswi switsundzuxiwa eka ndzhawu ya vuhumelerisi? Hell no, kambe i home cluster, so a ndzi vileli ngopfu hi swona. Hi lawa magoza lawa ndzi ma tekeke ku lulamisa sevha ya NFS:
pi@turing-03:/mnt/ssd/data $ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sda 8:0 0 953.9G 0 disk /mnt/ssd mmcblk0 179:0 0 7.3G 0 disk ├─mmcblk0p1 179:1 0 512M 0 part /boot/firmware └─mmcblk0p2 179:2 0 6.8G 0 part / mmcblk0boot0 179:32 0 4M 1 disk mmcblk0boot1 179:64 0 4M 1 disk
Xo sungula, ndzi kambisise leswaku drive yi khandziyisiwile kahle. Kutani ndzi nghenise sevha ya NFS:
sudo mkdir /mnt/nfs_share sudo mount /dev/sda /mnt/nfs_share
Yi engeterile eka fayili ya fstab ku tiyisisa leswaku yi khandziyisiwile eka boot:
(ku engetela layini leyi landzelaka eka fayili ya /etc/fstab
)
echo '/dev/sda /mnt/ssd ext4 defaults 0 0' | sudo tee -a /etc/fstab
Sweswi, ku nghenisa nfs-kernel-server:
sudo apt update sudo apt install nfs-kernel-server
Naswona ku engetela drive ya mina eka fayili ya /etc/exports
:
echo '/mnt/ssd *(rw,sync,no_subtree_check,no_root_squash)' | sudo tee -a /etc/exports
Sweswi, eka ti-node tin’wana, ndzi boheke ku nghenisa nfs-common:
sudo apt update sudo apt install nfs-common
Naswona ku khoma drive eka node yin’wana na yin’wana:
sudo mount -t nfs {IP-for-the-drives-node}:/mnt/ssd /mnt
yi nghenisiwile eka ti node hinkwato hikuva ndzi fancy.
Ntlawa wa Kubernetes
A ndzi nga si tshama ndzi veka ntlawa wa Kubernetes ku suka eka xiyimo xa le hansi, kambe ndzi hlalele eka mhaka leyi... Leyi i ntokoto lowu ringaneleke, a swi tano ke?
Jeff u ndzi rhangele eka hi ku tirhisa , ku hangalasiwa ka Kubernetes ko vevuka loku hetisekeke eka xitluletsongo xa mina xa le kaya na ndlela leyi hlamuseriweke ka ha ri emahlweni yo yi nghenisa hikuva a ndzi na swilaveko swa le mahlweni kumbe mianakanyo ya ndlela yo yi veka hi ndlela yin’wana.
Ku vekiwa ka yona a ku kongomile swinene. A ndzi fanele ndzi yi nghenisa eka ti- node hinkwato, kambe a ndzi fanele ndzi tiyiseka leswaku master node hi yona yo sungula ku nghenisiwa.
Kutani xo sungula, ndzi clone vuhlayiselo bya k3s-ansible:
git clone //github.com/k3s-io/k3s-ansible.git
Kutani ndzi boheke ku hlela fayili ya nhundzu. Master node ya mina, tani hi leswi ndzi vuleke eku sunguleni, a ku ri Raspberry Pi ya mina ya khale 4. Kutani ndzi boheke ku tiyisisa leswaku hi yona yo sungula eka fayili ya inventory. Ndzi tlhele ndzi boheka ku tiyisisa leswaku ti node tin'wana ti le ka mintlawa leyi faneleke.:
k3s_cluster: children: server: hosts: 192.168.2.105: agent: hosts: 192.168.2.101: 192.168.2.102: 192.168.2.103: 192.168.2.104:
Eka fayili yoleyo leyi fanaka, ndzi boheke ku veka xikombiso xa ku fihla. Fayili yi kombisa ndlela yo endla leswi, kutani a ndzi nge ngheni eka vuxokoxoko laha.
Kutani ndzi boheke ku tsutsuma buku yo tlanga:
cd k3s-ansible ansible-playbook playbooks/site.yml -i inventory.yml
Hi swona. Loko swi ta eka ku vekiwa, a ndzi ri na xitluletsongo xa Kubernetes lexi a xi ri karhi xi tirha. Ndzi boheke ku nghenisa eka muchini wa mina wa laha kaya ku lawula xitluletsongo na ku boha xitluletsongo eka fayili ya ./kube/config
.
Swikombelo swa kona
Xo hetelela, ndzi boheke ku nghenisa switirhisiwa leswi a ndzi lava ku swi tirhisa eka xitluletsongo. A ndzi ri ni mianakanyo yo karhi malunghana ni leswi a ndzi swi lava.
- A ndzi lava ku va na Media Server leyi nga na ti scheduled downloads.
- Xikombiso eka DNS ya netiweke ya mina na ku sivela swinavetiso hinkwaswo eka switirhisiwa hinkwaswo ekaya.
- Xikombiso xo tlanga mintlangu yin’wana ya khale no avelana mintlangu yo hlayisa eka netiweke hinkwayo ya le kaya ra mina (ndzi languta wena Megaman Battle Network 6 eka switirhisiwa swa mina hinkwaswo)
Hi kona laha byi nghenaka kona. Eka Media Server, ndzi endle xiboho xo tirhisa:
Tanihi xikombiso, ndzi ta ku komba ndlela leyi ndzi ngheniseke Sonarr ha yona hi ku tirhisa kubectl
. Switirhisiwa swin’wana swi nghenisiwe hi ndlela leyi fanaka.
Eka Xitirhisiwa xin’wana ni xin’wana, ndzi endle tifayela ta 3:
deployment.yaml
i vukorhokeri bya yin’wana na yin’wana ya ti pod leti tirhisaka xitirhisiwa
apiVersion: apps/v1 kind: Deployment metadata: name: sonarr spec: replicas: 1 selector: matchLabels: app: sonarr template: metadata: labels: app: sonarr spec: containers: - name: sonarr image: linuxserver/sonarr ports: - containerPort: 8989 env: - name: PUID value: "911" - name: PGID value: "911" - name: TZ value: "Europe/Amsterdam" volumeMounts: - mountPath: /data name: data - name: config mountPath: /config volumes: - name: data persistentVolumeClaim: claimName: nfs-pvc - name: config persistentVolumeClaim: claimName: nfs-config-pvc
service.yaml
i vukorhokeri bya vukorhokeri lebyi nga ta paluxa xitirhisiwa eka xitluletsongo
apiVersion: v1 kind: Service metadata: name: sonarr spec: selector: app: sonarr ports: - port: 80 targetPort: 8989 type: ClusterIP
ingress.yaml
naswona leyi i xivumbeko xa ingress lexi nga ta paluxa xitirhisiwa eka netiweke ya mina
Kutani hi tirhisa hinkwaswo hi ku tirhisa kubectl
:
kubectl apply -f sonarr/deployment.yaml kubectl apply -f sonarr/service.yaml kubectl apply -f sonarr/ingress.yaml
Hilaha u nga swi vonaka hakona, ndzi tirhisa vuhlayiselo lebyi phikelelaka lebyi seketeriwaka hi NFS eka data na ku lulamisiwa ka switirhisiwa.
Eka vuhlayiselo, u nga kuma tifayela ta na leti ndzi ti tirhiseke ku tumbuluxa vuhlayiselo bya NFS.
Ku engetela kwalaho, ndzi endle xikombelo xin’wana xa vholumo lexi phikelelaka xa ku hleriwa ka switirhisiwa.
Ku Aka Ko Hetelela
Hambi leswi case yi langutekaka yi hlamarisa, yikulu nyana eka Raspberry Pi Cluster. Mhaka ya Mini ITX a yi ta va yi fanerile na swilaveko swa mina, kambe ndzi fanele ku pfumela, ndzi sucker ya swilo swa DIY.
Nakambe, Sucker ya ti LED hi ku angarhela. A ndzi engetelanga mavoni man’wana eka case, kambe ndzi ehleketa leswaku bodo yi endla ntirho wo saseka se. Khombo ra kona, tiphini ta fan a ti nga fambisani na bodo, naswona a ndzi nga xavi fan controller kumbe pin ya motherboard. Ndzi nga ha va ndzi ri kona enkarhini lowu taka. Minkarhi yin’wana, u fanele u tshama ehansi ntsena u tiphina hi xivono. Nakona eku heteleleni, Turing Pi 2 Home Cluster yi pfukile yi tirha, naswona yindlu ya mina a ya ha ri na mpfilumpfilu.
Vumundzuku
Nkarhi ntsena wu ta kombisa leswi ndzi nga ta swi endla hi xirhundzu lexi.
Kambe, ndzi vile ndzi ehleketa ku engetela na ku va na timetriki tin’wana na tigirafu to saseka ku kambela eka xitluletsongo.
Ku rhurhela tifayela ta mina hinkwato ta Kubernetes eka swi ta va mianakanyo leyinene na swona.
Xo hetelela, xikombiso xa Retroarch xa ha ri eku endliweni. Kumbexana eka mintirho yi na ntshembo nyana loko hi nyikiwa leswaku pod yi hanya eka xiyimo xa CrashLoopBackOff. Kambe ndzi ta fika kwalaho.
Makumu
Loko u fikile emakumu ka post leyi, ndza khensa nkarhi wa wena. Ndza tshemba leswaku mi tiphinile ku fana na mina hi vumbirhi bya ku veka xitluletsongo swin’we na ku tsala hi swona.