Skip to content

Commit

Permalink
Updated node join script
Browse files Browse the repository at this point in the history
  • Loading branch information
mmontes11 committed Aug 31, 2024
1 parent 41c8459 commit 7fd1410
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 29 deletions.
12 changes: 2 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ Setup the control-plane by running:
sudo bash control-plane.sh
```

Copy the generated configuration `config/kubeadm-join.yaml` to each worker node and run this command to join the cluster:
Copy the generated configuration files `config/kubeadm-join.<node-type>.yaml` to each node and run this command to join the cluster:
```bash
sudo bash worker.sh
sudo bash node.sh 'config/kubeadm-join.<node-type>.yaml'
```

Run this on the control-plane for bootstrapping the [infrastructure](https://github.com/mmontes11/k8s-infrastructure):
Expand All @@ -43,14 +43,6 @@ export GITHUB_TOKEN=<your-personal-access-token>
./bootstrap.sh
```

### Label nodes

In order to label nodes, run the following script in the control-plane:

```bash
./label-nodes.sh
```

### Kubeconfig

`admin` and `super-admin` kubeconfigs are available in the following control-plane paths:
Expand Down
13 changes: 0 additions & 13 deletions label-nodes.sh

This file was deleted.

15 changes: 9 additions & 6 deletions worker.sh → node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,29 @@ set -euo pipefail

source ./scripts/lib.sh

JOIN_CONFIG_FILE=config/kubeadm-join.yaml
if [ $# -lt 1 ]; then
echo "Usage: $0 <join-config-file>"
exit 1
fi

JOIN_CONFIG_FILE="$1"
if [ ! -f $JOIN_CONFIG_FILE ]; then
echo "Join configuration file '$JOIN_CONFIG_FILE' not found"
exit 1
fi

install_scripts=(
INSTALL_SCRIPTS=(
"scripts/apt.sh"
"scripts/swap.sh"
"scripts/network.sh"
"scripts/storage.sh"
"scripts/containerd.sh"
"scripts/kubernetes.sh"
)

for i in "${!install_scripts[@]}"; do
source "${install_scripts[$i]}"
for INSTALL in "${INSTALL_SCRIPTS[@]}"; do
source "$INSTALL"
done

kubeadm join --config $JOIN_CONFIG_FILE

echo "worker installation completed successfully! 🚜"
echo "node installation completed successfully! 🚜"

0 comments on commit 7fd1410

Please sign in to comment.