作成イメージ

arm64のutm環境の中にubuntu26の環境を作る。

macminiの中で動いてるDocker環境は先にubuntu26のxrdpコンテナ作っといた。

⭐️印の箇所をubuntu26にしてく。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<----------- M4 mac -------dev->     <--------------------- VMware on Windows11 pro -------------stg-->    <-------- Google cloud ---prd-->

+-M4 macmini sequoia-----------+     +-kubelinux(ubuntu26) --------+    +-local ubuntu26 linux--------+    +-GCE ubuntu26 linux----------+
| +-utm ---------------------+ |     | +-microk8s-------+ +-vmdk-+ |    | +-docker---------+ +-vmdk-+ |    | +-docker---------+ +--pv--+ |
| |  +-sequoia arm64-------+ | |     | |  +-Pod-------+ | | data | |    | |  +-container-+ | | data | |    | |  +-container-+ | | data | |
| |  |  vscode/cyberduck   | | |     | |  | Django    | | |  d1  | |    | |  | Django    | | |  d1  | |    | |  | Django    | | |  d1  | |
| |  |  office/brew/rdp    | | |     | |  +-----------+ | +------+ |    | |  +-----------+ | +------+ |    | |  +-----------+ | +------+ |
| |  +---------------------+ | |     | |  +-Pod-------+ | |      | |    | |  +-container-+ | |      | |    | |  +-container-+ | |      | |
| |  +-kubearm(ubu26) ⭐️--+ | |     | |  | mariadb   | | |  d2  | |    | |  | mariadb   | | |  d2  | |    | |  | mariadb   | | |  d2  | |
| |  | ctr microk8s        | | |     | |  +-----------+ | +------+ |    | |  +-----------+ | +------+ |    | |  +-----------+ | +------+ |
| |  |+-container-+        | | |     | |  +-Pod-------+ | |      | |    | |  +-container-+ | |      | |    | |  +-container-+ | |      | |
| |  ||kubernetes |        | | | <-  | |  | xrdp-ubu26| | |  d3  | | <- | |  | xrdp-ubu26| | |  d3  | | <- | |  | xrdp-ubu24| | |  d3  | |
| |  |+-----------+        | | | <-  | |  +-----------+ | +------+ | <- | |  +-----------+ | +------+ | <- | |  +-----------+ | +------+ |
| |  |+-container-+ +/data+| | | <-  | |                |          | <- | |                |          | <- | |  +-container-+ |          |
| |  ||Django     | | d1  || | |     | |                |          |    | |                |          |    | |  | gitlab    | |          |
| |  |+-----------+ +-----+| | |     | |                |          |    | |                |          |    | |  +-----------+ |          |
| |  |+-container-+ |     || | |     | |  +-Pod-------+ | +------+ |    | |  +-container-+ | +------+ |    | |  +-container-+ | +------+ |
| |  ||mariadb    | | d2  || | |     | |  | https     | | |  d4  | |    | |  | https     | | |  d4  | |    | |  | https     | | |  d4  | |
| |  |+-----------+ +-----+| | |     | |  +-----------+ | +------+ |    | |  +-----------+ | +------+ |    | |  +-----------+ | +------+ |
| |  |+-container-+ |     || | |     | +----------------+          |    | +----------------+          |    | +----------------+          |
| |  ||xrdp-ubu26 | | d3  || | |     +-----------------------------+    +-----------------------------+    +-----------------------------+
| |  |+-----------+ +-----+| | |                                                 |||
| |  |+-container-+ +-----+| | |     +--smb share -----------------+             |||
| |  ||https      | | d4  || | |     |  windows smb share          |             |||
| |  |+-----------+ +-----+| | |     +-----------------------------+             |||
| |  +---------------------+ | |                                                 |||
| +--------------------------+ |                                                 |||
|      ^ ^                     |                                                 |||
|      | |  +---------------+  |                                                 |||
|      | |  |Django & xrdp  |  |                                                 |||
|      | |  |docker image to|  |                                                 |||
|      | |  |ctr registry   |  |                                                 |||
|      | |  +---------------+  |                                                 |||
|      | |                     |                                                 |||
| +-rancher desktop----------+ |                                                 |||
| | docker on lima           | |                                                 ||| +---------------------------------+
| |  +-container-+  +------+ | |                                                 ||| | d1/d2/d3 text or binary data    |
| |  | Django    |  |  d1  | | |                                                 ||| | d4 tls data that make each host |
| |  +-----------+  +------+ | |                                                 ||| +---------------------------------+
| |  +-container-+  |      | | | <-----------------------------------------------+||
| |  | mariadb   |  |  d2  | | | <------------------------------------------------+|
| |  +-----------+  +------+ | | <-------------------------------------------------+
| |  +-container-+  |      | | |
| |  | xrdp-ubu26|  |  d3  | | |
| |  +-----------+  +------+ | |
| |  +-container-+  +------+ | |
| |  | https     |  |  d4  | | |
| |  +-----------+  +------+ | |
| +--------------------------+ |
|                              |
| +-music----------+           |
| | 8400(37GB)     |           |
| +----------------+           |
+------------------------------+

