@@ -68,23 +68,38 @@ start_k3s() {
68
68
mkdir -p ~ /.kube/
69
69
70
70
cp ./kubeconfig.yaml ~ /.kube/config || echo " Failed to get kubeconfig"
71
+ sed -i ' s/127.0.0.1/localhost/g' ~ /.kube/config
72
+ export KUBECONFIG=~ /.kube/config
73
+ cat ~ /.kube/config
74
+
75
+ if [ -f ./kubeconfig.yaml ]; then
76
+ cp ./kubeconfig.yaml ~ /.kube/config
77
+ else
78
+ echo " Failed to get kubeconfig: kubeconfig.yaml not found"
79
+ exit 1
80
+ fi
71
81
72
82
echo " Checking nodes..."
73
83
until kubectl wait --for=condition=Ready nodes --all --timeout=600s; do
74
84
echo " Waiting for nodes to be ready..."
75
85
sleep 5
76
86
done
77
87
78
- # Generating a join token and storing it in a secret
79
- docker exec -it ctrlplane-laptop k3s token create --print-join-command > token.txt
88
+ echo " Generating join token and storing it in a secret..."
89
+ # docker exec -i ctrlplane-laptop k3s token create --print-join-command > token.txt (incompatible)
90
+ docker exec -i ctrlplane-laptop cat /var/lib/rancher/k3s/server/node-token > token.txt
80
91
kubectl create secret -n kube-system generic k3s-join-token --from-file=token.txt
81
92
}
82
93
83
94
kubectl_for_vagrant_user () {
84
- runuser -l vagrant -c " mkdir -p ~/.kube/"
85
- runuser -l vagrant -c " k3d kubeconfig get -a > ~/.kube/config"
95
+ echo " **********************************"
96
+ runuser -l vagrant -c " mkdir -p /home/vagrant/.kube"
97
+ cp ./kubeconfig.yaml /home/vagrant/.kube/config
98
+ chown vagrant:vagrant /home/vagrant/.kube/config
99
+
86
100
chmod 600 /home/vagrant/.kube/config
87
- echo ' export KUBECONFIG="/home/vagrant/.kube/config"' >> /home/vagrant/.bashrc
101
+ echo ' export KUBECONFIG="/home/vagrant/.kube/config"' >> /home/vagrant/.bashrc
102
+ echo " **********************************"
88
103
}
89
104
90
105
helm_install_tink_stack () {
0 commit comments