Added join step

This commit is contained in:
2026-03-30 17:40:27 +08:00
parent 210fabdcc6
commit 0aa4065c26
7 changed files with 360 additions and 149 deletions

View File

@@ -26,3 +26,36 @@ And use it like this
```bash
./send.sh start_crio
```
Create join token from control plane
```
kubeadm token create --print-join-command
```
Export the token inside the device
```
export DEBUG=1
export HOSTNAME=monok8s-master-1
export BOOTSTRAP_TOKEN=
export TOKEN_CACERT_HASH=
```
Generate using kubectl
```
TOKEN_NAME=bootstrap-token-iwotl0
API_SERVER=$(kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}' | sed 's|https://||') && \
TOKEN=$(kubectl -n kube-system get secret ${TOKEN_NAME} -o jsonpath='{.data.token-id}' | base64 -d).$(kubectl -n kube-system get secret ${TOKEN_NAME} -o jsonpath='{.data.token-secret}' | base64 -d) && \
HASH=$(kubectl -n kube-public get configmap cluster-info -o jsonpath='{.data.kubeconfig}' \
| grep 'certificate-authority-data' \
| awk '{print $2}' \
| base64 -d \
| openssl x509 -pubkey -noout \
| openssl rsa -pubin -outform der 2>/dev/null \
| openssl dgst -sha256 -hex \
| awk '{print "sha256:" $2}')
echo "export API_SERVER_ENDPOINT=${API_SERVER}"
echo "export BOOTSTRAP_TOKEN=${TOKEN}"
echo "export TOKEN_CACERT_HASH=${HASH}"
```