M4のmacでkubernetesを維持しはじめた。
microk8s&multipassにするとarm64のubuntuになるので、UTM入れてubuntu動かした中でmicrok8s動かすようにしてる。
自分の設定が悪いのか、残念ながらintelのmacで使ってたmicrok8sより性能悪くなった・・・。
履歴メモ
intel-microk8sの実施履歴はこのへんでやってて、minikubeの実施履歴はこのへんでやってる。
構成変更したから履歴書くのもここで書くように変更。4月と8月と12月にちょいちょい書き足したり更新してく。
時期 | macのk8s環境 | クラスタ |
---|---|---|
2024年12月 | microk8s v1.32.0(containerd v1.6.28) | Kubernetes v1.32/stable |
2024年11月 | microk8s v1.31.0(containerd v1.6.28) | Kubernetes v1.31/stable |
microk8sで使えるkubernetesクラスタのバージョン確認
出てるやん。
root@kubelinux:/microk8s/script# snap info microk8s | egrep 'stable|installed|stable' | grep classic | grep -v 'tracking' | sort -r | head -4
latest/stable: v1.31.3 2024-12-04 (7449) 168MB classic
installed: v1.31.3 (7449) 168MB classic
1.32/stable: v1.32.0 2024-12-12 (7537) 171MB classic ⭐️新しいのでてるやん
1.31/stable: v1.31.3 2024-12-03 (7449) 168MB classic
root@kubelinux:/microk8s/script#
クラスタ作り直すスクリプトを書き換え
## -------------------------------------------------------------------------
## Script Name : 300_kubeClusterRecreate.sh
## Created by : T.Naritomi
## on : 2023.08.26
## Updated by : 2024.11.28
## on :
## Parameters :
## Return Code : 0=Normal End
## Comments : change driver hyperkit -> qemu2 , minikube -> microk8s
## -------------------------------------------------------------------------
## ---define----------------------------------------------------------------
EXEC_HOME=/microk8s/script # Execute Home directory
KUBE_HOME=/microk8s # kubernetes Home directory
LOG_FILE=/microk8s/log/kube.log # Log file
GVIS_VER=1.32/stable ⭐️書き換え
GVIS_USER=nari
## ---detail----------------------------------------------------------------
read -p "--- kube Data save ready ? ---(y/N):" yn
case "$yn" in [yY]*) ;; *) echo "abort." ; exit ;; esac
read -p "--- kube Recreate cluster ready ? ---(y/N):" yn
case "$yn" in [yY]*) ;; *) echo "abort." ; exit ;; esac
echo '---Recreate start---' >> ${LOG_FILE}
echo -------- `date +%F_%T` -------- >> ${LOG_FILE}
echo ${LOG_FILE}
snap remove microk8s >> ${LOG_FILE} ⭐️クラスタ吹っ飛ぶ
rm -fR ~/.kube
echo -------- `date +%F_%T` -------- >> ${LOG_FILE}
snap install microk8s --channel=${GVIS_VER} --classic >> ${LOG_FILE}
## snap install microk8s --stable
mkdir -p /data
chmod 777 /data
microk8s enable registry --size 30Gi >> ${LOG_FILE} ⭐️コンテナイメージ置き場が自分のは大きくないと入らへんから、必要なら増やす
microk8s enable hostpath-storage >> ${LOG_FILE}
microk8s enable host-access >> ${LOG_FILE}
echo -------- kubernetes cluster created -------- >> ${LOG_FILE}
:(中略) ⭐️configmap/service/pv/pvcをこの後作らせる
永続化領域の保全
永続化領域をtar.gz化してmacにコピーしとく。
root@kubelinux:/data# cd /data
root@kubelinux:/data# ls
gvis-pv-django-sslcerts gvis-pv-mariadb gvis-pv-ubun sv_django-uwsgi-nginx
gvis-pv-django-uwsgi-nginx gvis-pv-mariadbconf gvis-pv-ubun.tar.gz sv_django-uwsgi-nginx.tar.gz
root@kubelinux:/data# rm gvis-pv-ubun.tar.gz
root@kubelinux:/data# tar czf gvis-pv-ubun.tar.gz gvis-pv-ubun/
root@kubelinux:/data# ls -lh gvis-pv-ubun*
-rw-r--r-- 1 root root 14M Dec 19 06:12 gvis-pv-ubun.tar.gz
gvis-pv-ubun:
total 12K
drwxrwxrwx 3 nari nari 4.0K Dec 15 06:40 download
drwxrwxrwx 2 nari nari 4.0K May 14 2021 _old
drwxrwxrwx 2 nari nari 4.0K Dec 21 2022 script
root@kubelinux:/data#
root@kubelinux:/data# mv gvis-pv-ubun.tar.gz /microk8s/nariDockerDat/
root@kubelinux:/data# ls -l /microk8s/nariDockerDat/*gvis-pv-ubun*
-rwx------ 1 501 dialout 1254020 Oct 20 05:56 /microk8s/nariDockerDat/20241020_gvis-pv-ubun.tar.gz ⭐️1つ前の世代だけ維持
-rw-r--r-- 1 root root 14558769 Dec 19 06:12 /microk8s/nariDockerDat/gvis-pv-ubun.tar.gz ⭐️コレを維持するとあとはteratermマクロにやってもらう
root@kubelinux:/data#
tar.gzファイルをmacの保管置き場にコピーしとく。

