K8s Applications mit MicroK8S auf Raspberry PI. Alfred Sabitzer
-rw-r--r-- 0/0 3 2021-10-15 21:22 5fe6d80a697427a6b315445103e12f8e5e14a6f9f071e119d9da5aa7787dedf0/VERSION
-rw-r--r-- 0/0 1432 2021-10-15 21:22 5fe6d80a697427a6b315445103e12f8e5e14a6f9f071e119d9da5aa7787dedf0/json
-rw-r--r-- 0/0 10244608 2021-10-15 21:22 5fe6d80a697427a6b315445103e12f8e5e14a6f9f071e119d9da5aa7787dedf0/layer.tar
drwxr-xr-x 0/0 0 2021-10-15 21:22 678b476f25ed3f1e67caefc50b99dba99e907d2b692e7198f4f7982b1781dd97/
-rw-r--r-- 0/0 3 2021-10-15 21:22 678b476f25ed3f1e67caefc50b99dba99e907d2b692e7198f4f7982b1781dd97/VERSION
-rw-r--r-- 0/0 482 2021-10-15 21:22 678b476f25ed3f1e67caefc50b99dba99e907d2b692e7198f4f7982b1781dd97/json
-rw-r--r-- 0/0 297840128 2021-10-15 21:22 678b476f25ed3f1e67caefc50b99dba99e907d2b692e7198f4f7982b1781dd97/layer.tar
drwxr-xr-x 0/0 0 2021-10-15 21:22 916863cb53dae4e13619f82e13ddeded5a2a2f552e5ac0fad747eff6cafe57ea/
-rw-r--r-- 0/0 3 2021-10-15 21:22 916863cb53dae4e13619f82e13ddeded5a2a2f552e5ac0fad747eff6cafe57ea/VERSION
-rw-r--r-- 0/0 482 2021-10-15 21:22 916863cb53dae4e13619f82e13ddeded5a2a2f552e5ac0fad747eff6cafe57ea/json
-rw-r--r-- 0/0 2048 2021-10-15 21:22 916863cb53dae4e13619f82e13ddeded5a2a2f552e5ac0fad747eff6cafe57ea/layer.tar
drwxr-xr-x 0/0 0 2021-10-15 21:22 951da7c93bcb5858e3370883aa7ebb5bc7e54ad5a51a9124350c4bf638dfce39/
-rw-r--r-- 0/0 3 2021-10-15 21:22 951da7c93bcb5858e3370883aa7ebb5bc7e54ad5a51a9124350c4bf638dfce39/VERSION
-rw-r--r-- 0/0 482 2021-10-15 21:22 951da7c93bcb5858e3370883aa7ebb5bc7e54ad5a51a9124350c4bf638dfce39/json
-rw-r--r-- 0/0 3584 2021-10-15 21:22 951da7c93bcb5858e3370883aa7ebb5bc7e54ad5a51a9124350c4bf638dfce39/layer.tar
drwxr-xr-x 0/0 0 2021-10-15 21:22 c738b6de5b0a35e613204439d94e3142a49ed7c77568b1372a2ac8e44add5431/
-rw-r--r-- 0/0 3 2021-10-15 21:22 c738b6de5b0a35e613204439d94e3142a49ed7c77568b1372a2ac8e44add5431/VERSION
-rw-r--r-- 0/0 482 2021-10-15 21:22 c738b6de5b0a35e613204439d94e3142a49ed7c77568b1372a2ac8e44add5431/json
-rw-r--r-- 0/0 759808 2021-10-15 21:22 c738b6de5b0a35e613204439d94e3142a49ed7c77568b1372a2ac8e44add5431/layer.tar
drwxr-xr-x 0/0 0 2021-10-15 21:22 d0cabd374001156bcc1eb54fb096bcb80aa5f94e14ed6c73069b64e31f554deb/
-rw-r--r-- 0/0 3 2021-10-15 21:22 d0cabd374001156bcc1eb54fb096bcb80aa5f94e14ed6c73069b64e31f554deb/VERSION
-rw-r--r-- 0/0 482 2021-10-15 21:22 d0cabd374001156bcc1eb54fb096bcb80aa5f94e14ed6c73069b64e31f554deb/json
-rw-r--r-- 0/0 11713024 2021-10-15 21:22 d0cabd374001156bcc1eb54fb096bcb80aa5f94e14ed6c73069b64e31f554deb/layer.tar
drwxr-xr-x 0/0 0 2021-10-15 21:22 e3c9af4387b692800410b9c839fd7964352a56504f884d7975fff36dc077c8c4/
-rw-r--r-- 0/0 3 2021-10-15 21:22 e3c9af4387b692800410b9c839fd7964352a56504f884d7975fff36dc077c8c4/VERSION
-rw-r--r-- 0/0 482 2021-10-15 21:22 e3c9af4387b692800410b9c839fd7964352a56504f884d7975fff36dc077c8c4/json
-rw-r--r-- 0/0 6656 2021-10-15 21:22 e3c9af4387b692800410b9c839fd7964352a56504f884d7975fff36dc077c8c4/layer.tar
drwxr-xr-x 0/0 0 2021-10-15 21:22 eb528dd90d9b2bc0ad36512a3ce210982ca2b2100be249c54335bb4c86b6c520/
-rw-r--r-- 0/0 3 2021-10-15 21:22 eb528dd90d9b2bc0ad36512a3ce210982ca2b2100be249c54335bb4c86b6c520/VERSION
-rw-r--r-- 0/0 482 2021-10-15 21:22 eb528dd90d9b2bc0ad36512a3ce210982ca2b2100be249c54335bb4c86b6c520/json
-rw-r--r-- 0/0 2560 2021-10-15 21:22 eb528dd90d9b2bc0ad36512a3ce210982ca2b2100be249c54335bb4c86b6c520/layer.tar
-rw-r--r-- 0/0 1151 1970-01-01 01:00 manifest.json
-rw-r--r-- 0/0 114 1970-01-01 01:00 repositories
alfred@monitoring:~/GetInfo$ ll *.tar
-rw-rw-r-- 1 alfred alfred 326244864 Oct 15 21:27 getinfo.tar
alfred@monitoring:~/GetInfo$
Wir können aber auch das Dockerfile selbst exportieren.
alfred@monitoring:~/GetInfo$ docker ps -all
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
acdf3516a1ce docker.registry:5000/getinfo:20211015 "/GetInfo" 10 minutes ago Exited (2) 5 minutes ago funny_keller
alfred@monitoring:~/GetInfo$ docker export acdf3516a1ce > getinfo.tar
alfred@monitoring:~/GetInfo$
alfred@monitoring:~/GetInfo$ ll -h *.tar
-rw-rw-r-- 1 alfred alfred 311M Oct 15 21:32 getinfo.tar
alfred@monitoring:~/GetInfo$
alfred@monitoring:~/GetInfo$ tar -tvf getinfo.tar
Mit diesen Befehlen kann man überprüfen was alles im Container drinnenn ist (und das ist eine ganze Menge).
Nun pushen wir den Container in das remote-Repository. Es werden natürlich alle Layer gepushed (in dem Falle gab es die darunterliegenden Layer noch nicht).
alfred@monitoring:~/GetInfo$ docker push docker.registry:5000/getinfo:20211015
The push refers to repository [docker.registry:5000/getinfo]
cae68116d3ec: Pushed
dd68a1e5bd54: Pushed
00e2dc9bf745: Pushed
5a8d0b1f55c0: Pushed
8f352be1ccfe: Pushed
729e17fedb70: Pushed
08ae3e8fdb37: Pushed
6fe1ba639418: Pushed
fa0d2ce7179e: Pushed
092886e29cb5: Pushed
c8d42fc353a6: Pushed
6a91c97933c9: Pushed
ee420dfed78a: Pushed
20211015: digest: sha256:aa82ba777936d4cec354c0b9c5ece353751a96c9717375cfd58d3ed2beea5cf4 size: 3030
alfred@monitoring:~/GetInfo$
Kurze Kontrolle, ob der Container wirklich im Remote Repository gelandet ist.
alfred@monitoring:~/GetInfo$ curl docker.registry:5000/v2/_catalog
{"repositories":["getinfo","hello-world"]}
alfred@monitoring:~/GetInfo$ curl docker.registry:5000/v2/getinfo/tags/list
{"name":"getinfo","tags":["20211015"]}
alfred@monitoring:~/GetInfo$
Auch in der Longhorn-Anzeige kann man schön sehen, dass dieses Volume nicht mehr leer ist, und jetzt bereits ca. 1GB Platz braucht.
Nun erzeugen wir ein yaml-File.
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: getinfo
#namespace: default
spec:
selector:
matchLabels:
app: getinfo
replicas: 1
template: