Skip to content

Commit cebc4a3

Browse files
hancheng wangleokondrashov
authored andcommitted
Re-structure knative and istio YAML usage
Signed-off-by: hancheng wang <[email protected]> Re-structure knative and istio YAML usage Signed-off-by: hancheng wang <[email protected]> Re-structure knative and istio YAML usage Signed-off-by: hancheng wang <[email protected]> Re-structure knative and istio YAML usage Signed-off-by: hancheng wang <[email protected]> Re-structure knative and istio YAML usage Signed-off-by: hancheng wang <[email protected]> Re-structure knative and istio YAML usage Signed-off-by: hancheng wang <[email protected]> Re-structure knative and istio YAML usage Signed-off-by: hancheng wang <[email protected]> Re-structure knative and istio YAML usage Signed-off-by: hancheng wang <[email protected]> Re-structure knative and istio YAML usage Signed-off-by: hancheng wang <[email protected]> Re-structure knative and istio YAML usage Signed-off-by: hancheng wang <[email protected]> Re-structure knative and istio YAML usage Signed-off-by: hancheng wang <[email protected]> Re-structure knative and istio YAML usage Signed-off-by: hancheng wang <[email protected]> Re-structure knative and istio YAML usage Signed-off-by: hancheng wang <[email protected]> Re-structure knative and istio YAML usage Signed-off-by: hancheng wang <[email protected]> Re-structure knative and istio YAML usage Signed-off-by: hancheng wang <[email protected]> Re-structure knative and istio YAML usage Signed-off-by: hancheng wang <[email protected]> Re-structure knative and istio YAML usage Signed-off-by: hancheng wang <[email protected]> Re-structure knative and istio YAML usage Signed-off-by: hancheng wang <[email protected]> Re-structure knative and istio YAML usage Signed-off-by: hancheng wang <[email protected]> Re-structure knative and istio YAML usage Signed-off-by: hancheng wang <[email protected]> Re-structure knative and istio YAML usage Signed-off-by: hancheng wang <[email protected]> Re-structure knative and istio YAML usage Signed-off-by: hancheng wang <[email protected]> Re-structure knative and istio YAML usage Signed-off-by: hancheng wang <[email protected]>
1 parent 632bc40 commit cebc4a3

File tree

8 files changed

+95
-16
lines changed

8 files changed

+95
-16
lines changed

configs/setup/system.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
"KubeVersion": "1.25.9-00",
1414
"PmuToolsRepoUrl": "https://github.com/vhive-serverless/pmu-tools",
1515
"ProtocVersion": "3.19.4",
16-
"ProtocDownloadUrlTemplate": "https://github.com/protocolbuffers/protobuf/releases/download/v%s/protoc-%s-linux-x86_64.zip"
16+
"ProtocDownloadUrlTemplate": "https://github.com/protocolbuffers/protobuf/releases/download/v%s/protoc-%s-linux-x86_64.zip",
17+
"LogVerbosity": 0
1718
}

docs/logging.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
This guide describes how to collect and extract logs in an N-node vHive serverless cluster with Firecracker MicroVMs.
55

6+
Kubelet has its own logs, which can have different verbosity levels. This verbosity can be controlled by the `LogVerbosity` parameter in `configs/setup/system.json`. In addition, this parameter changes the sizes of per-container logs. By default, this parameter is set to 0 for performance reasons.
7+
68
There are a couple of ways to gather and extract logs for vHive to your local machine, whether it is on a single-node cluster or a multi node one.
79
We will present one method to do it.
810
Firstly, if you follow the steps from the [Quickstart guide], logs should already be generated in the `/tmp/vhive-logs` folder at different steps in the workflow.

scripts/cluster/create_multinode_cluster.go

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"fmt"
2727
"os"
2828
"strings"
29+
"time"
2930

3031
configs "github.com/vhive-serverless/vHive/scripts/configs"
3132
utils "github.com/vhive-serverless/vHive/scripts/utils"
@@ -54,6 +55,12 @@ func CreateMultinodeCluster(stockContainerd string) error {
5455
return err
5556
}
5657

