From f7fef4dfdd64024b22afce8c9e5704b9a2df43c2 Mon Sep 17 00:00:00 2001 From: Alistair Mackay <34012094+fireflycons@users.noreply.github.com> Date: Tue, 19 Mar 2024 07:27:14 +0000 Subject: [PATCH] Minor fixes (#339) * script * deploy csr script * source csr script --- apple-silicon/deploy-virtual-machines.sh | 3 +++ docs/11-tls-bootstrapping-kubernetes-workers.md | 3 +-- tools/approve-csr.sh | 2 ++ vagrant/Vagrantfile | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 tools/approve-csr.sh diff --git a/apple-silicon/deploy-virtual-machines.sh b/apple-silicon/deploy-virtual-machines.sh index 93c7406..668604a 100644 --- a/apple-silicon/deploy-virtual-machines.sh +++ b/apple-silicon/deploy-virtual-machines.sh @@ -16,6 +16,7 @@ echo -e "${BLUE}Checking system compatibility${NC}" MEM_GB=$(( $(sysctl hw.memsize | cut -d ' ' -f 2) / 1073741824 )) SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/scripts +TOOLS_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/../tools CPMEM="2048M" WNMEM="2048M" @@ -106,4 +107,6 @@ do multipass exec $node -- /tmp/01-setup-hosts.sh done +multipass transfer $TOOLS_DIR/approve-csr.sh controlplane01:/home/ubuntu/ + echo -e "${GREEN}Done!${NC}" diff --git a/docs/11-tls-bootstrapping-kubernetes-workers.md b/docs/11-tls-bootstrapping-kubernetes-workers.md index 94149d2..2722855 100644 --- a/docs/11-tls-bootstrapping-kubernetes-workers.md +++ b/docs/11-tls-bootstrapping-kubernetes-workers.md @@ -460,10 +460,9 @@ At `node02` node, run the following, selecting option 5 Now, go back to `controlplane01` and approve the pending kubelet-serving certificate [//]: # (host:controlplane01) - [//]: # (command:sudo apt install -y jq) +[//]: # (command:. ./approve-csr.sh) -[//]: # (command:kubectl certificate approve --kubeconfig admin.kubeconfig $(kubectl get csr --kubeconfig admin.kubeconfig -o json | jq -r '.items | .[] | select(.spec.username == "system:node:node02") | .metadata.name')) ```bash kubectl get csr --kubeconfig admin.kubeconfig diff --git a/tools/approve-csr.sh b/tools/approve-csr.sh new file mode 100644 index 0000000..b380339 --- /dev/null +++ b/tools/approve-csr.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +kubectl certificate approve --kubeconfig admin.kubeconfig $(kubectl get csr --kubeconfig admin.kubeconfig -o json | jq -r '.items | .[] | select(.spec.username == "system:node:node02") | .metadata.name') diff --git a/vagrant/Vagrantfile b/vagrant/Vagrantfile index f476b3a..15ebf67 100644 --- a/vagrant/Vagrantfile +++ b/vagrant/Vagrantfile @@ -106,6 +106,7 @@ Vagrant.configure("2") do |config| # Install (opinionated) configs for vim and tmux on controlplane01. These used by the author for CKA exam. node.vm.provision "file", source: "./ubuntu/tmux.conf", destination: "$HOME/.tmux.conf" node.vm.provision "file", source: "./ubuntu/vimrc", destination: "$HOME/.vimrc" + node.vm.provision "file", source: "../tools/approve-csr.sh", destination: "$HOME/approve-csr.sh" end end end