Skip to content

Commit 4e69e55

Browse files
committed
Change of API Server port
Signed-off-by: Lazar Cvetković <l.cvetkovic.997@gmail.com>
1 parent d8a240d commit 4e69e55

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

config/kube.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
"ApiserverDiscoveryToken": "",
1010
"ApiserverCertificateKey": "",
1111
"CPHAEndpoint": "10.0.1.254",
12-
"CPHAPort": "8443"
12+
"CPHAPort": "6443"
1313
}

scripts/setup/create_multinode.sh

+12-6
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ if [ "$#" -lt $CONTROL_PLANE_REPLICAS ]; then
5858
exit 1
5959
fi
6060

61+
if [ "$CONTROL_PLANE_REPLICAS" != 1 ] && [ "$CONTROL_PLANE_REPLICAS" != 3 ] && [ "$CONTROL_PLANE_REPLICAS" != 5 ]; then
62+
echo "Number of control plane replicas can only be 1, 3, or 5."
63+
exit 1
64+
fi
65+
6166
server_exec() {
6267
ssh -oStrictHostKeyChecking=no -p 22 "$1" "$2";
6368
}
@@ -157,7 +162,7 @@ function setup_workers() {
157162
setup_vhive_firecracker_daemon $node
158163
fi
159164

160-
if [ $2 -eq "MASTER" ]; then
165+
if [ "$2" = "MASTER" ]; then
161166
server_exec $node "sudo ${MASTER_LOGIN_TOKEN}"
162167
echo "Backup master node $node has joined the cluster."
163168
else
@@ -170,12 +175,12 @@ function setup_workers() {
170175
echo "Stretching node capacity for $node."
171176
server_exec $node "echo \"maxPods: ${PODS_PER_NODE}\" > >(sudo tee -a /var/lib/kubelet/config.yaml >/dev/null)"
172177
server_exec $node "echo \"containerLogMaxSize: 512Mi\" > >(sudo tee -a /var/lib/kubelet/config.yaml >/dev/null)"
173-
server_exec $node 'sudo systemctl restart kubelet'
178+
server_exec $node 'sudo systemctl daemon-reload && sudo systemctl restart kubelet'
174179
server_exec $node 'sleep 10'
175180

176181
# Rejoin has to be performed although errors will be thrown. Otherwise, restarting the kubelet will cause the node unreachable for some reason
177182

178-
if [ $2 -eq "MASTER" ]; then
183+
if [ "$2" = "MASTER" ]; then
179184
server_exec $node "sudo ${MASTER_LOGIN_TOKEN} > /dev/null 2>&1"
180185
echo "Backup master node $node joined the cluster (again :P)."
181186
else
@@ -187,13 +192,14 @@ function setup_workers() {
187192
NODE_COUNTER=1
188193
for node in "$@"
189194
do
190-
# Set up API Server load balancer arguments
195+
# Set up API Server load balancer arguments - Less than because 1 CP is the "main" master node already
191196
HA_SETTING=""
192-
if [ "$NODE_COUNTER" -le $CONTROL_PLANE_REPLICAS ]; then
197+
if [ "$NODE_COUNTER" -lt $CONTROL_PLANE_REPLICAS ]; then
193198
HA_SETTING="MASTER"
194199
fi
195200

196201
internal_setup "$node" $HA_SETTING &
202+
let NODE_COUNTER++
197203
done
198204

199205
wait
@@ -285,7 +291,7 @@ function copy_k8s_certificates() {
285291
namespace_info=$(server_exec $MASTER_NODE "kubectl get namespaces")
286292
done
287293

288-
echo "Master node $MASTER_NODE finalised."
294+
echo "Master node $MASTER_NODE finalized."
289295

290296
# Copy API server certificates from master to each worker node
291297
copy_k8s_certificates "$@"

scripts/setup/setup.cfg

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
VHIVE_BRANCH='k8s_ha_mode'
2-
LOADER_BRANCH='ha_k8s'
1+
VHIVE_BRANCH='main'
2+
LOADER_BRANCH='main'
33
CLUSTER_MODE='container' # choose from {container, firecracker, firecracker_snapshots}
44
PODS_PER_NODE=240
55
DEPLOY_PROMETHEUS=false
66

7-
# High-availability K8s control plane (default: 1, recommendation: 3 or 5)
8-
CONTROL_PLANE_REPLICAS=3
7+
# K8s control plane replicas (default: 1, for high-availability use 3 or 5)
8+
CONTROL_PLANE_REPLICAS=1

0 commit comments

Comments
 (0)