58+
if configs.System.LogVerbosity != 0 {
59+
if err := IncreaseLogSizePerContainer(); err != nil {
60+
return err
61+
}
62+
}
63+
5764
// Set up master node
5865
utils.InfoPrintf("Set up master node\n")
5966
if err := SetupMasterNode(stockContainerd); err != nil {
@@ -68,10 +75,10 @@ func CreateMultinodeCluster(stockContainerd string) error {
6875
func CreateMasterKubeletService() error {
6976
utils.WaitPrintf("Creating kubelet service")
7077
bashCmd := `sudo sh -c 'cat <<EOF > /etc/systemd/system/kubelet.service.d/0-containerd.conf
71-
[Service]
72-
Environment="KUBELET_EXTRA_ARGS=--container-runtime=remote --runtime-request-timeout=15m --container-runtime-endpoint=unix:///run/containerd/containerd.sock"
78+
[Service]
79+
Environment="KUBELET_EXTRA_ARGS=--container-runtime=remote --v=%d --runtime-request-timeout=15m --container-runtime-endpoint=unix:///run/containerd/containerd.sock"
7380
EOF'`
74-
_, err := utils.ExecShellCmd(bashCmd)
81+
_, err := utils.ExecShellCmd(bashCmd, configs.System.LogVerbosity)
7582
if !utils.CheckErrorWithMsg(err, "Failed to create kubelet service!\n") {
7683
return err
7784
}
@@ -87,7 +94,16 @@ EOF'`
8794
func DeployKubernetes() error {
8895

8996
utils.WaitPrintf("Deploying Kubernetes(version %s)", configs.Kube.K8sVersion)
90-
shellCmd := fmt.Sprintf("sudo kubeadm init --kubernetes-version %s --pod-network-cidr=\"%s\" ", configs.Kube.K8sVersion, configs.Kube.PodNetworkCidr)
97+
masterNodeIp, iperr := utils.ExecShellCmd(`ip route | awk '{print $(NF)}' | awk '/^10\..*/'`)
98+
if iperr != nil {
99+
return iperr
100+
}
101+
shellCmd := fmt.Sprintf(`sudo kubeadm init --v=%d \
102+
--apiserver-advertise-address=%s \
103+
--cri-socket /run/containerd/containerd.sock \
104+
--kubernetes-version %s \
105+
--pod-network-cidr="%s" `,
106+
configs.System.LogVerbosity, masterNodeIp, configs.Kube.K8sVersion, configs.Kube.PodNetworkCidr)
91107
if len(configs.Kube.AlternativeImageRepo) > 0 {
92108
shellCmd = fmt.Sprintf(shellCmd+"--image-repository %s ", configs.Kube.AlternativeImageRepo)
93109
}
@@ -193,3 +209,19 @@ func WaitForWorkerNodes() error {
193209
utils.SuccessPrintf("All nodes successfully joined!(user confirmed)\n")
194210
return nil
195211
}
212+
213+
// Increase log size per container
214+
func IncreaseLogSizePerContainer() error {
215+
_, err := utils.ExecShellCmd(`sudo echo "containerLogMaxSize: 512Mi" > >(sudo tee -a /var/lib/kubelet/config.yaml >/dev/null)`)
216+
if err != nil {
217+
return err
218+
}
219+
220+
_, err = utils.ExecShellCmd(`sudo systemctl restart kubelet`)
221+
if err != nil {
222+
return err
223+
}
224+
225+
time.Sleep(15 * time.Second)
226+
return nil
227+
}

scripts/cluster/setup_master_node.go

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
package cluster
2424

2525
import (
26+
"os"
2627
"path"
2728

2829
configs "github.com/vhive-serverless/vHive/scripts/configs"
@@ -107,7 +108,11 @@ func SetupMasterNode(stockContainerd string) error {
107108
func InstallCalico() error {
108109

109110
utils.WaitPrintf("Installing pod network")
110-
_, err := utils.ExecShellCmd("kubectl apply -f %s", configs.Kube.PodNetworkAddonConfigURL)
111+
calicoYamlPath, err := utils.GetVHiveFilePath(path.Join("configs/calico", "canal.yaml"))
112+
if err != nil {
113+
return err
114+
}
115+
_, err = utils.ExecShellCmd("kubectl apply -f %s", calicoYamlPath)
111116
if !utils.CheckErrorWithTagAndMsg(err, "Failed to install pod network!\n") {
112117
return err
113118
}
@@ -199,16 +204,39 @@ func InstallKnativeServingComponent(stockContainerd string) error {
199204
if !utils.CheckErrorWithMsg(err, "Failed to install Knative Serving component!\n") {
200205
return err
201206
}
202-
_, err = utils.ExecShellCmd("kubectl apply -f https://github.com/knative/serving/releases/download/knative-v%s/serving-core.yaml", configs.Knative.KnativeVersion)
203-
if !utils.CheckErrorWithTagAndMsg(err, "Failed to install Knative Serving component!\n") {
204-
return err
207+
208+
if _, err = os.Stat(path.Join(configs.VHive.VHiveRepoPath, path.Join("configs/knative_yamls", "serving-core.yaml"))); err != nil {
209+
utils.WaitPrintf("Using stock version of knative.")
210+
_, err = utils.ExecShellCmd("kubectl apply -f https://github.com/knative/serving/releases/download/knative-v%s/serving-core.yaml", configs.Knative.KnativeVersion)
211+
if !utils.CheckErrorWithTagAndMsg(err, "Failed to install Knative Serving component!\n") {
212+
return err
213+
}
214+
} else {
215+
utils.WaitPrintf("Found local serving-core.yaml. Using it instead of stock version of knative.")
216+
servingCorePath, err := utils.GetVHiveFilePath(path.Join("configs/knative_yamls", "serving-core.yaml"))
217+
if err != nil {
218+
return err
219+
}
220+
_, err = utils.ExecShellCmd("kubectl apply -f %s", servingCorePath)
221+
if !utils.CheckErrorWithTagAndMsg(err, "Failed to install Knative Serving component!\n") {
222+
return err
223+
}
205224
}
206225
} else {
207-
_, err := utils.ExecShellCmd("kubectl apply -f %s/serving-crds.yaml", configs.Knative.NotStockOnlyKnativeServingYamlUrlPrefix)
226+
servingCrdsPath, err := utils.GetVHiveFilePath(path.Join("configs/knative_yamls", "serving-crds-firecracker.yaml"))
227+
if err != nil {
228+
return err
229+
}
230+
_, err = utils.ExecShellCmd("kubectl apply -f %s", servingCrdsPath)
208231
if !utils.CheckErrorWithMsg(err, "Failed to install Knative Serving component!\n") {
209232
return err
210233
}
211-
_, err = utils.ExecShellCmd("kubectl apply -f %s/serving-core.yaml", configs.Knative.NotStockOnlyKnativeServingYamlUrlPrefix)
234+
235+
servingCorePath, err := utils.GetVHiveFilePath(path.Join("configs/knative_yamls", "serving-core-firecracker.yaml"))
236+
if err != nil {
237+
return err
238+
}
239+
_, err = utils.ExecShellCmd("kubectl apply -f %s", servingCorePath)
212240
if !utils.CheckErrorWithTagAndMsg(err, "Failed to install Knative Serving component!\n") {
213241
return err
214242
}
@@ -263,10 +291,23 @@ func ConfigureMagicDNS() error {
263291
// Deploy Istio pods
264292
func DeployIstioPods() error {
265293
utils.WaitPrintf("Deploying istio pods")
266-
_, err := utils.ExecShellCmd("kubectl apply -f https://github.com/knative/net-istio/releases/download/knative-v%s/net-istio.yaml", configs.Knative.KnativeVersion)
267-
if !utils.CheckErrorWithTagAndMsg(err, "Failed to deploy istio pods!\n") {
268-
return err
294+
295+
if _, err := os.Stat(path.Join(configs.VHive.VHiveRepoPath, path.Join("configs/knative_yamls", "net-istio.yaml"))); err != nil {
296+
_, err = utils.ExecShellCmd("kubectl apply -f https://github.com/knative/net-istio/releases/download/knative-v%s/net-istio.yaml", configs.Knative.KnativeVersion)
297+
if !utils.CheckErrorWithTagAndMsg(err, "Failed to deploy istio pods!\n") {
298+
return err
299+
}
300+
} else {
301+
loaderIstioControllerPath, err := utils.GetVHiveFilePath(path.Join("configs/knative_yamls", "net-istio.yaml"))
302+
if err != nil {
303+
return err
304+
}
305+
_, err = utils.ExecShellCmd("kubectl apply --filename %s", loaderIstioControllerPath)
306+
if !utils.CheckErrorWithTagAndMsg(err, "Failed to deploy istio pods!\n") {
307+
return err
308+
}
269309
}
310+
270311
return nil
271312
}
272313

scripts/cluster/setup_worker_kubelet.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
package cluster
2424

2525
import (
26+
configs "github.com/vhive-serverless/vHive/scripts/configs"
2627
utils "github.com/vhive-serverless/vHive/scripts/utils"
2728
)
2829

@@ -51,9 +52,10 @@ func CreateWorkerKubeletService(criSock string) error {
5152
}
5253
bashCmd := "sudo sh -c 'cat <<EOF > /etc/systemd/system/kubelet.service.d/0-containerd.conf\n" +
5354
"[Service]\n" +
54-
`Environment="KUBELET_EXTRA_ARGS=--container-runtime=remote --runtime-request-timeout=15m --container-runtime-endpoint=unix://%s"` +
55+
`Environment="KUBELET_EXTRA_ARGS=--container-runtime=remote --v=%d --runtime-request-timeout=15m --container-runtime-endpoint=unix://%s"` +
5556
"\nEOF'"
56-
_, err = utils.ExecShellCmd(bashCmd, criSock)
57+
58+
_, err = utils.ExecShellCmd(bashCmd, configs.System.LogVerbosity, criSock)
5759
if !utils.CheckErrorWithMsg(err, "Failed to create kubelet service!\n") {
5860
return err
5961
}

scripts/configs/system.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ type SystemEnvironmentStruct struct {
5050
PmuToolsRepoUrl string
5151
ProtocVersion string
5252
ProtocDownloadUrlTemplate string
53+
LogVerbosity int
5354
}
5455

5556
// Current system environment

0 commit comments

Comments
 (0)