Skip to content

Commit

Permalink
Disabling manual kubelet startup
Browse files Browse the repository at this point in the history
Signed-off-by: Lazar Cvetković <[email protected]>
  • Loading branch information
cvetkovic committed Feb 20, 2024
1 parent ac00fba commit 6ba2a67
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 19 deletions.
4 changes: 2 additions & 2 deletions configs/k8s_ha/check_apiserver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ errorExit() {
exit 1
}

curl --silent --max-time 2 --insecure https://localhost:8443/ -o /dev/null || errorExit "Error GET https://localhost:8443/"
curl --silent --max-time 2 --insecure https://localhost:6443/ -o /dev/null || errorExit "Error GET https://localhost:6443/"
if ip addr | grep -q 10.0.1.254; then
curl --silent --max-time 2 --insecure https://10.0.1.254:8443/ -o /dev/null || errorExit "Error GET https://10.0.1.254:8443/"
curl --silent --max-time 2 --insecure https://10.0.1.254:6443/ -o /dev/null || errorExit "Error GET https://10.0.1.254:6443/"
fi
2 changes: 1 addition & 1 deletion configs/k8s_ha/haproxy.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ defaults
# apiserver frontend which proxys to the control plane nodes
#---------------------------------------------------------------------
frontend apiserver
bind *:8443
bind *:6443
mode tcp
option tcplog
default_backend apiserverbackend
Expand Down
2 changes: 1 addition & 1 deletion configs/setup/kube.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"ApiserverDiscoveryToken": "",
"ApiserverCertificateKey": "",
"CPHAEndpoint": "10.0.1.254",
"CPHAPort": "8443"
"CPHAPort": "6443"
}
2 changes: 1 addition & 1 deletion configs/setup/system.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"PmuToolsRepoUrl": "https://github.com/vhive-serverless/pmu-tools",
"ProtocVersion": "3.19.4",
"ProtocDownloadUrlTemplate": "https://github.com/protocolbuffers/protobuf/releases/download/v%s/protoc-%s-linux-x86_64.zip",
"LogVerbosity": 5
"LogVerbosity": 0
}
33 changes: 20 additions & 13 deletions scripts/cluster/create_multinode_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ func CreateMultinodeCluster(stockContainerd string, rawHaReplicaCount string) er
return err
}

if err := CreateMasterKubeletService(); err != nil {
/*if err := CreateMasterKubeletService(); err != nil {
return err
}
}*/

if err := DeployKubernetes(haReplicaCount); err != nil {
return err
Expand Down Expand Up @@ -103,16 +103,11 @@ EOF'`
// Deploy Kubernetes
func DeployKubernetes(haReplicaCount int) error {
utils.WaitPrintf("Deploying Kubernetes(version %s)", configs.Kube.K8sVersion)
masterNodeIp, iperr := utils.ExecShellCmd(`ip route | awk '{print $(NF)}' | awk '/^10\..*/'`)
if iperr != nil {
return iperr
}

command := fmt.Sprintf(`sudo kubeadm init --v=%d \
--apiserver-advertise-address=%s \
--cri-socket /run/containerd/containerd.sock \
--kubernetes-version %s \
--pod-network-cidr="%s" `, configs.System.LogVerbosity, masterNodeIp, configs.Kube.K8sVersion, configs.Kube.PodNetworkCidr)
--pod-network-cidr="%s" `, configs.System.LogVerbosity, configs.Kube.K8sVersion, configs.Kube.PodNetworkCidr)

if haReplicaCount > 0 {
command += fmt.Sprintf(`\
Expand Down Expand Up @@ -198,17 +193,29 @@ func ExtractMasterNodeInfo() error {
configs.Kube.ApiserverAdvertiseAddress,
configs.Kube.ApiserverPort,
configs.Kube.ApiserverToken,
configs.Kube.ApiserverDiscoveryToken)
configs.Kube.ApiserverDiscoveryToken,
configs.Kube.ApiserverCertificateKey)
_, err = masterKeyYamlFile.WriteString(masterKeyYaml)
if !utils.CheckErrorWithTagAndMsg(err, "Failed to create masterKey.yaml with master node information!\n") {
return err
}

utils.SuccessPrintf("Join cluster from worker nodes as a new control plane node with command: sudo kubeadm join %s:%s --token %s --discovery-token-ca-cert-hash %s --control-plane --certificate-key %s\n",
configs.Kube.ApiserverAdvertiseAddress, configs.Kube.ApiserverPort, configs.Kube.ApiserverToken, configs.Kube.ApiserverDiscoveryToken, configs.Kube.ApiserverCertificateKey)
utils.SuccessPrintf("Join cluster from worker nodes as a new control plane node with command: "+
"sudo kubeadm join %s:%s --token %s --discovery-token-ca-cert-hash %s --control-plane --certificate-key %s\n",
configs.Kube.ApiserverAdvertiseAddress,
configs.Kube.ApiserverPort,
configs.Kube.ApiserverToken,
configs.Kube.ApiserverDiscoveryToken,
configs.Kube.ApiserverCertificateKey,
)

utils.SuccessPrintf("Join cluster from worker nodes with command: sudo kubeadm join %s:%s --token %s --discovery-token-ca-cert-hash %s\n",
configs.Kube.ApiserverAdvertiseAddress, configs.Kube.ApiserverPort, configs.Kube.ApiserverToken, configs.Kube.ApiserverDiscoveryToken)
utils.SuccessPrintf("Join cluster from worker nodes with command: "+
"sudo kubeadm join %s:%s --token %s --discovery-token-ca-cert-hash %s\n",
configs.Kube.ApiserverAdvertiseAddress,
configs.Kube.ApiserverPort,
configs.Kube.ApiserverToken,
configs.Kube.ApiserverDiscoveryToken,
)

return nil
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/utils/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ func PrepareEnvironment() error {
func CleanEnvironment() error {
// Define task List
cleanTaskList := []func() error{
CleanUpTmpDir,
//CleanUpTmpDir,
}
// Execute task
for _, task := range cleanTaskList {
Expand Down

0 comments on commit 6ba2a67

Please sign in to comment.