Minor fixes (#339)

* script

* deploy csr script

* source csr script
pull/634/head
Alistair Mackay 2024-03-19 07:27:14 +00:00 committed by GitHub
parent 7f5a15ed8a
commit f7fef4dfdd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 7 additions and 2 deletions

View File

@ -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}"

View File

@ -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

2
tools/approve-csr.sh Normal file
View File

@ -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')

1
vagrant/Vagrantfile vendored
View File

@ -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