仮想マシン作成

使ってたUbuntu24はOS停止しといて、困ったら参照。今回の切り替えがうまくいったら様子見して削除。

土台になってるmacos tahoeの UTM バージョンから確認してく。

バージョンそのまま

UTMはbrew使って入れてへんからサイト確認。

github見たら2026年8月のリリースの最新はまだ4.7.5ってあった。まだ最新みたいやし、このままでええか。

リリース一覧見たら5.0.4(Beta)って見えたから、次はメジャーバージョン上げてくる予定やな。

出てきたらまた更新しましょ。

UTMゲストOS作る

arm64版のubuntuインストールメディアをダウンロードして用意する。デスクトップ版やなくてサーバ版な。

UTMでホスト作る。

このへん をベースにしてやってく。IPアドレスの確認。

1
2
3
4
5
hostname:kubearm
IP: 192.168.1.116
subnet: 192.168.1.0/24
GW: 192.168.1.1
dns: 172.16.17.15,8.8.8.8

UTMの設定忘れかけてるから今回はハードコピー多用。これあったら次やるとき思い出せるやろ。

「エミュレート」は激しく遅いので「仮想化」でいく。

arm64-m8s-kubearm-ubu26

OSはLinux。

arm64-m8s-kubearm-ubu26

メモリは10GB。

arm64-m8s-kubearm-ubu26

ISOダウンロードしといたからインストールに使う設定しとく。

arm64-m8s-kubearm-ubu26

ストレージは最初64GBって書いてあったけど、x86のmicrok8sにそろえて60GBにしとこか。

arm64-m8s-kubearm-ubu26

ホストOS側にmicrok8s用の領域を維持してるから設定しとく。これだけでよかったかなぁ・・・。

何か追加設定いるんとちゃうか。

arm64-m8s-kubearm-ubu26

UTMでの識別名入れとく。この名前でゲストOSのファイルができる。ここまででいったん保存して細かい箇所確認してく。

arm64-m8s-kubearm-ubu26

UTMゲストOSの確認

左端のカテゴリを順に確認してく。サイズはいじるけどほぼそのまま。

システムOK。

arm64-m8s-kubearm-ubu26

QEMUそのままでOK。

arm64-m8s-kubearm-ubu26

QEMUの引数変更なし。問題出たら考える。パラメータの数めっちゃ多い。

arm64-m8s-kubearm-ubu26

入力はUSBキーボード。変更なし。

arm64-m8s-kubearm-ubu26

共有は、クリップボード共有いらんのでチェック外した。共有ディレクトリはVirtFSのままでええ。パスだけホストOSのmicrok8sフォルダを指定。

arm64-m8s-kubearm-ubu26

ディスプレイも変更なし。

arm64-m8s-kubearm-ubu26

ネットワークは「ブリッジ」使う。mac/windows側から同じIPアドレスで接続したいしな。

arm64-m8s-kubearm-ubu26

USBドライブってとこにISOのファイルがマウントされる。インストール終わったらデバイスとしては削除するか。

arm64-m8s-kubearm-ubu26

VirtIOドライブはOSインストール先のディスク。特に変更せん。

arm64-m8s-kubearm-ubu26

ここまででOSインストール前の状態の確認終わり。起動してみよっか。

arm64-m8s-kubearm-ubu26

UTMゲストOSの起動

GRUBの画面見えたな。インストールやってもらいましょ。

arm64-m8s-kubearm-ubu26

すっ飛ばすけど このへん のメモ見ながらインストール終わるとこうなる。

arm64-m8s-kubearm-ubu26

再起動するときISOのマウントいらんから外す。

arm64-m8s-kubearm-ubu26

enterキー押してOS起動してもらう。

arm64-m8s-kubearm-ubu26

ついでやし、インストール直後のディスク占有量見とこか。

arm64-m8s-kubearm-ubu26

5.72GB、そんなもんやね。

arm64-m8s-kubearm-ubu26

はい、起動完了。

arm64-m8s-kubearm-ubu26

動き始めたな。arm64のubuntu26使えるようになった。

arm64-m8s-kubearm-ubu26

kubernetesの設定はx86のmicrok8sのときはsmbマウントしてるんやけど、armのmicrok8sではutmのホストOSのmacosの領域を使う。

どうやって使うんやったかな・・・。fstabいじったんやったっけ。

いったん元のubuntu24の/etc/fstab見直した。

root@kubearm:/data# cat /etc/fstab | grep microk8s
share	/microk8s	9p	trans=virtio,version=9p2000.L,rw,_netdev,nofail	0	0
root@kubearm:/data# 

これやな。このおまじない。設定したかの記憶は飛んでしもてるけど、念の為ググっといた。作者さんありがとう。

他にも永続化領域のためのフォルダ作っといて準備OK。

root@kubearm:~# mkdir /data
root@kubearm:~# chmod 777 /data
root@kubearm:~#

OSの状態確認

起動速度比べたら、結構速いんやけどgraphical.targetはmulti-user.targetに変更しとく。

