From f6a747affb97fce45a06158f36e1fe09d3dd0421 Mon Sep 17 00:00:00 2001 From: Stensel8 <102481635+Stensel8@users.noreply.github.com> Date: Thu, 17 Sep 2026 09:10:14 +0200 Subject: [PATCH 1/2] fix: harden K3s and kubeadm installers and sync with DevOps-Security K3s: - give the sudo user's group read access to the kubeconfig (0640), so kubectl works without sudo on the control plane - worker: check /ping on the API before installing, and wait for the kubelet client cert instead of reporting success right away - explain that kubectl does not work on a worker node k8s_installer.sh is now a kubeadm cluster installer at the same level as the K3s one (control plane / worker, --url/--token/--ca-cert-hash, reachability check, pinned kubeadm/kubelet/kubectl and Flannel, node Ready wait, kubectl for the sudo user). It replaces the kubectl + minikube client installer. Both scripts are byte-identical to kubernetes/install-k3s.sh and kubernetes/install-k8s.sh in Stensel8/DevOps-Security. Renovate now tracks Flannel instead of minikube. --- CONTRIBUTING.md | 2 +- kubernetes/k3s_installer.sh | 79 +++++-- kubernetes/k8s_installer.sh | 409 ++++++++++++++++++++++++++---------- renovate.json | 6 +- 4 files changed, 369 insertions(+), 127 deletions(-) mode change 100644 => 100755 kubernetes/k8s_installer.sh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f5c702d..d6ac1a4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,7 +10,7 @@ This repository uses Renovate plus a few GitHub Actions workflows to keep depend Automatically monitors and creates PRs for: - GitHub Actions updates - The `TLS-tools/testssl.sh` git submodule -- Hardcoded versions in installer scripts (NGINX and its modules, Ansible, kubectl, minikube, Vagrant) via custom regex managers +- Hardcoded versions in installer scripts (NGINX and its modules, Ansible, Kubernetes, Flannel, K3s, Vagrant) via custom regex managers **Important:** the custom regex managers match exact variable formats such as `NGINX_VERSION="1.31.1"` (bash) and `$Script:NGINX_VERSION = '1.31.1'` diff --git a/kubernetes/k3s_installer.sh b/kubernetes/k3s_installer.sh index 3cf25b0..852459b 100755 --- a/kubernetes/k3s_installer.sh +++ b/kubernetes/k3s_installer.sh @@ -7,6 +7,13 @@ # so it works on any systemd-based Linux without a distro package manager. # Kubernetes role names are used (control plane / worker); K3s' own # "server / agent" wording is mapped internally. +# +# Control plane: sudo ./