commit 3650886da2e46b8b7f210b12542c5758fdfcfd91 Author: Knut Ahlers Date: Sat Dec 17 01:05:27 2022 +0100 Initial setup diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d344ba6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +config.json diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..be673c7 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "alpine-on-hetzner"] + path = alpine-on-hetzner + url = https://github.com/MathiasPius/alpine-on-hetzner.git diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ff64b82 --- /dev/null +++ b/Makefile @@ -0,0 +1,29 @@ +ALPINE_VERSION:=3.17.0 +PACKER_VERSION:=1.8.4-r2 +ANSIBLE_CORE_VERSION:=2.13.6-r0 +JQ_VERSION:=1.6-r2 + +export DOCKER_BUILDKIT:=1 + +default: + +config.json: + yq -S . config.yaml >config.json + +create-snapshot: docker-build config.json + envrun -- docker run --rm -i \ + -e "HCLOUD_TOKEN" \ + -v "$(CURDIR):/config:ro" \ + registry.local/alpine-on-hetzner:latest \ + /config/config.json + +docker-build: + docker build \ + --build-arg ALPINE_VERSION=$(ALPINE_VERSION) \ + --build-arg PACKER_VERSION=$(PACKER_VERSION) \ + --build-arg ANSIBLE_CORE_VERSION=$(ANSIBLE_CORE_VERSION) \ + --build-arg JQ_VERSION=$(JQ_VERSION) \ + -t registry.local/alpine-on-hetzner \ + ./alpine-on-hetzner + +.PHONY: config.json diff --git a/alpine-on-hetzner b/alpine-on-hetzner new file mode 160000 index 0000000..1d21f3e --- /dev/null +++ b/alpine-on-hetzner @@ -0,0 +1 @@ +Subproject commit 1d21f3e35c65bcef267c0f98144d3e5d4ab3c4a3 diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000..af515d8 --- /dev/null +++ b/config.yaml @@ -0,0 +1,99 @@ +--- + +apk_tools_version: v2.12.10 +apk_tools_arch: x86_64 +apk_tools_url: https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic//{{ apk_tools_version }}/{{ apk_tools_arch }}/apk.static +apk_tools_checksum: sha256:d7506bb11327b337960910daffed75aa289d8bb350feab624c52965be82ceae8 + +alpine_version: edge +alpine_mirror: http://dl-cdn.alpinelinux.org/alpine +alpine_repositories: [ main, community, testing ] + +boot_size: +100m +root_size: '0' +hostname: alpine-k8s + +packages: + # Alpine base system + openssh: '' + syslinux: '' + linux-virt: '' + cloud-init: '@community' + + # K8s requirements + open-iscsi: '' + open-iscsi-openrc: '' + + cni-plugin-flannel: '@community' + cni-plugins: '@community' + flannel: '@testing' + flannel-contrib-cni: '@testing' + docker: '@community' + uuidgen: '' + nfs-utils: '' + + kubelet: '@testing=1.25.0-r4' + kubeadm: '@testing=1.25.0-r4' + kubectl: '@testing=1.25.0-r4' + +services: + devfs: sysinit + dmesg: sysinit + mdev: sysinit + hwdrivers: sysinit + + hwclock: boot + modules: boot + sysctl: boot + hostname: boot + bootmisc: boot + syslog: boot + networking: boot + + mount-ro: shutdown + killprocs: shutdown + savecache: shutdown + + sshd: default + + # K8s requirements + docker: default + iscsid: default + kubelet: default + ntpd: default + +nameservers: + - 185.12.64.1 + - 185.12.64.2 + - 2a01:4ff:ff00::add:1 + - 2a01:4ff:ff00::add:2 + +sysctl: {} + +extlinux_modules: + - ext4 + +kernel_features: + - base + - ext4 + - keymap + - virtio + +kernel_modules: + - ipv6 + - af_packet + +default_kernel_opts: + - quiet + +chroot_commands: + # kernel stuff + - 'echo "br_netfilter" >/etc/modules-load.d/k8s.conf' + - 'echo "net.bridge.bridge-nf-call-iptables=1" >>/etc/sysctl.conf' + + # Fix prometheus errors + - 'echo -e "#!/bin/sh\nmount --make-rshared /" >/etc/local.d/sharemetrics.start' + - 'chmod +x /etc/local.d/sharemetrics.start' + - 'rc-update add local' + +...