root@kubearm:~# systemd-analyze
Startup finished in 181ms (kernel) + 1.263s (initrd) + 3.339s (userspace) = 4.784s ⭐️カーネルはミリセカンドで、トータル5秒いらんのやな
graphical.target reached after 3.339s in userspace.
root@kubearm:~# systemctl get-default
graphical.target
root@kubearm:~# systemctl set-default multi-user.target ⭐️変えとく
Created symlink '/etc/systemd/system/default.target' → '/usr/lib/systemd/system/multi-user.target'.
root@kubearm:~# shutdown -r now ⭐️OS再起動しとく
:(中略)
root@kubearm:~# systemd-analyze
Startup finished in 194ms (kernel) + 1.347s (initrd) + 3.219s (userspace) = 4.760s ⭐️あんまり変わらん
multi-user.target reached after 3.218s in userspace.
root@kubearm:~# 

コア数6個とメモリ10GBちゃんと確保できとるんか確認。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
┌nmon─16s───────77777777777───Hostname=kubearm──────Refresh= 2secs ───06:56.39─5555555555555555555555555┐
│ CPU Utilisation ─                                                                                                         │
│---------------------------+-------------------------------------------------+                                              │
│CPU User%  Sys% Wait%  Idle|0          |25         |50          |75       100|                                              │
1   0.0   0.0   0.0 100.0|>                                                |                                              │
2   0.0   0.0   0.0 100.0|>                                                |                                              │
3   0.0   0.0   0.0 100.0|>                                                |                                              │
4   0.0   0.0   0.0 100.0|>                                                |                                              │
5   0.0   0.0   0.0 100.0|>                                                |                                              │
6   0.0   0.0   0.0 100.0|>                                                |                                              │
│---------------------------+-------------------------------------------------+                                              │
│Avg   0.0   0.1   0.0  99.9|>                                                |                                              │
│---------------------------+-------------------------------------------------+                                              │
│ Memory and Swap ─                                                                                                         │
│ PageSize:4KB   RAM-Memory  Swap-Space       High-Memory     Low-Memory                                                     │
│ Total (MB)         9398.3      4096.0       - not in use   - not in use                                                    │
│ Free  (MB)         8953.8      4096.0                                                                                      │
│ Free Percent         95.3%      100.0%                                                                                     │
│ Linux Kernel Internal Memory (MB)│                        Cached=     200.8     Active=     238.1                                                             │
│ Buffers=      24.6 Swapcached=       0.0  Inactive =      42.8                                                             │
│ Dirty  =       0.0 Writeback =       0.0  Mapped   =      50.8                                                             │
│ Slab   =      68.8 Commit_AS =     138.6 PageTables=       2.0                                                             │
│ Disk I/O ──/proc/diskstats──Requested KB/s────Warning:may contains duplicates─ssssssssssssssssssssssssssssssssssss│
│DiskName Busy  Read Write  |0          |25         |50          |75       100|                                              │
│Totals Read-MB/s=0.0      Writes-MB/s=0.0      Transfers/sec=0.0                                                            │
│─00000000000000000000000000000000000000000000000000000000000000000000000000000─sssssssssssssssssssssssssssssssssssssssssss│
│                                                                                                                            │
│                                                                                                                            │

なんでか知らんけどswapあるやん。まぁええか。

モジュール追加 / ntp設定 / ロケール設定 / .bashrc設定 はx86のmicrok8sのときとほぼ同じことやっとく。

「ほぼ」ってのは、x86やとopen-vm-tools入れるけど、utmのゲストOSとして動かしてるときにはいらんから微妙に違うってことで。

そういう意味ではspice-vdagentqemu-guest-agentってのがあるらしくて、入れてもええけど解像度調整とかGUI経由のコピペとかいらんし。

最終的に入ったモジュール数はこうなった。

1
2
3
4
5
6
root@kubearm:/microk8s/script# apt list --installed | wc -l 

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

525
root@kubearm:/microk8s/script#

クラスタ作る

先週見たらkubernetesのバージョン1.36ってあったのが、今日見たら1.37になっとった。

microk8sとしては、使えるバージョンを確認すると、まだ1.36っぽい。

1
2
3
4
5
6
7
8
root@kubearm:/microk8s/script# snap info microk8s | grep 2026 | grep classic | grep 1.3 | grep stable
  1.35/stable:           v1.35.6  2026-07-01 (9075) 155MB classic
  latest/stable:         v1.36.2  2026-06-22 (9053) 157MB classic ⭐️今はこれが最新
  1.36/stable:           v1.36.2  2026-06-30 (9095) 157MB classic ⭐️バージョン指定はこれ使う
  1.34/stable:           v1.34.9  2026-06-17 (9058) 160MB classic
  1.33/stable:           v1.33.13 2026-07-01 (9066) 156MB classic
  1.32/stable:           v1.32.13 2026-03-11 (8707) 152MB classic
root@kubearm:/microk8s/script# 

Headlampを使い始めるから、 x86で書いたメモ 見ながら同じようにやってみる。