クラスタ作り直す
バージョンアップっていうてもクラスタ吹っ飛ばして作り直しせなあかん。
永続化領域だけ別で維持してるから、それをコピーしてきたら同じように動かせる。
kubectlはmacmini側から使ってて、UTMの中で動く仮想マシンにx86環境のubuntuがいる中のkubernetesクラスタを操作してる。
podが動いてても全部吹っ飛ばすのでクラスタ停止からやってまう。
いっつもエラーみたいなの出てくるなぁ。
nari@gvis-mac script % sh ./301_kubeStop.sh
root@kubelinux:/microk8s/script# sh ./301_kubeStop.sh
/microk8s/log/kube.log
error: lost connection to pod
error: lost connection to pod
error: lost connection to pod
error: lost connection to pod
:(中略)
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/snap/microk8s/7449/microk8s-kubectl.wrapper', 'port-forward', '-n', 'kube-system', 'service/kubernetes-dashboard', '10443:443', '--address', '0.0.0.0']' returned non-zero exit status 1.
root@kubelinux:/microk8s/script#
クラスタ停止したのを確認してからログも念の為退避しとく。
root@kubelinux:/microk8s/log# pwd
/microk8s/log
root@kubelinux:/microk8s/log# ls
20241204kube.log kube.log
root@kubelinux:/microk8s/log# tail -f kube.log
2024-12-18T09:44:52+09:00 INFO Waiting for "snap.microk8s.daemon-kubelite.service" to stop.
Stopped.
-------- 2024-12-18_09:45:50 --------
-------- 2024-12-19_05:17:28 --------
---- microk8s start ----
-------- 2024-12-19_05:18:27 --------
-------- 2024-12-19_06:22:35 --------
---- microk8s stop ----
Stopped.
-------- 2024-12-19_06:22:41 --------
^C
root@kubelinux:/microk8s/log#
作り直しスクリプトを流すと始まる。5分もかからず終わる。
root@kubelinux:/microk8s/script# uname -a
Linux kubelinux 6.8.0-51-generic #52-Ubuntu SMP PREEMPT_DYNAMIC Thu Dec 5 13:09:44 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux ⭐️念の為確認
root@kubelinux:/microk8s/script# cat 300_kubeClusterRecreate.sh | grep VER
GVIS_VER=1.32/stable ⭐️念の為確認
snap install microk8s --channel=${GVIS_VER} --classic >> ${LOG_FILE}
root@kubelinux:/microk8s/script#
root@kubelinux:/microk8s/script# ./300_kubeClusterRecreate.sh ⭐️こっからがんばれー
--- kube Data save ready ? ---(y/N):y
--- kube Recreate cluster ready ? ---(y/N):y
/microk8s/log/kube.log
Infer repository core for addon registry
Infer repository core for addon hostpath-storage
Infer repository core for addon hostpath-storage
Infer repository core for addon host-access
Error: ipv4: Address already assigned.
persistentvolume/gvis-pv-mariadb created
persistentvolumeclaim/gvis-pv-mariadb-claim created
persistentvolume/gvis-pv-mariadbconf created
persistentvolumeclaim/gvis-pv-mariadbconf-claim created
persistentvolume/gvis-pv-django-sslcerts created
persistentvolumeclaim/gvis-pv-django-sslcerts-claim created
persistentvolume/gvis-pv-django-uwsgi-nginx created
persistentvolumeclaim/gvis-pv-django-uwsgi-nginx-claim created
persistentvolume/gvis-pv-ubun created
persistentvolumeclaim/gvis-pv-ubun-claim created
configmap/sv-mariadb-txt created
service/sv-django created
service/sv-https-portal created
service/sv-mariadb created
NAME STATUS ROLES AGE VERSION
kubelinux Ready <none> 73s v1.32.0
root@kubelinux:/microk8s/script# Checking if Dashboard is running.
Infer repository core for addon dashboard
Infer repository core for addon metrics-server
Waiting for Dashboard to come up.
root@kubelinux:/microk8s/script# Trying to get token from microk8s-dashboard-token
Waiting for secret token (attempt 0)
Dashboard will be available at https://127.0.0.1:10443
Use the following token to login:
(トークン文字列が表示される)
トークンをメモに控えといて、ブラウザでダッシュボード表示するときに使う。
スクリプトから吐かせたログ見るとこんな感じ。
ちゃんとできとる。
-------- 2024-12-19_06:31:42 --------
microk8s (1.32/stable) v1.32.0 from Canonical** installed
Enabling default storage class.
WARNING: Hostpath storage is not suitable for production environments.
A hostpath volume can grow beyond the size limit set in the volume claim manifest.
deployment.apps/hostpath-provisioner created
storageclass.storage.k8s.io/microk8s-hostpath created
serviceaccount/microk8s-hostpath created
clusterrole.rbac.authorization.k8s.io/microk8s-hostpath created
clusterrolebinding.rbac.authorization.k8s.io/microk8s-hostpath created
Storage will be available soon.
namespace/container-registry created
persistentvolumeclaim/registry-claim created
deployment.apps/registry created
service/registry created
configmap/local-registry-hosting configured
The registry will be created with the size of 30Gi.
Default storage class will be used.
Addon core/hostpath-storage is already enabled
Setting 10.0.1.1 as host-access
-------- kubernetes cluster created --------
-------- 2024-12-19_06:34:11 --------
パーティションと永続化領域の/data
はクラスタが作り直しされた直後こんな感じ。
nari@kubelinux:/data$ df -h | grep -v tmpfs | grep -v common
Filesystem Size Used Avail Use% Mounted on
efivarfs 256K 29K 223K 12% /sys/firmware/efi/efivars
/dev/mapper/ubuntu--vg-ubuntu--lv 59G 25G 32G 44% /
/dev/sda2 2.0G 183M 1.7G 11% /boot
/dev/sda1 1.1G 6.2M 1.1G 1% /boot/efi
share 461G 325G 137G 71% /microk8s
nari@kubelinux:/data$ sudo du -shc *
52K gvis-pv-django-sslcerts
8.4M gvis-pv-django-uwsgi-nginx
3.9G gvis-pv-mariadb
2.5G gvis-pv-mariadbconf
15M gvis-pv-ubun
1.7M sv_django-uwsgi-nginx
13M sv_django-uwsgi-nginx.tar.gz
6.4G total
nari@kubelinux:/data$
あとは前にやった方法でPod起動用のイメージと永続化領域を流し込んで、起動確認してく。
UTMの中のx86 ubuntuで動くmicrok8s
OSはubuntuね。
nari@kubelinux:~$ cat /etc/os-release | grep PRETTY
PRETTY_NAME="Ubuntu 24.04.1 LTS"
nari@kubelinux:~$
dockerやなくてcontainerdが動いてくれてる。
nari@kubelinux:~$ pstree
systemd─┬─ModemManager───3*[{ModemManager}]
├─agetty
├─bash───python3
├─bash───cluster-agent───7*[{cluster-agent}]
├─bash───bash───python3───bash───kubectl───10*[{kubectl}]
├─containerd───16*[{containerd}]
├─containerd-shim─┬─pause
│ ├─runsvdir─┬─4*[runsv───calico-node───9*[{calico-node}]]
│ │ └─runsv───calico-node───14*[{calico-node}]
│ └─12*[{containerd-shim}]
├─containerd-shim─┬─kube-controller───9*[{kube-controller}]
│ ├─pause
│ └─12*[{containerd-shim}]
├─containerd-shim─┬─coredns───10*[{coredns}]
│ ├─pause
│ └─12*[{containerd-shim}]
├─containerd-shim─┬─hostpath-provis───7*[{hostpath-provis}]
│ ├─pause
│ └─11*[{containerd-shim}]
├─containerd-shim─┬─dashboard───8*[{dashboard}]
│ ├─pause
│ └─11*[{containerd-shim}]
├─containerd-shim─┬─metrics-sidecar───9*[{metrics-sidecar}]
│ ├─pause
│ └─12*[{containerd-shim}]
├─containerd-shim─┬─metrics-server───12*[{metrics-server}]
│ ├─pause
│ └─12*[{containerd-shim}]
├─containerd-shim─┬─pause
│ ├─registry───7*[{registry}]
│ └─11*[{containerd-shim}]
├─cron
├─dbus-daemon
├─fwupd───5*[{fwupd}]
├─k8s-dqlite───17*[{k8s-dqlite}]
├─kubelite───18*[{kubelite}]
├─multipathd───6*[{multipathd}]
├─polkitd───3*[{polkitd}]
├─rsyslogd───3*[{rsyslogd}]
├─snapd───14*[{snapd}]
├─sshd─┬─sshd───sshd───bash───sudo───sudo───su───bash
│ └─sshd───sshd───bash───pstree
├─systemd─┬─(sd-pam)
│ └─dbus-daemon
├─systemd-journal
├─systemd-logind
├─systemd-network
├─systemd-resolve
├─systemd-timesyn───{systemd-timesyn}
├─systemd-udevd
├─udisksd───5*[{udisksd}]
├─unattended-upgr───{unattended-upgr}
└─upowerd───3*[{upowerd}]
nari@kubelinux:~$
kubernetesのダッシュボード見たらこんな感じ。

