make to also output catalog
This commit is contained in:
42
README.md
42
README.md
@@ -1,23 +1,29 @@
|
|||||||
# monok8s
|
# monok8s
|
||||||
Alpine-based Kubernetes cluster image for Mono's Gateway Development Kit
|
An Alpine-based Kubernetes cluster image for Mono's Gateway Development Kit
|
||||||
|
|
||||||
https://docs.mono.si/gateway-development-kit/getting-started
|
https://docs.mono.si/gateway-development-kit/getting-started
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
* A/B deployment
|
* A/B deployment
|
||||||
* Read-only OS
|
* Read-only RootFS
|
||||||
* k8s style OS upgrade (see Upgrading)
|
* k8s style OS upgrade (see Upgrading)
|
||||||
|
|
||||||
## IMPORTANT NOTES
|
## IMPORTANT NOTES
|
||||||
|
* This is not your everyday linux image! It is best suited for users that is already familiar
|
||||||
|
with k8s. For first-timers, you may want to try the default config that gives you a ready-to-used
|
||||||
|
cluster then get yourself started from there
|
||||||
|
|
||||||
* The 3 RJ45 ports are label in eth1, eth2, eth0 respectively by the kernel (left to right)
|
* The 3 RJ45 ports are label in eth1, eth2, eth0 respectively by the kernel (left to right)
|
||||||
* So `ip addr eth0` is your right most port
|
So `ip addr eth0` is your right most port
|
||||||
* If the fan stopped spinning. Unplug ASAP! Otherwise CPU temp goes to the moon.
|
|
||||||
|
|
||||||
### Table of Contents
|
### Table of Contents
|
||||||
1. Flashing
|
1. Flashing
|
||||||
- [USB](docs/flashing-usb.md)
|
- [USB](docs/flashing-usb.md)
|
||||||
- [Over network (tftp)](docs/flashing-network.md)
|
- [Over network (tftp)](docs/flashing-network.md)
|
||||||
2. [Upgrading](docs/ota.md)
|
2. [Upgrading](docs/ota.md)
|
||||||
|
3. Getting shell access to the host
|
||||||
|
- UART. The thing you did in first time flashing.
|
||||||
|
- [Install an ssh pod](docs/installing-ssh-pod.md) (Recommended)
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
Find the latest package versions and update build.env
|
Find the latest package versions and update build.env
|
||||||
@@ -25,17 +31,41 @@ Find the latest package versions and update build.env
|
|||||||
* [busybox](https://github.com/mirror/busybox/archive/refs/tags/)
|
* [busybox](https://github.com/mirror/busybox/archive/refs/tags/)
|
||||||
* [CRI-O](https://github.com/cri-o/cri-o/releases)
|
* [CRI-O](https://github.com/cri-o/cri-o/releases)
|
||||||
* [Kubelet](https://kubernetes.io/releases/download/)
|
* [Kubelet](https://kubernetes.io/releases/download/)
|
||||||
|
* [UBoot](https://github.com/u-boot/)
|
||||||
|
|
||||||
Then run
|
Then run
|
||||||
```
|
```
|
||||||
make release
|
make release
|
||||||
```
|
```
|
||||||
|
|
||||||
Inspect and modify config/cluster.env, then run
|
The default configuration will boot as a first time control-plane. Adjust to your own needs.
|
||||||
|
|
||||||
|
For control-plane
|
||||||
```
|
```
|
||||||
make cluster-config
|
make cluster-config \
|
||||||
|
MKS_HOSTNAME=monok8s-master \
|
||||||
|
MKS_CLUSTER_ROLE=control-plane \
|
||||||
|
MKS_INIT_CONTROL_PLANE=true \
|
||||||
|
MKS_MGMT_ADDRESS=10.0.0.10/24 \
|
||||||
|
MKS_APISERVER_ADVERTISE_ADDRESS=10.0.0.10
|
||||||
```
|
```
|
||||||
|
|
||||||
|
For worker
|
||||||
|
```
|
||||||
|
make cluster-config \
|
||||||
|
MKS_HOSTNAME=monok8s-worker \
|
||||||
|
MKS_CLUSTER_ROLE=worker \
|
||||||
|
MKS_INIT_CONTROL_PLANE=no \
|
||||||
|
MKS_MGMT_ADDRESS=10.0.0.10/24 \
|
||||||
|
MKS_APISERVER_ADVERTISE_ADDRESS=10.0.0.10 \
|
||||||
|
MKS_API_SERVER_ENDPOINT=10.0.0.1:6443 \
|
||||||
|
MKS_CNI_PLUGIN=none \
|
||||||
|
MKS_BOOTSTRAP_TOKEN=abcd12.ef3456789abcdef0 \
|
||||||
|
MKS_DISCOVERY_TOKEN_CA_CERT_HASH=sha256:9f1c2b3a4d5e6f7890abc1234567890abcdef1234567890abcdef1234567890ab
|
||||||
|
```
|
||||||
|
|
||||||
|
Check inside [configs/cluster.env.default](configs/cluster.env.default) for configuration details
|
||||||
|
|
||||||
### Making sub stages
|
### Making sub stages
|
||||||
```bash
|
```bash
|
||||||
make build-base # The image that builds the kernel and everything
|
make build-base # The image that builds the kernel and everything
|
||||||
|
|||||||
@@ -160,8 +160,19 @@ e2fsck -fy "$ROOTFS_IMG"
|
|||||||
|
|
||||||
echo "##################################################### Compressing OTA Image"
|
echo "##################################################### Compressing OTA Image"
|
||||||
zstd -19 -T0 -f "$ROOTFS_IMG" -o "$ROOTFS_IMG_ZST"
|
zstd -19 -T0 -f "$ROOTFS_IMG" -o "$ROOTFS_IMG_ZST"
|
||||||
sha256sum "$ROOTFS_IMG" > "$ROOTFS_IMG.sha256"
|
|
||||||
sha256sum "$ROOTFS_IMG_ZST" > "$ROOTFS_IMG_ZST.sha256"
|
tee >(wc -c > "${ROOTFS_IMG}.size") < "$ROOTFS_IMG" | sha256sum > "${ROOTFS_IMG}.sha256"
|
||||||
|
tee >(wc -c > "${ROOTFS_IMG_ZST}.size") < "$ROOTFS_IMG_ZST" | sha256sum > "${ROOTFS_IMG_ZST}.sha256"
|
||||||
|
|
||||||
|
cat > catalog.txt <<EOF
|
||||||
|
- version: $KUBE_VERSION
|
||||||
|
url: "monok8s-$KUBE_VERSION-$TAG.ext4.zst"
|
||||||
|
checksum: $(cut -d' ' -f1 < "${ROOTFS_IMG}.sha256")
|
||||||
|
size: $(< "${ROOTFS_IMG}.size")
|
||||||
|
zChecksum: $(cut -d' ' -f1 < "${ROOTFS_IMG_ZST}.sha256")
|
||||||
|
zSize: $(< "${ROOTFS_IMG_ZST}.size")
|
||||||
|
tag: "$TAG"
|
||||||
|
EOF
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# 2. Build full disk image
|
# 2. Build full disk image
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ TAG=dev
|
|||||||
# The Linux kernel, from NXP
|
# The Linux kernel, from NXP
|
||||||
NXP_VERSION=lf-6.18.2-1.0.0
|
NXP_VERSION=lf-6.18.2-1.0.0
|
||||||
CRIO_VERSION=cri-o.arm64.v1.35.2
|
CRIO_VERSION=cri-o.arm64.v1.35.2
|
||||||
KUBE_VERSION=v1.35.3
|
KUBE_VERSION=v1.34.1
|
||||||
|
|
||||||
# Mono's tutorial said fsl-ls1046a-rdb.dtb but our shipped board is not that one
|
# Mono's tutorial said fsl-ls1046a-rdb.dtb but our shipped board is not that one
|
||||||
# We need fsl-ls1046a-rdb-sdk.dtb here
|
# We need fsl-ls1046a-rdb-sdk.dtb here
|
||||||
|
|||||||
8
makefile
8
makefile
@@ -26,7 +26,9 @@ NODE_ENV := $(OUT_DIR)/node.env
|
|||||||
|
|
||||||
BOARD_ITB := $(OUT_DIR)/board.itb
|
BOARD_ITB := $(OUT_DIR)/board.itb
|
||||||
INITRAMFS := $(OUT_DIR)/initramfs.cpio.gz
|
INITRAMFS := $(OUT_DIR)/initramfs.cpio.gz
|
||||||
RELEASE_IMAGE := $(OUT_DIR)/monok8s-$(TAG).img.gz
|
CATALOG := $(OUT_DIR)/catalog-$(KUBE_VERSION)-$(TAG).txt
|
||||||
|
RELEASE_IMAGE := $(OUT_DIR)/monok8s-$(KUBE_VERSION)-$(TAG).img.gz
|
||||||
|
PART_IMAGE := $(OUT_DIR)/monok8s-$(KUBE_VERSION)-$(TAG).ext4.zst
|
||||||
|
|
||||||
KERNEL_IMAGE := $(OUT_DIR)/Image.gz
|
KERNEL_IMAGE := $(OUT_DIR)/Image.gz
|
||||||
|
|
||||||
@@ -220,13 +222,15 @@ $(RELEASE_IMAGE): $(RELEASE_DEPS) | $(OUT_DIR)
|
|||||||
-e KUBE_IMG_CACHE=/var/cache/k8s-images \
|
-e KUBE_IMG_CACHE=/var/cache/k8s-images \
|
||||||
-e KUBE_VERSION=$(KUBE_VERSION) \
|
-e KUBE_VERSION=$(KUBE_VERSION) \
|
||||||
-e RELEASE_IMAGE=$(RELEASE_IMAGE) \
|
-e RELEASE_IMAGE=$(RELEASE_IMAGE) \
|
||||||
|
-e PART_IMAGE=$(PART_IMAGE) \
|
||||||
-e ROOTFS=/out/rootfs \
|
-e ROOTFS=/out/rootfs \
|
||||||
-e TAG=$(TAG) \
|
-e TAG=$(TAG) \
|
||||||
$(DOCKER_IMAGE_ROOT)/buildenv-alpine:$(TAG) \
|
$(DOCKER_IMAGE_ROOT)/buildenv-alpine:$(TAG) \
|
||||||
bash -lc '/build-rootfs.sh'); \
|
bash -lc '/build-rootfs.sh'); \
|
||||||
docker start -a $$cid; \
|
docker start -a $$cid; \
|
||||||
docker cp $$cid:/build/output.img.gz $@; \
|
docker cp $$cid:/build/output.img.gz $@; \
|
||||||
docker cp $$cid:/build/rootfs.ext4.zst $(OUT_DIR)/rootfs.ext4.zst; \
|
docker cp $$cid:/build/rootfs.ext4.zst $(PART_IMAGE); \
|
||||||
|
docker cp $$cid:/build/catalog.txt $(CATALOG); \
|
||||||
docker rm $$cid
|
docker rm $$cid
|
||||||
|
|
||||||
test -f $@
|
test -f $@
|
||||||
|
|||||||
Reference in New Issue
Block a user