Dashboardが非推奨になったから、同じようにHeadlamp使う設定入れた。

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
root@kubearm:/microk8s/log# cat kube.log 
---Recreate start---
-------- 2026-08-30_06:04:35 --------
microk8s (1.36/stable) v1.36.2 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
Host-access is enabled
Disabling DNS
Reconfiguring kubelet
Removing DNS manifest
deployment.apps "coredns" deleted from kube-system namespace
serviceaccount "coredns" deleted from kube-system namespace
configmap "coredns" deleted from kube-system namespace
service "kube-dns" deleted from kube-system namespace
clusterrole.rbac.authorization.k8s.io "coredns" deleted
clusterrolebinding.rbac.authorization.k8s.io "coredns" deleted
DNS is disabled
Enabling DNS ⭐️前にやったDNS設定もできたな
Will use  172.16.17.15 as upstream nameservers
Applying manifest
serviceaccount/coredns created
configmap/coredns created
deployment.apps/coredns created
service/kube-dns created
clusterrole.rbac.authorization.k8s.io/coredns created
clusterrolebinding.rbac.authorization.k8s.io/coredns created
CoreDNS service deployed with IP address 10.152.183.10
Restarting kubelet
DNS is enabled
Addon core/helm3 is already enabled
microk8s is running ⭐️動いたな
high-availability: no
  datastore master nodes: 127.0.0.1:19001
  datastore standby nodes: none
addons:
  enabled:
    ha-cluster           # (core) Configure high availability on the current node
    helm                 # (core) Helm - the package manager for Kubernetes
    helm3                # (core) Helm 3 - the package manager for Kubernetes
    host-access          # (core) Allow Pods connecting to Host services smoothly
    hostpath-storage     # (core) Storage class; allocates storage from host directory
    registry             # (core) Private image registry exposed on localhost:32000
    storage              # (core) Alias to hostpath-storage add-on, deprecated
  disabled:
    cert-manager         # (core) Cloud native certificate management
    cis-hardening        # (core) Apply CIS K8s hardening
    community            # (core) The community addons repository
    dns                  # (core) CoreDNS
    ingress              # (core) Ingress controller for external access
    kube-ovn             # (core) An advanced network fabric for Kubernetes
    mayastor             # (core) OpenEBS MayaStor
    metallb              # (core) Loadbalancer for your Kubernetes cluster
    metrics-server       # (core) K8s Metrics Server for API access to service metrics
    minio                # (core) MinIO object storage (DEPRECATED). This addon is deprecated and will be completely removed in the upcoming versions
    observability        # (core) A lightweight observability stack for logs, traces and metrics
    prometheus           # (core) Prometheus operator for monitoring and logging
    rbac                 # (core) Role-Based Access Control for authorisation
    rook-ceph            # (core) Distributed Ceph storage using Rook
"headlamp" has been added to your repositories
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "headlamp" chart repository
Update Complete. ⎈Happy Helming!⎈
NAME: headlamp
LAST DEPLOYED: Sun Aug 30 06:06:11 2026
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
1. Get the application URL by running these commands:
  export POD_NAME=$(kubectl get pods --namespace kube-system -l "app.kubernetes.io/name=headlamp,app.kubernetes.io/instance=headlamp" -o jsonpath="{.items[0].metadata.name}")
  export CONTAINER_PORT=$(kubectl get pod --namespace kube-system $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
  echo "Visit http://127.0.0.1:8080 to use your application"
  kubectl --namespace kube-system port-forward $POD_NAME 8080:$CONTAINER_PORT
2. Get the token using
  kubectl create token headlamp --namespace kube-system
serviceaccount/headlamp-admin created
clusterrolebinding.rbac.authorization.k8s.io/headlamp-admin configured
=== Headlamp Login Token ===
(長〜いトークン文字列)
-------- kubernetes cluster created --------
-------- 2026-08-30_06:06:24 --------
root@kubearm:/microk8s/log# 

初回やからかもしれんけど、HeadlampのPod作るの時間かかってsleep 10ではまだ起動しかけてる途中やった。

20秒に増やしとこか。

それでも接続は一発でできた。マップの右端のほうにheadlampってできとる。

arm64-m8s-kubearm-ubu26

dockerイメージをインポート

rancher desktopで作ったdockerイメージの元ファイルをarm64のkubernetes環境へmicrok8s images importさせる。

元のイメージはrancher使ってる間に作っといた。

root@kubearm:/microk8s/script# ls -lh /microk8s/nariDockerDat/Dockerimages/
total 7.4G
-rw-r--r-- 1 501 dialout 1.2G Aug 23 04:24 save-django.tar
-rw-r--r-- 1 501 dialout 420M Aug 23 04:23 save-mariadb.tar
-rw-r--r-- 1 501 dialout 5.8G Aug 23 04:24 save-xrdpubu.tar
root@kubearm:/microk8s/script# 

teratermマクロ使うから見直して使う。

x86のときに .ctrって外せ ってgemini先生に教えてもらったな。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
nari@kubearm:~$ sudo su -
[sudo: authenticate] パスワード:
root@kubearm:~# cd /data ⭐️永続化領域にデータ置いてちょ
root@kubearm:/data# rm -fR gvis-pv-ubun ; sync ; cp /microk8s/nariDockerDat/gvis-pv-ubun.tar.gz /data ; tar xzf gvis-pv-ubun.tar.gz
root@kubearm:/data# chown -R nari:nari gvis-pv-ubun ; chmod -R 777 gvis-pv-ubun ; sync ⭐️xrdpコンテナで使う永続化領域できたな
root@kubearm:/data# cd /microk8s/nariDockerDat/DockerImages ⭐️rancherで作っといたイメージ置き場に行ってちょ
root@kubearm:/microk8s/nariDockerDat/DockerImages# microk8s.ctr images rm docker.io/library/save-django:gvis-saved
WARN[0000] docker.io/library/save-django:gvis-saved: image not found
root@kubearm:/microk8s/nariDockerDat/DockerImages# microk8s.ctr images rm docker.io/library/save-xrdpubu:gvis-saved
WARN[0000] docker.io/library/save-xrdpubu:gvis-saved: image not found
root@kubearm:/microk8s/nariDockerDat/DockerImages# microk8s     images import save-django.tar
Pushing OCI images to 192.168.1.116:25000
root@kubearm:/microk8s/nariDockerDat/DockerImages# microk8s     images import save-xrdpubu.tar
Pushing OCI images to 192.168.1.116:25000
root@kubearm:/microk8s/nariDockerDat/DockerImages# microk8s.ctr images ls | grep save ⭐️rancher desktopで作ったイメージ入ったな
docker.io/library/save-django:gvis-saved  application/vnd.oci.image.manifest.v1+json sha256:088d07ee3e18787187d79d10937eb9db6fd5308435647ccb04ea570d55af8d38 1.2 GiB linux/arm64 io.cri-containerd.image=managed
docker.io/library/save-xrdpubu:gvis-saved application/vnd.oci.image.manifest.v1+json sha256:0b32f2e2a1099fccf5c408323050213e44373693d4888c0653b77470aa86b22a 5.7 GiB linux/arm64 io.cri-containerd.image=managed
root@kubearm:/microk8s/nariDockerDat/DockerImages#

毎度このリスト横に長いなぁ。ここでは不必要な空白削除してログに入れといた。

サイズが1.2GiBと5.7GiBになっててarm64のイメージになってることを確認できたらOK。

永続化領域をコピー

mariadbのデータとdjangoな。

mariadbのデータ流し込み

mariadbとdjangoのデータ流し込んでく。teratermマクロ使ってscpで流し込みからpodの再作成まで。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
nari@kubearm:~$ sudo su -
[sudo: authenticate] パスワード:
root@kubearm:~# rm -f /tmp/*.sql ; rm -f /tmp/gvis.cnf
root@kubearm:~# ps -ef |grep -v grep |grep -c scp
2
root@kubearm:~#
root@kubearm:~# ps -ef |grep -v grep |grep -c scp
0
root@kubearm:~# echo SCP finish ⭐️x86側の永続化領域からバックアップとってこれたな
SCP finish
m8
root@kubearm:~# m8
root@kubearm:/microk8s# kubectl delete -f sv-mariadb-pod.yaml
kubectl delete -f gvis-PersistentVol-mariadbconf.yaml
Error from server (NotFound): error when deleting "sv-mariadb-pod.yaml": pods "sv-mariadb" not found
root@kubearm:/microk8s# kubectl delete -f gvis-PersistentVol-mariadbconf.yaml
kubectl delete -f gvis-PersistentVol-mariadb.yaml
persistentvolume "gvis-pv-mariadbconf" deleted
persistentvolumeclaim "gvis-pv-mariadbconf-claim" deleted from default namespace
root@kubearm:/microk8s# kubectl delete -f gvis-PersistentVol-mariadb.yaml
persistentvolume "gvis-pv-mariadb" deleted
persistentvolumeclaim "gvis-pv-mariadb-claim" deleted from default namespace
root@kubearm:/microk8s# cd /data
root@kubearm:/data# rm -fR ./gvis-pv-mariadb ; rm -fR ./gvis-pv-mariadbconf ; sync ; sync
root@kubearm:/data# mkdir -p /data/gvis-pv-mariadbconf/nari/fullback/ ; mkdir -p gvis-pv-mariadb
root@kubearm:/data# cd /microk8s/nariDockerDat/ ⭐️コピってちょ
root@kubearm:/microk8s/nariDockerDat# cp -p  /tmp/gvis.cnf                                             /microk8s/nariDockerDat/sv_mariadb11conf/
root@kubearm:/microk8s/nariDockerDat# mv     /tmp/gvis.cnf                                             /data/gvis-pv-mariadbconf/
root@kubearm:/microk8s/nariDockerDat# cp -p ./sv_mariadb11conf/nari/fullback/2_fullRecover.sh          /data/gvis-pv-mariadbconf/nari/fullback/
root@kubearm:/microk8s/nariDockerDat# cp -p ./sv_mariadb11conf/nari/fullback/4_nariDB_DjangoRecover.sh /data/gvis-pv-mariadbconf/nari/fullback/
root@kubearm:/microk8s/nariDockerDat# mv    /tmp/FullBackup_nariDB_1st.sql                             /data/gvis-pv-mariadbconf/nari/
root@kubearm:/microk8s/nariDockerDat# mv    /tmp/FullBackup_nariDB_Django.sql                          /data/gvis-pv-mariadbconf/nari/
root@kubearm:/microk8s/nariDockerDat# cd /data
root@kubearm:/data# chmod -R 777 gvis-pv-mariadbconf
root@kubearm:/data# chmod -R 777 gvis-pv-mariadb
root@kubearm:/data# chmod 644 /data/gvis-pv-mariadbconf/gvis.cnf
root@kubearm:/data# m8
root@kubearm:/microk8s# kubectl create -f gvis-PersistentVol-mariadbconf.yaml
persistentvolume/gvis-pv-mariadbconf created
persistentvolumeclaim/gvis-pv-mariadbconf-claim created
root@kubearm:/microk8s# kubectl create -f gvis-PersistentVol-mariadb.yaml
persistentvolume/gvis-pv-mariadb created
persistentvolumeclaim/gvis-pv-mariadb-claim created
root@kubearm:/microk8s# kubectl create -f sv-mariadb-pod.yaml ⭐️mariadbのPodできた
pod/sv-mariadb created
root@kubearm:/microk8s# sync ; sync ; sleep 30

podにログインさせてデータベースのロードする。合間にsleep入れといて起動の間合いをとる。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
root@kubearm:/microk8s# kubectl exec -it `kubectl get pod | grep mariadb | awk '{print $1}'` -- bash
root@svmariadb:/# sync ; sleep 20 ; sync ⭐️mariadbのPodでbash使える
/bin/sh /etc/mysql/conf.d/nari/fullback/2_fullRecover.sh
root@svmariadb:/# /bin/sh /etc/mysql/conf.d/nari/fullback/2_fullRecover.sh ⭐️x86のdocker永続化領域にあった本番データをリストアしてちょ
sync ; sleep 20 ; sync
root@svmariadb:/# sync ; sleep 20 ; sync
/bin/sh /etc/mysql/conf.d/nari/fullback/4_nariDB_DjangoRecover.sh ⭐️x86のdocker永続化領域にあったテストデータをリストアしてちょ
root@svmariadb:/# /bin/sh /etc/mysql/conf.d/nari/fullback/4_nariDB_DjangoRecover.sh
sync ; sleep 20 ; sync
root@svmariadb:/# sync ; sleep 20 ; sync
mariadb -unari -pXXXXXXXXXXXXXX
root@svmariadb:/# mariadb -unari -pXXXXXXXXXXXXXX ⭐️mariadbにつないでちょ
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 11.4.13-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' ;
+--------------------+------------+
| Variable_name      | Value      |
+--------------------+------------+
| max_allowed_packet | 1073741824 | ⭐️mariadbの設定ファイル(/etc/mysql/conf.dへマウントした内容)反映できとる
+--------------------+------------+
1 row in set (0.001 sec)

MariaDB [(none)]> show databases ;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| nariDB_1st         | ⭐️リストアできとる
| nariDB_Django      | ⭐️リストアできとる
+--------------------+
3 rows in set (0.000 sec)

MariaDB [(none)]> use nariDB_1st ;
select count(*) from GVIS_keihi ;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

exit
Database changed
MariaDB [nariDB_1st]> select count(*) from GVIS_keihi ;
+----------+
| count(*) |
+----------+
|    13378 | ⭐️レコード入っとる
+----------+
1 row in set (0.002 sec)

MariaDB [nariDB_1st]> exit
Bye
root@svmariadb:/# exit
exit
root@kubearm:/microk8s# rm -f /data/gvis-pv-mariadbconf/nari/FullBackup_nariDB_1st.sql
root@kubearm:/microk8s# rm -f /data/gvis-pv-mariadbconf/nari/FullBackup_nariDB_Django.sql
root@kubearm:/microk8s#

うまいこといっとる。

djangoのデータ流し込み

なんでかわからんかったけど、PV/PVC削除して作り直すところが失敗してて最初からやり直した。

マニフェストがアカンのかなって思ったけど、結局はそのまま使えた。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
nari@kubearm:~$ sudo su -
[sudo: authenticate] パスワード:
root@kubearm:~# rm -f /tmp/sv_django-uwsgi-nginx.tar.gz
root@kubearm:~# ps -ef |grep -v grep |grep -c scp
0
root@kubearm:~# echo SCP finish
cd /microk8s/nariDockerDat ; rm -f sv_django-uwsgi-nginx.tar.gz ; mv /tmp/sv_django-uwsgi-nginx.tar.gz ./
SCP finish
root@kubearm:~# cd /microk8s/nariDockerDat ; rm -f sv_django-uwsgi-nginx.tar.gz ; mv /tmp/sv_django-uwsgi-nginx.tar.gz ./
rm -fR ./sv_django-uwsgi-nginx
root@kubearm:/microk8s/nariDockerDat# rm -fR ./sv_django-uwsgi-nginx
root@kubearm:/microk8s/nariDockerDat# m8
kubectl delete -f sv-django-pod.yaml
root@kubearm:/microk8s# kubectl delete -f sv-django-pod.yaml
kubectl delete -f gvis-PersistentVol-sv_django-uwsgi-nginx.yaml
Error from server (NotFound): error when deleting "sv-django-pod.yaml": pods "sv-django" not found ⭐️なんもないから初回はエラー
root@kubearm:/microk8s# kubectl delete -f gvis-PersistentVol-sv_django-uwsgi-nginx.yaml ⭐️1回目ここでうまいこといかんかった
persistentvolume "gvis-pv-django-uwsgi-nginx" deleted
persistentvolumeclaim "gvis-pv-django-uwsgi-nginx-claim" deleted from default namespace
root@kubearm:/microk8s# cd /data
root@kubearm:/data# rm -fR ./gvis-pv-django-uwsgi-nginx ; rm -fR ./gvis-pv-django-sslcerts ; sync
root@kubearm:/data# cp -p /microk8s/nariDockerDat/sv_django-uwsgi-nginx.tar.gz ./
root@kubearm:/data# tar xzf sv_django-uwsgi-nginx.tar.gz ⭐️コード展開してくれー
root@kubearm:/data# mv ./sv_django-uwsgi-nginx/app ./gvis-pv-django-uwsgi-nginx ; mkdir gvis-pv-django-sslcerts
root@kubearm:/data# /bin/sh /data/sv_django-uwsgi-nginx/kubearmCopy.sh
root@kubearm:/data# chmod 777 gvis-pv-django-uwsgi-nginx ; chmod 777 gvis-pv-django-sslcerts
root@kubearm:/data# rm -fR ./sv_django-uwsgi-nginx/
root@kubearm:/data# m8
root@kubearm:/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
root@kubearm:/microk8s# kubectl create -f sv-django-pod.yaml
pod/sv-django created ⭐️できたな
root@kubearm:/microk8s# sleep 10
root@kubearm:/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 ⭐️未更新のモジュールけっこうあるからrancher環境で更新せなアカンな
Package            Version Latest Type
------------------ ------- ------ -----
importlib_metadata 9.0.0   9.0.1  wheel
kiwisolver         1.5.0   1.5.1  wheel
numpy              2.5.1   2.5.2  wheel
pip                25.3    26.2.1 wheel
sqlparse           0.5.5   0.6.0  wheel
wheel              0.47.0  0.48.0 wheel

[notice] A new release of pip is available: 25.3 -> 26.2.1
[notice] To update, run: pip install --upgrade pip
root@sv-django:/# exit
exit
root@kubearm:/microk8s# sc
root@kubearm:/microk8s/script# sh ./415_ReCreateHTTPSpod.sh ⭐️httpsも動いてや
NAME         READY   STATUS    RESTARTS   AGE
sv-django    1/1     Running   0          61s
sv-mariadb   1/1     Running   0          5m37s
Error from server (NotFound): error when deleting "/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          62s
sv-https-portal   0/1     ContainerCreating   0          0s
sv-mariadb        1/1     Running             0          5m38s
root@kubearm:/microk8s/script#

ステータスはcreatingとか出てるけど、10秒ぐらいでpodは起動して使える状態になる。

xrdpのpod起動する

x86のときにあったマニフェスト追加を同じようにやっとく。

1
2
3
4
root@kubearm:/microk8s# cat cl-ubun-pod.yaml | egrep 'securityCon|privile'
      securityContext:
        privileged: true
root@kubearm:/microk8s# 
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
root@kubearm:/microk8s/script# sh ./413_ReCreateXRDPpod.sh 
NAME              READY   STATUS    RESTARTS   AGE
sv-django         1/1     Running   0          14m
sv-https-portal   1/1     Running   0          13m
sv-mariadb        1/1     Running   0          19m
Error from server (NotFound): error when deleting "/microk8s/cl-ubun-pod.yaml": pods "cl-ubun" not found
pod/cl-ubun created
NAME              READY   STATUS              RESTARTS   AGE
cl-ubun           0/1     ContainerCreating   0          0s ⭐️がんばれー
sv-django         1/1     Running             0          14m
sv-https-portal   1/1     Running             0          13m
sv-mariadb        1/1     Running             0          19m
root@kubearm:/microk8s/script# 
(10秒ぐらい待つ)
root@kubearm:/microk8s/script# microk8s kubectl get po
NAME              READY   STATUS    RESTARTS   AGE
cl-ubun           1/1     Running   0          48s ⭐️動いたー
sv-django         1/1     Running   0          15m
sv-https-portal   1/1     Running   0          14m
sv-mariadb        1/1     Running   0          19m
root@kubearm:/microk8s/script#

フォワーディング

これやっとかなkubernetes稼働ホスト以外のホストから接続できん。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
root@kubearm:/microk8s/script# cat 306_allForwardingStart.sh 
## -------------------------------------------------------------------------
## Script Name  : 306_allForwardingStart.sh
##  Created by  : T.Naritomi
##          on  : 2024.12.24
##  Updated by  : 2026.08.31
##          on  :
##  Parameters  :
##  Return Code : 0=Normal End
##     Comments :
## -------------------------------------------------------------------------
## ---detail----------------------------------------------------------------

microk8s kubectl port-forward --address 0.0.0.0 `microk8s kubectl get pod | grep mariadb   | awk '{print $1}'` 13306:3306 &

microk8s kubectl port-forward --address 0.0.0.0 `microk8s kubectl get pod | grep cl-ubun   | awk '{print $1}'` 33389:3389 &

microk8s kubectl port-forward --address 0.0.0.0 `microk8s kubectl get pod | grep sv-django | awk '{print $1}'` 38080:8080 &

microk8s kubectl port-forward --address 0.0.0.0 `microk8s kubectl get pod | grep sv-https  | awk '{print $1}'` 30443:443 &

microk8s kubectl port-forward -n kube-system service/headlamp 18080:80 --address 0.0.0.0 &

exit $?
root@kubearm:/microk8s/script# sh ./306_allForwardingStart.sh 
root@kubearm:/microk8s/script# Unable to listen on port 18080: Listeners failed to create with the following errors: [unable to create listener: Error listen tcp4 0.0.0.0:18080: bind: address already in use] ⭐️Headlamp動いてるとこうなる、ほっといてええ
error: unable to listen on any of the requested ports: [{18080 4466}]
Forwarding from 0.0.0.0:30443 -> 443
Forwarding from 0.0.0.0:13306 -> 3306
Forwarding from 0.0.0.0:38080 -> 8080
Forwarding from 0.0.0.0:33389 -> 3389

root@kubearm:/microk8s/script#

今回もなんとか動いたな。クラスタ作ってPod動かしたらストレージとワークロードってところ確認して赤い表示ないこと見とく。

arm64-m8s-kubearm-ubu26

arm64-m8s-kubearm-ubu26

宅内DNS参照できとるんか

ubuntu22から24にアップデートしたときに確認したけど、Podにログインして名前解決の確認してみる。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
root@kubearm:/microk8s/script# cat 403_LoginXRDPpod.sh 
#!/bin/sh
## -------------------------------------------------------------------------
## Script Name  : 403_LoginXRDPpod.sh
##  Created by  : T.Naritomi
##          on  : 2024.12.24
##  Updated by  : 
##          on  :
##  Parameters  : 
##  Return Code : 0=Normal End
##     Comments :
## -------------------------------------------------------------------------

## ---detail---------------------------------------------------------------- 

microk8s kubectl exec -it `microk8s kubectl get pod | grep cl-ubun | awk '{print $1}'` -- bash

exit
root@kubearm:/microk8s/script# sh ./403_LoginXRDPpod.sh 
root@clubu-kubearm:/# uname -n
clubu-kubearm
root@clubu-kubearm:/# cat /etc/hosts
# Kubernetes-managed hosts file.
127.0.0.1	localhost
::1	localhost ip6-localhost ip6-loopback
fe00::0	ip6-localnet
fe00::0	ip6-mcastprefix
fe00::1	ip6-allnodes
fe00::2	ip6-allrouters
10.1.103.138	clubu-kubearm
root@clubu-kubearm:/# nslookup narimac-mini.intra.gavann-it.com | tail -4
Name:	narimac-mini.intra.gavann-it.com
Address: 192.168.1.35 ⭐️名前解決できとる
** server can't find narimac-mini.intra.gavann-it.com: NXDOMAIN

root@clubu-kubearm:/# nslookup kubearm.intra.gavann-it.com | tail -4
Name:	kubearm.intra.gavann-it.com
Address: 192.168.1.116 ⭐️名前解決できとる
** server can't find kubearm.intra.gavann-it.com: NXDOMAIN

root@clubu-kubearm:/# nslookup gvis-mac.intra.gavann-it.com | tail -4
Name:	gvis-mac.intra.gavann-it.com
Address: 192.168.1.117 ⭐️名前解決できとる
** server can't find gvis-mac.intra.gavann-it.com: NXDOMAIN

root@clubu-kubearm:/# nslookup nafslinux.intra.gavann-it.com | tail -4
Name:	nafslinux.intra.gavann-it.com
Address: 192.168.1.118 ⭐️名前解決できとる
** server can't find nafslinux.intra.gavann-it.com: NXDOMAIN

root@clubu-kubearm:/# nslookup kubelinux.intra.gavann-it.com | tail -4
Name:	kubelinux.intra.gavann-it.com
Address: 192.168.1.119 ⭐️名前解決できとる
** server can't find kubelinux.intra.gavann-it.com: NXDOMAIN

root@clubu:/#

xrdpからPod確認

djangoのPod動いとる。armでカーネル7が使えてて6.1のdjangoが動いとる。

arm64-m8s-kubearm-ubu26

今月の本番データも見えてて、mariadbのデータが読めとる。

arm64-m8s-kubearm-ubu26

ネットの速度も遅くないし、本番のdjangoソースの履歴をvscodeで見えとる。

arm64-m8s-kubearm-ubu26

ようやっとx86/armのdocker/kubernetesの環境をubuntu26で維持できるようになった。