From a770d9661d105f87e2f43aae15143dda65a096c1 Mon Sep 17 00:00:00 2001 From: Devin Buhl Date: Tue, 28 Sep 2021 07:41:27 -0400 Subject: [PATCH] fix: Update README and change SSH_PASSWORD to SUDO_PASSWORD Signed-off-by: Devin Buhl --- .config.sample.env | 11 +++++++--- README.md | 29 ++++++++++++++++++++------- configure.sh | 4 ++-- provision/ansible/inventory/hosts.yml | 11 ---------- 4 files changed, 32 insertions(+), 23 deletions(-) delete mode 100644 provision/ansible/inventory/hosts.yml diff --git a/.config.sample.env b/.config.sample.env index 96b962ee..ac1a5b43 100644 --- a/.config.sample.env +++ b/.config.sample.env @@ -40,7 +40,7 @@ export BOOTSTRAP_ANSIBLE_KUBE_VIP_ADDRESS="" # # Ansible hosts - repeat this block as many times as you need, -# incrementing the last digit on the variable for each node +# incrementing the last digit on the variable name for each node # # Host IP Address to the control plane node @@ -48,7 +48,12 @@ export BOOTSTRAP_ANSIBLE_KUBE_VIP_ADDRESS="" export BOOTSTRAP_ANSIBLE_HOST_ADDR_0="" # User Ansible will log into the nodes export BOOTSTRAP_ANSIBLE_SSH_USERNAME_0="" -# Password Ansible will log into the nodes -export BOOTSTRAP_ANSIBLE_SSH_PASSWORD_0="" +# Password Ansible will use to esculate to sudo +export BOOTSTRAP_ANSIBLE_SUDO_PASSWORD_0="" # Set this node as a control node (true/false) export BOOTSTRAP_ANSIBLE_CONTROL_NODE_0="" + +# export BOOTSTRAP_ANSIBLE_HOST_ADDR_1="" +# export BOOTSTRAP_ANSIBLE_SSH_USERNAME_1="" +# export BOOTSTRAP_ANSIBLE_SUDO_PASSWORD_1="" +# export BOOTSTRAP_ANSIBLE_CONTROL_NODE_1="" \ No newline at end of file diff --git a/README.md b/README.md index bb6382a8..6cb4d045 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,13 @@ Feel free to read up on any of these technologies before you get started to be m - [traefik](https://traefik.io) - ingress controller - [hajimari](https://github.com/toboshii/hajimari) - start page with ingress discovery - [system-upgrade-controller](https://github.com/rancher/system-upgrade-controller) - upgrade k3s -- [reloader](https://github.com/stakater/Reloader) - restart pod when configmap or secret changes +- [reloader](https://github.com/stakater/Reloader) - restart pods when configmap or secret changes + +For provisioning the following tools will be used: + +- [Ubuntu](https://ubuntu.com/download/server) - this is a pretty universal operating system that supports running all kinds of home related workloads in Kubernetes +- [Ansible](https://www.ansible.com) - this will be used to provision the Ubuntu operating system to be ready for Kubernetes and also to install k3s +- [Terraform](https://www.terraform.io) - in order to help with the DNS settings this will be used to provision a Cloudflare domain and DNS settings ## :memo:  Prerequisites @@ -41,26 +47,35 @@ Feel free to read up on any of these technologies before you get started to be m :round_pushpin: You should install the below CLI tools on your workstation. Make sure you pull in the latest versions. +#### Required + | Tool | Purpose | |--------------------------------------------------------------------|---------------------------------------------------------------------| | [ansible](https://www.ansible.com) | Preparing Ubuntu for Kubernetes and installing k3s | | [direnv](https://github.com/direnv/direnv) | Exports env vars based on present working directory | | [flux](https://toolkit.fluxcd.io/) | Operator that manages your k8s cluster based on your Git repository | -| [GnuPG](https://gnupg.org/) | Encrypts and signs your data | +| [gnupg](https://gnupg.org/) | Encrypts and signs your data | | [go-task](https://github.com/go-task/task) | A task runner / simpler Make alternative written in Go | -| [helm](https://helm.sh/) | Manage Kubernetes applications | +| [ipcalc](http://jodies.de/ipcalc) | Used to verify settings in the configure script | +| [jq](https://stedolan.github.io/jq/) | Used to verify settings in the configure script | | [kubectl](https://kubernetes.io/docs/tasks/tools/) | Allows you to run commands against Kubernetes clusters | -| [kustomize](https://kustomize.io/) | Template-free way to customize application configuration | | [pinentry](https://gnupg.org/related_software/pinentry/index.html) | Allows GnuPG to read passphrases and PIN numbers | +| [sops](https://github.com/mozilla/sops) | Encrypts k8s secrets with GnuPG | +| [terraform](https://www.terraform.io) | Prepare a Cloudflare domain to be used with the cluster | + +#### Optional + +| Tool | Purpose | +|--------------------------------------------------------------------|---------------------------------------------------------------------| +| [helm](https://helm.sh/) | Manage Kubernetes applications | +| [kustomize](https://kustomize.io/) | Template-free way to customize application configuration | | [pre-commit](https://github.com/pre-commit/pre-commit) | Runs checks pre `git commit` | | [prettier](https://github.com/prettier/prettier) | Prettier is an opinionated code formatter. | -| [SOPS](https://github.com/mozilla/sops) | Encrypts k8s secrets with GnuPG | -| [terraform](https://www.terraform.io) | Prepare a Cloudflare domain to be used with the cluster | ### :warning:  pre-commit It is advisable to install [pre-commit](https://pre-commit.com/) and the pre-commit hooks that come with this repository. -[sops-pre-commit](https://github.com/k8s-at-home/sops-pre-commit) will check to make sure you are not by accident commiting your secrets un-encrypted. +[sops-pre-commit](https://github.com/k8s-at-home/sops-pre-commit) will check to make sure you are not by accident committing your secrets un-encrypted. After pre-commit is installed on your machine run: diff --git a/configure.sh b/configure.sh index 254293bf..7c918f07 100755 --- a/configure.sh +++ b/configure.sh @@ -215,7 +215,7 @@ verify_ansible_hosts() { node_id=$(echo "${var}" | awk -F"_" '{print $5}') node_addr="BOOTSTRAP_ANSIBLE_HOST_ADDR_${node_id}" node_username="BOOTSTRAP_ANSIBLE_SSH_USERNAME_${node_id}" - node_password="BOOTSTRAP_ANSIBLE_SSH_PASSWORD_${node_id}" + node_password="BOOTSTRAP_ANSIBLE_SUDO_PASSWORD_${node_id}" node_control="BOOTSTRAP_ANSIBLE_CONTROL_NODE_${node_id}" _has_envar "${node_addr}" @@ -245,7 +245,7 @@ generate_ansible_host_secrets() { node_id=$(echo "${var}" | awk -F"_" '{print $5}') { node_username="BOOTSTRAP_ANSIBLE_SSH_USERNAME_${node_id}" - node_password="BOOTSTRAP_ANSIBLE_SSH_PASSWORD_${node_id}" + node_password="BOOTSTRAP_ANSIBLE_SUDO_PASSWORD_${node_id}" printf "kind: Secret\n" printf "ansible_user: %s\n" "${!node_username}" printf "ansible_become_pass: %s\n" "${!node_password}" diff --git a/provision/ansible/inventory/hosts.yml b/provision/ansible/inventory/hosts.yml deleted file mode 100644 index e4dbb6aa..00000000 --- a/provision/ansible/inventory/hosts.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -kubernetes: - children: - master: - hosts: - k8s-0: - ansible_host: 192.168.42.10 - worker: - hosts: - k8s-1: - ansible_host: 192.168.42.13