macから使ってるkubectlもトークン見てる箇所あるから、このへんの方法使って書き換える。
スクリプトが動いた後の、ノードとサービスの確認しとく。
nari@nariMac-mini ~ % kubectl get nodes,services
NAME STATUS ROLES AGE VERSION
node/kubelinux Ready <none> 28m v1.32.0
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.152.183.1 <none> 443/TCP 28m
service/sv-django ClusterIP 10.152.183.117 <none> 38080/TCP 27m
service/sv-https-portal ClusterIP 10.152.183.113 <none> 30080/TCP,30443/TCP 27m
service/sv-mariadb ClusterIP 10.152.183.69 <none> 13306/TCP 27m
nari@nariMac-mini ~ %
teratermのマクロがやってくれるけど、永続化領域とイメージ入れてく。
母艦からmacminiへコピーし、UTMの共有フォルダ通じてdockerイメージ(9GBぐらい)をtar.gzからtarにしとく。
コピーとtarに展開するまで10分、tarをctrに入れるまで20分、合計30分ぐらいは待つ。
intelからM4になってもx86エミュレーションやから、時間は前と同じか、もう少し多くかかってるかも。
nari@kubelinux:~$ sudo su -
[sudo] password for nari:
root@kubelinux:~# cd /data
root@kubelinux:/data# rm -fR gvis-pv-ubun ; sync ; cp /microk8s/nariDockerDat/gvis-pv-ubun.tar.gz /data ; tar xzf gvis-pv-ubun.tar.gz
root@kubelinux:/data# chown -R nari:nari gvis-pv-ubun ; chmod -R 777 gvis-pv-ubun ; sync
root@kubelinux:/data# cd /root
root@kubelinux:~# microk8s.ctr images rm docker.io/library/save-django:gvis-saved
WARN[0000] docker.io/library/save-django:gvis-saved: image not found
root@kubelinux:~# microk8s.ctr images rm docker.io/library/save-xrdpubu:gvis-saved
WARN[0000] docker.io/library/save-xrdpubu:gvis-saved: image not found
root@kubelinux:~# microk8s.ctr images import save-django.tar
unpacking docker.io/library/save-django:gvis-saved (sha256:f17e59852cbbc3ced09ca764d0badb4addeaccf2e767e8e6ed1766cee3f0f2d1)...done
root@kubelinux:~# microk8s.ctr images import save-xrdpubu.tar
unpacking docker.io/library/save-xrdpubu:gvis-saved (sha256:ba47faadaaf536e9f4d058552f23c111d802b2267f6d24e8e41d72a69fbaae1b)...done
root@kubelinux:~# microk8s.ctr images ls | grep save
docker.io/library/save-django:gvis-saved application/vnd.oci.image.manifest.v1+json sha256:f17e59852cbbc3ced09ca764d0badb4addeaccf2e767e8e6ed1766cee3f0f2d1 1.3 GiB linux/amd64 io.cri-containerd.image=managed
docker.io/library/save-xrdpubu:gvis-saved application/vnd.oci.image.manifest.v1+json sha256:ba47faadaaf536e9f4d058552f23c111d802b2267f6d24e8e41d72a69fbaae1b 6.8 GiB linux/amd64 io.cri-containerd.image=managed
root@kubelinux:~#
nmonで見てるとイメージの流し込みとか、データベースのダンプの取り込みとか、結構CPUが頑張り続けてた。
┌nmon─16p─ppppp[H for help]pppHostname=kubelinux────Refresh= 2secs ───07:31.29─99999999999999999999999999999999999999999999999999┐
│ CPU Utilisation ─ │
│---------------------------+-------------------------------------------------+ │
│CPU User% Sys% Wait% Idle|0 |25 |50 |75 100| │
│ 1 13.6 22.5 0.6 63.3|UUUUUUsssssssssss > | │
│ 2 9.5 20.7 0.0 69.8|UUUUssssssssss > | │
│ 3 13.1 20.2 0.0 66.7|UUUUUUssssssssss > | │
│ 4 14.8 35.2 0.0 50.0|UUUUUUUsssssssssssssssss > | │
│ 5 12.9 17.1 0.0 70.0|UUUUUUssssssss > | │
│ 6 12.0 31.1 0.6 56.3|UUUUUsssssssssssssss > | │
│---------------------------+-------------------------------------------------+ │
│Avg 12.6 24.4 0.1 63.0|UUUUUUssssssssssss > | │
│---------------------------+-------------------------------------------------+ │
│ Memory and Swap ─ │
│ PageSize:4KB RAM-Memory Swap-Space High-Memory Low-Memory │
│ Total (MB) 9940.8 4096.0 - not in use - not in use │
│ Free (MB) 259.3 4095.5 │
│ Free Percent 2.6% 100.0% │
│ Linux Kernel Internal Memory (MB) │
│ Cached= 7969.3 Active= 1684.9 │
│ Buffers= 181.5 Swapcached= 0.3 Inactive = 7397.1 │
│ Dirty = 181.7 Writeback = 0.0 Mapped = 592.8 │
│ Slab = 437.2 Commit_AS = 3275.4 PageTables= 12.6 │
│ Disk I/O ──/proc/diskstats──Requested KB/s────Warning:may contains duplicates─sssssssssssssssssssssssssssssssssssssssssssssssss│
│DiskName Busy Read Write |0 |25 |50 |75 100| │
│sda 3% 2977.6 704.0|RR │
│sda3 3% 2977.6 704.0|RR │
│dm-0 3% 2977.6 704.0|RR │
│Totals Read-MB/s=8.7 Writes-MB/s=2.1 Transfers/sec=279.7 │
└─3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333
mariadbの設定ファイル・ダンプ用処理・ダンプデータを永続化領域置き場の/data
へ流し込む。
nari@kubelinux:~$ sudo su -
[sudo] password for nari:
root@kubelinux:~# cd /data
root@kubelinux:/data# rm -fR ./gvis-pv-mariadb ; rm -fR ./gvis-pv-mariadbconf ; sync ; sync
root@kubelinux:/data# mkdir -p /data/gvis-pv-mariadbconf/nari/fullback/ ; mkdir -p gvis-pv-mariadb
root@kubelinux:/data# cd /microk8s/nariDockerDat/
root@kubelinux:/microk8s/nariDockerDat# cp -p ./sv_mariadb11conf/gvis.cnf /data/gvis-pv-mariadbconf/
root@kubelinux:/microk8s/nariDockerDat# cp -p ./sv_mariadb11conf/nari/fullback/2_fullRecover.sh /data/gvis-pv-mariadbconf/nari/fullback/
root@kubelinux:/microk8s/nariDockerDat# cp -p ./sv_mariadb11conf/nari/fullback/4_nariDB_DjangoRecover.sh /data/gvis-pv-mariadbconf/nari/fullback/
root@kubelinux:/microk8s/nariDockerDat# cp -p ./sv_mariadb11conf/nari/FullBackup_nariDB_1st.sql /data/gvis-pv-mariadbconf/nari/
root@kubelinux:/microk8s/nariDockerDat# cp -p ./sv_mariadb11conf/nari/FullBackup_nariDB_Django.sql /data/gvis-pv-mariadbconf/nari/
mariadbのpv/pvc/podを作り直してダンプをロードする。
処理性能弱いから、pod作ったときはmariadbの初期化処理が終わるまで60秒待たせてからダンプ流し込む。
nari@nariMac-mini ~ % m8
nari@nariMac-mini microk8s % kubectl create -f gvis-PersistentVol-mariadbconf.yaml
persistentvolume/gvis-pv-mariadbconf created
persistentvolumeclaim/gvis-pv-mariadbconf-claim created
nari@nariMac-mini microk8s % kubectl create -f gvis-PersistentVol-mariadb.yaml
persistentvolume/gvis-pv-mariadb created
persistentvolumeclaim/gvis-pv-mariadb-claim created
nari@nariMac-mini microk8s % kubectl create -f sv-mariadb-pod.yaml
pod/sv-mariadb created
nari@nariMac-mini microk8s % sync ; sync ; sleep 30
nari@nariMac-mini microk8s % kubectl exec -it `kubectl get pod | grep mariadb | awk '{print $1}'` -- bash
root@svmariadb:/# sync ; sleep 60 ; sync
root@svmariadb:/# /bin/sh /etc/mysql/conf.d/nari/fullback/2_fullRecover.sh
root@svmariadb:/# sync ; sleep 20 ; sync
root@svmariadb:/# /bin/sh /etc/mysql/conf.d/nari/fullback/4_nariDB_DjangoRecover.sh
root@svmariadb:/# sync ; sleep 20 ; sync
root@svmariadb:/# mariadb -unari -pXXXXXXXXXX
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 11.4.4-MariaDB-ubu2404-log mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show variables like 'max_allowed_packet' ;
select count(*) from GVIS_keihi ;
exit
+--------------------+------------+
| Variable_name | Value |
+--------------------+------------+
| max_allowed_packet | 1073741824 |
+--------------------+------------+
1 row in set (0.036 sec)
MariaDB [(none)]> show databases ;
+--------------------+
| Database |
+--------------------+
| information_schema |
| nariDB_1st |
| nariDB_Django |
+--------------------+
3 rows in set (0.005 sec)
MariaDB [(none)]> use nariDB_1st ;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [nariDB_1st]> select count(*) from GVIS_keihi ;
+----------+
| count(*) |
+----------+
| 11714 |
+----------+
1 row in set (0.033 sec)
MariaDB [nariDB_1st]> exit
Bye
root@svmariadb:/# exit
exit
nari@nariMac-mini microk8s % sc
nari@nariMac-mini script % sh ./411_ReCreateDBpod.sh
NAME READY STATUS RESTARTS AGE
sv-mariadb 1/1 Running 0 19m
pod "sv-mariadb" deleted
pod/sv-mariadb created
NAME READY STATUS RESTARTS AGE
sv-mariadb 0/1 Pending 0 0s
nari@nariMac-mini script %
djangoの永続化領域も流し込む。pip3で更新対象見えたら、母艦の次の定期更新でなんとかしとく。
nari@nariMac-mini ~ % m8
nari@nariMac-mini microk8s % kubectl create -f gvis-PersistentVol-sv_django-uwsgi-nginx.yaml
persistentvolume/gvis-pv-django-uwsgi-nginx created
persistentvolumeclaim/gvis-pv-django-uwsgi-nginx-claim created
nari@nariMac-mini microk8s % kubectl create -f sv-django-pod.yaml
pod/sv-django created
nari@nariMac-mini microk8s % sleep 10
nari@nariMac-mini microk8s % kubectl exec -it `kubectl get pod | grep sv-django | awk '{print $1}'` -- bash
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
root@sv-django:/# pip3 list -o
Package Version Latest Type
---------- ------- ------ -----
matplotlib 3.9.4 3.10.0 wheel
root@sv-django:/# exit
exit
nari@nariMac-mini microk8s % sc
nari@nariMac-mini script % sh ./415_ReCreateHTTPSpod.sh
NAME READY STATUS RESTARTS AGE
sv-django 1/1 Running 0 2m16s
sv-mariadb 1/1 Running 0 6m18s
Error from server (NotFound): error when deleting "/Users/nari/Documents/personal/microk8s/sv-https-portal-pod.yaml": pods "sv-https-portal" not found
pod/sv-https-portal created
NAME READY STATUS RESTARTS AGE
sv-django 1/1 Running 0 2m16s
sv-https-portal 0/1 Pending 0 0s
sv-mariadb 1/1 Running 0 6m18s
nari@nariMac-mini script %
xrdpのpodは手動で動かす。
nari@nariMac-mini script % sh ./413_ReCreateXRDPpod.sh
NAME READY STATUS RESTARTS AGE
sv-django 1/1 Running 0 5m3s
sv-https-portal 1/1 Running 0 2m47s
sv-mariadb 1/1 Running 0 9m5s
Error from server (NotFound): error when deleting "/Users/nari/Documents/personal/microk8s/cl-ubun-pod.yaml": pods "cl-ubun" not found
pod/cl-ubun created
NAME READY STATUS RESTARTS AGE
cl-ubun 0/1 Pending 0 0s
sv-django 1/1 Running 0 5m3s
sv-https-portal 1/1 Running 0 2m47s
sv-mariadb 1/1 Running 0 9m5s
nari@nariMac-mini script % kubectl get po
NAME READY STATUS RESTARTS AGE
cl-ubun 1/1 Running 0 13s
sv-django 1/1 Running 0 5m16s
sv-https-portal 1/1 Running 0 3m
sv-mariadb 1/1 Running 0 9m18s
nari@nariMac-mini script %
軽く動作確認
dockerイメージの流し込みと反映した後、軽く動作確認。
Pod再起動して状態確認してみる。

動いてそうやから、xrdpのPodから見てみる。

djangoのmatplotlibで円グラフ書けてるし、データベース読めて扱えてるし、うまいこと行ってるっぽい。
speedtestはぜんぜん速度出えへん。dockerコンテナとかmacのsafariからは800Mbpsほど速度出るんやけどなぁ。
やっとsequoiaになってM4にもなったっちゅーのに、kubernetes環境は改悪になってしもた。
kubernetesをmacで動かすのやめて、intelのlinuxホスト作るの考えよかな。