From d994435f2fde4fdbec1ee7979feb3df096239672 Mon Sep 17 00:00:00 2001 From: Michael Fornaro <20387402+xUnholy@users.noreply.github.com> Date: Sun, 6 Dec 2020 21:08:02 +1100 Subject: [PATCH] add auto-releaser, rename openebs role to storage Signed-off-by: Michael Fornaro <20387402+xUnholy@users.noreply.github.com> --- .github/release-drafter.yml | 34 ++++++ .github/workflows/release-drafter.yml | 19 ++++ .github/workflows/terraform-apply.yml | 2 +- .github/workflows/terraform-plan.yml | 2 +- ansible/example/group_vars/all.yml | 2 +- ansible/example/group_vars/masters.yml | 4 +- ansible/family_vars/archlinux.yml | 2 +- ansible/family_vars/debian.yml | 2 +- ansible/group_vars/all.yml | 44 ++++---- ansible/group_vars/masters.yml | 52 +++++---- ansible/playbooks/cluster.yml | 2 +- .../{openebs => storage}/defaults/main.yml | 0 .../{openebs => storage}/handlers/main.yml | 0 .../{openebs => storage}/tasks/archlinux.yml | 0 .../{openebs => storage}/tasks/debian.yml | 0 .../roles/{openebs => storage}/tasks/main.yml | 0 .../{openebs => storage}/tasks/pre_checks.yml | 0 .../roles/{openebs => storage}/vars/main.yml | 0 raspbian/Makefile | 85 --------------- raspbian/README.md | 101 ------------------ raspbian/install/bootstrap.sh | 35 ------ raspbian/install/scripts/boot.sh | 8 -- raspbian/install/scripts/docker.sh | 22 ---- raspbian/install/scripts/hostname.sh | 26 ----- raspbian/install/scripts/init.sh | 34 ------ raspbian/install/scripts/iptables.sh | 17 --- raspbian/install/scripts/kubernetes.sh | 28 ----- raspbian/install/scripts/utils.sh | 6 -- 28 files changed, 117 insertions(+), 410 deletions(-) create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/release-drafter.yml rename ansible/roles/{openebs => storage}/defaults/main.yml (100%) rename ansible/roles/{openebs => storage}/handlers/main.yml (100%) rename ansible/roles/{openebs => storage}/tasks/archlinux.yml (100%) rename ansible/roles/{openebs => storage}/tasks/debian.yml (100%) rename ansible/roles/{openebs => storage}/tasks/main.yml (100%) rename ansible/roles/{openebs => storage}/tasks/pre_checks.yml (100%) rename ansible/roles/{openebs => storage}/vars/main.yml (100%) delete mode 100644 raspbian/Makefile delete mode 100644 raspbian/README.md delete mode 100755 raspbian/install/bootstrap.sh delete mode 100755 raspbian/install/scripts/boot.sh delete mode 100755 raspbian/install/scripts/docker.sh delete mode 100755 raspbian/install/scripts/hostname.sh delete mode 100755 raspbian/install/scripts/init.sh delete mode 100755 raspbian/install/scripts/iptables.sh delete mode 100755 raspbian/install/scripts/kubernetes.sh delete mode 100755 raspbian/install/scripts/utils.sh diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000..1dc24cb6 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,34 @@ + +name-template: 'v$RESOLVED_VERSION' +tag-template: 'v$RESOLVED_VERSION' +categories: + - title: 'Community' + label: + - 'community' + - title: 'Features' + labels: + - 'feature_request' + - 'enhancement' + - title: 'Bug Fixes' + labels: + - 'bug' + - title: 'Maintenance' + label: + - 'chore' + - 'documentation' +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. +version-resolver: + major: + labels: + - 'major' + minor: + labels: + - 'minor' + patch: + labels: + - 'patch' + default: patch +template: | + ## Changes + $CHANGES diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 00000000..04b78533 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,19 @@ +name: Release Drafter + +on: + push: + # branches to consider in the event; optional, defaults to all + branches: + - master + +jobs: + update_release_draft: + runs-on: ubuntu-latest + steps: + # Drafts your next Release notes as Pull Requests are merged into "main" + - uses: release-drafter/release-drafter@v5 + with: + # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml + config-name: release-drafter.yml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/terraform-apply.yml b/.github/workflows/terraform-apply.yml index afd9b3a6..a3be0002 100644 --- a/.github/workflows/terraform-apply.yml +++ b/.github/workflows/terraform-apply.yml @@ -1,4 +1,4 @@ -name: terraform +name: terraform-apply on: workflow_dispatch: diff --git a/.github/workflows/terraform-plan.yml b/.github/workflows/terraform-plan.yml index eb92456e..128cf162 100644 --- a/.github/workflows/terraform-plan.yml +++ b/.github/workflows/terraform-plan.yml @@ -1,4 +1,4 @@ -name: terraform +name: terraform-plan on: pull_request: diff --git a/ansible/example/group_vars/all.yml b/ansible/example/group_vars/all.yml index 7dd89223..d28526a9 100644 --- a/ansible/example/group_vars/all.yml +++ b/ansible/example/group_vars/all.yml @@ -1,5 +1,5 @@ --- -# Role: common +# Role - common common_timezone: Europe/Amsterdam common_rpi_overclock: true common_rpi_poe_hat: true diff --git a/ansible/example/group_vars/masters.yml b/ansible/example/group_vars/masters.yml index 9cff7c49..db08431f 100644 --- a/ansible/example/group_vars/masters.yml +++ b/ansible/example/group_vars/masters.yml @@ -1,8 +1,8 @@ --- -# Role: keepalived +# Role - keepalived keepalived_vip: '192.168.100.50' -# Role: cluster +# Role - cluster cluster_extra_sans: - "{{ keepalived_vip }}" - api.kubernetes.lan diff --git a/ansible/family_vars/archlinux.yml b/ansible/family_vars/archlinux.yml index 3ca3c44d..09445a2e 100644 --- a/ansible/family_vars/archlinux.yml +++ b/ansible/family_vars/archlinux.yml @@ -1,5 +1,5 @@ --- -# Role: common +# Role - common common_packages: - rxvt-unicode-terminfo - fakeroot diff --git a/ansible/family_vars/debian.yml b/ansible/family_vars/debian.yml index 61b1841e..6fa2df71 100644 --- a/ansible/family_vars/debian.yml +++ b/ansible/family_vars/debian.yml @@ -1,5 +1,5 @@ --- -# Role: common +# Role - common common_packages: - apt-transport-https - software-properties-common diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 4dd8e24e..6ab4cfdb 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -1,22 +1,30 @@ --- -# Role: common -#common_upgrade_packages: true -#common_reboot_handler_enabled: true -#common_timezone: UTC -#common_usb_ssd_enabled: false -#common_usb_ssd_device_id: "" -#common_rpi_overclock: false -#common_rpi_poe_hat: false -#common_log2ram_version: v1.4 -#common_log2ram_size: 128M +#### +# Role - common +#### +# common_upgrade_packages: true +# common_reboot_handler_enabled: true +# common_timezone: UTC +# common_usb_ssd_enabled: false +# common_usb_ssd_device_id: "" +# common_rpi_overclock: false +# common_rpi_poe_hat: false +# common_log2ram_version: v1.4 +# common_log2ram_size: 128M -# Role: kubernetes -#kubernetes_kubectl_version: 1.19.0-00 -#kubernetes_kubelet_version: 1.19.0-00 -#kubernetes_kubeadm_version: 1.19.0-00 +#### +# Role - kubernetes +#### +# kubernetes_kubectl_version: 1.19.4-00 +# kubernetes_kubelet_version: 1.19.4-00 +# kubernetes_kubeadm_version: 1.19.4-00 -# Role: cri -#cri_plugin: docker +#### +# Role - cri +#### +# cri_plugin: docker -# Role: openebs -#openebs_enabled: true +#### +# Role - storage +#### +# openebs_enabled: true diff --git a/ansible/group_vars/masters.yml b/ansible/group_vars/masters.yml index f0c3185f..e88fde4f 100644 --- a/ansible/group_vars/masters.yml +++ b/ansible/group_vars/masters.yml @@ -1,28 +1,36 @@ --- -# Role: keepalived -#keepalived_vip: '' -#keepalived_interface: "{{ ansible_default_ipv4['interface'] }}" +#### +# Role - keepalived +#### +# keepalived_vip: '' +# keepalived_interface: "{{ ansible_default_ipv4['interface'] }}" -# Role: cluster -#cluster_name: kubernetes -#cluster_extra_sans: +#### +# Role - cluster +#### +# cluster_name: kubernetes +# cluster_extra_sans: # - "{{ keepalived_vip }}" -#cluster_control_plane_endpoint: "{{ keepalived_vip }}:8443" -#cluster_enable_admission_plugins: "NodeRestriction,AlwaysPullImages" -#cluster_authorization_mode: "Node,RBAC" -#cluster_audit_log_path: "/var/log/kubernetes/audit.log" -#cluster_audit_log_maxage: 30 -#cluster_audit_log_maxbackup: 10 -#cluster_audit_log_maxsize: 100 -#cluster_pod_subnet: "" -#cluster_etcd_heartbeat_interval: "100" -#cluster_etcd_election_timeout: "1000" +# cluster_control_plane_endpoint: "{{ keepalived_vip }}:8443" +# cluster_enable_admission_plugins: "NodeRestriction,AlwaysPullImages" +# cluster_authorization_mode: "Node,RBAC" +# cluster_audit_log_path: "/var/log/kubernetes/audit.log" +# cluster_audit_log_maxage: 30 +# cluster_audit_log_maxbackup: 10 +# cluster_audit_log_maxsize: 100 +# cluster_pod_subnet: "" +# cluster_etcd_heartbeat_interval: "100" +# cluster_etcd_election_timeout: "1000" -# Role: cni -#cni_plugin: calico +#### +# Role - cni +#### +# cni_plugin: calico -# Role: cloudflared +#### +# Role - cloudflared +#### # Cloudflare options for exposing Kubernetes services via HTTPS/SSH -#cloudflared_enabled: false -#cloudflared_kube_api_server_dns: '' -#cloudflared_version: 2020.8.0 +# cloudflared_enabled: false +# cloudflared_kube_api_server_dns: '' +# cloudflared_version: 2020.8.0 diff --git a/ansible/playbooks/cluster.yml b/ansible/playbooks/cluster.yml index ca4253b0..47597133 100644 --- a/ansible/playbooks/cluster.yml +++ b/ansible/playbooks/cluster.yml @@ -9,4 +9,4 @@ roles: - cluster - cni - - openebs + - storage diff --git a/ansible/roles/openebs/defaults/main.yml b/ansible/roles/storage/defaults/main.yml similarity index 100% rename from ansible/roles/openebs/defaults/main.yml rename to ansible/roles/storage/defaults/main.yml diff --git a/ansible/roles/openebs/handlers/main.yml b/ansible/roles/storage/handlers/main.yml similarity index 100% rename from ansible/roles/openebs/handlers/main.yml rename to ansible/roles/storage/handlers/main.yml diff --git a/ansible/roles/openebs/tasks/archlinux.yml b/ansible/roles/storage/tasks/archlinux.yml similarity index 100% rename from ansible/roles/openebs/tasks/archlinux.yml rename to ansible/roles/storage/tasks/archlinux.yml diff --git a/ansible/roles/openebs/tasks/debian.yml b/ansible/roles/storage/tasks/debian.yml similarity index 100% rename from ansible/roles/openebs/tasks/debian.yml rename to ansible/roles/storage/tasks/debian.yml diff --git a/ansible/roles/openebs/tasks/main.yml b/ansible/roles/storage/tasks/main.yml similarity index 100% rename from ansible/roles/openebs/tasks/main.yml rename to ansible/roles/storage/tasks/main.yml diff --git a/ansible/roles/openebs/tasks/pre_checks.yml b/ansible/roles/storage/tasks/pre_checks.yml similarity index 100% rename from ansible/roles/openebs/tasks/pre_checks.yml rename to ansible/roles/storage/tasks/pre_checks.yml diff --git a/ansible/roles/openebs/vars/main.yml b/ansible/roles/storage/vars/main.yml similarity index 100% rename from ansible/roles/openebs/vars/main.yml rename to ansible/roles/storage/vars/main.yml diff --git a/raspbian/Makefile b/raspbian/Makefile deleted file mode 100644 index c67bebdd..00000000 --- a/raspbian/Makefile +++ /dev/null @@ -1,85 +0,0 @@ -SHELL := /bin/bash -o pipefail -.SILENT: - -# Local Configuration -TMP_OUTPUT = output -RPI_HOME = $(TMP_OUTPUT)/home/pi - -# Raspberry PI host and IP configuration -RPI_NETWORK_TYPE ?= eth0 -RPI_ORIG_HOSTNAME ?= raspberrypi -RPI_HOSTNAME ?= -RPI_IP ?= -RPI_DNS ?= 192.168.1.1 -RPI_TIMEZONE ?= Australia/Melbourne - -# Default Raspberry Pi password -RPI_SSH_SECRET ?= raspberry - -# Kubernetes configuration -KUBE_NODE_TYPE ?= - -SCP = scp -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -o "LogLevel=ERROR" -SSH = ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" -o "LogLevel=ERROR" - -.PHONY: deploy -deploy: clean prepare ssh configure env scp install - echo "Network:" - echo "- Hostname: $(RPI_HOSTNAME)" - echo "- Static IP: $(RPI_IP)" - echo "- Gateway address: $(RPI_DNS)" - echo "- Network adapter: $(RPI_NETWORK_TYPE)" - echo "- Timezone: $(RPI_TIMEZONE)" - echo "Kubernetes:" - echo "- Node Type: $(KUBE_NODE_TYPE)" - echo "- Control Plane Endpoint: $(RPI_IP)" - -.PHONY: post-install -post-install: -ifeq ($(KUBE_NODE_TYPE),master) - mkdir -p $(TMP_OUTPUT)/$(KUBE_NODE_TYPE)/.kube - sshpass -p $(RPI_SSH_SECRET) $(SCP) -p -r pi@$(RPI_HOSTNAME).local:/home/pi/.kube/config $(TMP_OUTPUT)/$(KUBE_NODE_TYPE)/.kube/config - sshpass -p $(RPI_SSH_SECRET) $(SCP) -p -r pi@$(RPI_HOSTNAME).local:/home/pi/connect.sh $(TMP_OUTPUT)/$(KUBE_NODE_TYPE) - echo "Examples:" - echo " kubectl get nodes --kubeconfig $(TMP_OUTPUT)/$(KUBE_NODE_TYPE)/.kube/config" -endif - -.PHONY: install -install: - sshpass -p "$(RPI_SSH_SECRET)" $(SSH) pi@$(RPI_ORIG_HOSTNAME).local 'sudo bash ./bootstrap.sh' || exit 0 - -.PHONY: scp -scp: - sshpass -p $(RPI_SSH_SECRET) $(SCP) -p -r $(RPI_HOME) pi@$(RPI_ORIG_HOSTNAME).local:/home/ -ifeq ($(KUBE_NODE_TYPE),worker) - sshpass -p $(RPI_SSH_SECRET) $(SCP) -p -r $(TMP_OUTPUT)/master/.kube pi@$(RPI_ORIG_HOSTNAME).local:/home/pi - sshpass -p $(RPI_SSH_SECRET) $(SCP) -p -r $(TMP_OUTPUT)/master/connect.sh pi@$(RPI_ORIG_HOSTNAME).local:/home/pi -endif - -.PHONY: env -env: - echo "export RPI_HOSTNAME=$(RPI_HOSTNAME)" >> $(RPI_HOME)/scripts/env - echo "export RPI_IP=$(RPI_IP)" >> $(RPI_HOME)/scripts/env - echo "export RPI_DNS=$(RPI_DNS)" >> $(RPI_HOME)/scripts/env - echo "export RPI_NETWORK_TYPE=$(RPI_NETWORK_TYPE)" >> $(RPI_HOME)/scripts/env - echo "export RPI_TIMEZONE=$(RPI_TIMEZONE)" >> $(RPI_HOME)/scripts/env - echo "export KUBE_NODE_TYPE=$(KUBE_NODE_TYPE)" >> $(RPI_HOME)/scripts/env - echo "export RPI_HOME=/home/pi" >> $(RPI_HOME)/scripts/env - -.PHONY: configure -configure: - cp -r ./install/* $(RPI_HOME)/ - mv ./$(RPI_HOME)/.ssh/id_ed25519.pub $(RPI_HOME)/.ssh/authorized_keys - -.PHONY: ssh -ssh: - ssh-keygen -t ed25519 -b 4096 -C "pi@$(RPI_HOSTNAME)" -f ./$(RPI_HOME)/.ssh/id_ed25519 -q -N "" - -.PHONY: prepare -prepare: - mkdir -p $(RPI_HOME)/.ssh - -.PHONY: clean -clean: - sudo rm -rf ./$(RPI_HOME)/ - diff --git a/raspbian/README.md b/raspbian/README.md deleted file mode 100644 index 2514754e..00000000 --- a/raspbian/README.md +++ /dev/null @@ -1,101 +0,0 @@ -# Raspbernetes - -A guide to setup Kubernetes running on a Raspberry Pi cluster using Raspbian Lite. - -> This guide has been deprecated in favor of using Ansible for the automation, and running an Ubuntu OS. - -## Contents - -* [Prerequisites](#Prerequisites) -* [Getting Started](#Getting-Started) - * [Master Node(s)](#Master-Node(s)) - * [Worker Node(s)](#Worker-Node(s)) -* [Contributing](#Contributing) -* [Authors](#Authors) -* [License](#License) -* [Acknowledgments](#Acknowledgments) - -## Prerequisites - -Prior to getting started you must have completed the following setup instructions: - -The SD card must be flashed with Raspbian Lite. If this has not been completed the official guide can be found [HERE](https://www.raspberrypi.org/documentation/installation/installing-images/README.md). - -Note: To setup SSH to your Raspberry Pi, you simply need a empty `ssh` file in the boot directory. - -You must also have the following dependencies installed on your machine: - -* make -* sshpass - -An internet connection is also required for configuring the Raspberry Pi's. - -## Getting Started - -When configuring a Raspberry Pi there are two options for configuring it as a node in your Kubernetes cluster, it can either be a `master` or `worker`. - -At this point the Raspberry Pi should be running and on the same network as your machine so it can be accessed over ssh. - -### Master Node(s) - -The master node configuration is copied from your machine to the Raspberry Pi with the following command: - -```bash -RPI_HOSTNAME=k8s-master-01 KUBE_NODE_TYPE=master RPI_IP=192.168.1.101 make deploy -``` - -Once the deployment has completed you should be now able to manually `ssh` to the newly configured master node using the folling command: - -```bash -ssh pi@k8s-master-01.local -``` - -Kubernetes should be running and you can view the syslogs with the following command: - -```bash -tail -f /var/log/syslog -``` - -Additionally you can verify your nodes status is `READY` with the following command: - -```bash -kubectl get nodes -``` - -Now that the master node is running successfully you can either add more master nodes to the cluster or create worker nodes within the cluster. To be able to connect additional nodes into the cluster we will need to extract the kube config and the join token output by the master node. This can be done with the following command: - -```bash -RPI_HOSTNAME=k8s-master-01 KUBE_NODE_TYPE=master RPI_IP=192.168.1.101 make post-install -``` - -The kube config and join token should now be in the ./output directory and will be used in configuring additional nodes. - -Note: Running the above commands will use a set of default variables, these are configured for setting up a master node and must be overriden for subsequent master or worker nodes. Also if the nodes status is `NOTREADY` then you should go back to checking the syslogs and check for any errors that may have occurs whilst setting up the node. - -### Worker Node(s) - -Work In Progress... - -```bash -RPI_HOSTNAME=k8s-worker-01 KUBE_NODE_TYPE=worker RPI_IP=192.168.1.111 make deploy -``` - -## Contributing - -Please read [CONTRIBUTING.md](CONTRIBUTION.md) for details on our code of conduct, and the process for submitting pull requests to us. - -## Authors - -* **Michael Fornaro** - *Initial work* - [LinkedIn](https://www.linkedin.com/in/michael-fornaro-5b756179/) - -See also the list of [contributors](https://github.com/xUnholy/raspbernetes/contributors) who participated in this project. - -## License - -This project is licensed under the Apache License - see the [LICENSE](LICENSE) file for details - -## Acknowledgments - -Wish to acknowledge the following people: - -**Lucas Teligioridis** - [Github](https://github.com/lucasteligioridis) - Initial creator of the Raspbernetes setup with a fantastic setup guide for Linux based systems which can be found [HERE](https://itnext.io/headless-kubernetes-on-15-raspberry-pis-boot-in-under-8-minutes-808402ea2348?) diff --git a/raspbian/install/bootstrap.sh b/raspbian/install/bootstrap.sh deleted file mode 100755 index f25651b9..00000000 --- a/raspbian/install/bootstrap.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -set -euo pipefail - -# change to directory where bootstrap lives -cd "${0%/*}" - -# source the environment variables for hostname, IP addresses and node type -# shellcheck disable=SC1091 -source ./scripts/env - -FILE="$RPI_HOME/reboot" -if [ ! -f "$FILE" ]; then - # configure hostname and set timezone - ./scripts/boot.sh - ./scripts/hostname.sh - - # install system dependencies in order - ./scripts/utils.sh - ./scripts/docker.sh - ./scripts/kubernetes.sh - ./scripts/iptables.sh - - touch "$FILE" - - echo "Reboot in progress..." - reboot -fi - -# configure kubernetes with node type and/or initialising cluster -./scripts/init.sh - -# ensure bootstrap scripts don't run again on boot and clean -sed -i "/bootstrap.sh/d" /etc/rc.local - -echo "Finished booting! Kubernetes successfully running!" diff --git a/raspbian/install/scripts/boot.sh b/raspbian/install/scripts/boot.sh deleted file mode 100755 index 0fef9589..00000000 --- a/raspbian/install/scripts/boot.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -set -euo pipefail - -# Update firmware for Pi - Needed for CNI (weave) to work correctly -SKIP_WARNING=1 rpi-update - -# Make execution on reboot & check syslogs using "tail -f /var/log/syslog" -sed -i 's/^exit 0/\/home\/pi\/bootstrap.sh 2>\&1 | logger -t kubernetes-bootstrap \&/g' /etc/rc.local \ No newline at end of file diff --git a/raspbian/install/scripts/docker.sh b/raspbian/install/scripts/docker.sh deleted file mode 100755 index bc428b28..00000000 --- a/raspbian/install/scripts/docker.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -set -euo pipefail - -curl -sSL get.docker.com | sh && \ - usermod pi -aG docker - -dphys-swapfile swapoff && \ - dphys-swapfile uninstall && \ - update-rc.d dphys-swapfile remove && \ - systemctl disable dphys-swapfile.service - -# setup daemon to user systemd as per kubernetes best practices -cat << EOF >> /etc/docker/daemon.json -{ - "exec-opts": ["native.cgroupdriver=systemd"], - "log-driver": "json-file", - "log-opts": { - "max-size": "100m" - }, - "storage-driver": "overlay2" -} -EOF \ No newline at end of file diff --git a/raspbian/install/scripts/hostname.sh b/raspbian/install/scripts/hostname.sh deleted file mode 100755 index 834c8515..00000000 --- a/raspbian/install/scripts/hostname.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -set -euo pipefail - -echo "Setting hostname to: ${RPI_HOSTNAME}" -hostnamectl --transient set-hostname "${RPI_HOSTNAME}" -hostnamectl --static set-hostname "${RPI_HOSTNAME}" -hostnamectl --pretty set-hostname "${RPI_HOSTNAME}" -sed -i s/raspberrypi/"${RPI_HOSTNAME}"/g /etc/hosts - -# For more configuration options read the following link: -# https://wiki.archlinux.org/index.php/dhcpcd#Configuration -cat << EOF >> /etc/dhcpcd.conf -interface $RPI_NETWORK_TYPE -static ip_address=$RPI_IP/24 -static routers=$RPI_DNS -static domain_name_servers=$RPI_DNS -EOF - -echo "Setting timezone to: ${RPI_TIMEZONE}" -hostnamectl set-location "${RPI_TIMEZONE}" -timedatectl set-timezone "${RPI_TIMEZONE}" - -FILE=/etc/motd -if [ -f "$FILE" ]; then - rm -f "$FILE" -fi diff --git a/raspbian/install/scripts/init.sh b/raspbian/install/scripts/init.sh deleted file mode 100755 index 314f2fac..00000000 --- a/raspbian/install/scripts/init.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -set -euo pipefail - -init_master() { - echo "Initializing Kubernetes Master Node" - kubeadm init --token-ttl=0 | tee >(tail -n 2 > "$RPI_HOME/connect.sh") - chmod +x "$RPI_HOME/connect.sh" - kube_config - init_cni -} - -kube_config() { - echo "Setup kube config" - mkdir -p "/root/.kube" - mkdir -p "$RPI_HOME/.kube" - cp -f /etc/kubernetes/admin.conf "/root/.kube/config" - cp -i /etc/kubernetes/admin.conf "$RPI_HOME/.kube/config" - chown "$(id -u):$(id -g)" "/root/.kube/config" - chown "$(id -u pi):$(id -g pi)" "$RPI_HOME/.kube/config" -} - -init_cni() { - echo "Initializing CNI: Weave" - kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')" -} - -# Initialize node based on type -if [ "${KUBE_NODE_TYPE}" == "master" ]; then - echo "Detected as master node type, need to either join existing cluster or initialise new one" - init_master -elif [ "${KUBE_NODE_TYPE}" == "worker" ]; then - echo "Detected as worker node type, need to join existing cluster!" - "$RPI_HOME/connect.sh" -fi diff --git a/raspbian/install/scripts/iptables.sh b/raspbian/install/scripts/iptables.sh deleted file mode 100755 index eb670b07..00000000 --- a/raspbian/install/scripts/iptables.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -set -euo pipefail - -apt-get update && apt-get install -y ebtables arptables -update-alternatives --set iptables /usr/sbin/iptables-legacy -update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy -update-alternatives --set ebtables /usr/sbin/ebtables-legacy -update-alternatives --set arptables /usr/sbin/arptables-legacy - -# Set /proc/sys/net/bridge/bridge-nf-call-iptables to 1 by running -# sysctl net.bridge.bridge-nf-call-iptables=1 to pass bridged IPv4 traffic to iptables’ chains. -# This is a requirement for some CNI plugins to work. -sysctl net.bridge.bridge-nf-call-iptables=1 - -# Additional configuration -sysctl net.bridge.bridge-nf-call-ip6tables=1 -sysctl net.bridge.bridge-nf-call-arptables=1 \ No newline at end of file diff --git a/raspbian/install/scripts/kubernetes.sh b/raspbian/install/scripts/kubernetes.sh deleted file mode 100755 index 817d51a8..00000000 --- a/raspbian/install/scripts/kubernetes.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -set -euo pipefail - -curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - - -cat <