Skip to content

Commit 4166969

Browse files
jekaalexellis
authored andcommitted
Fix installation of metrics-server app
Always install in "kube-system" namespace by using 'kubectl -n' Signed-off-by: Jetchko Jekov <jetchko.jekov@gmail.com>
1 parent dea8d36 commit 4166969

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

pkg/cmd/metricsserver_app.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ func makeInstallMetricsServer() *cobra.Command {
1616
Use: "metrics-server",
1717
Short: "Install metrics-server",
1818
Long: `Install metrics-server`,
19-
Example: ` k3sup app install metrics-server --namespace default`,
19+
Example: ` k3sup app install metrics-server --namespace kube-system`,
2020
SilenceUsage: true,
2121
}
2222

23-
metricsServer.Flags().StringP("namespace", "n", "default", "The namespace used for installation")
23+
metricsServer.Flags().StringP("namespace", "n", "kube-system", "The namespace used for installation")
2424

2525
metricsServer.RunE = func(command *cobra.Command, args []string) error {
2626
kubeConfigPath := getDefaultKubeconfig()
@@ -37,8 +37,8 @@ func makeInstallMetricsServer() *cobra.Command {
3737
}
3838
namespace, _ := command.Flags().GetString("namespace")
3939

40-
if namespace != "default" {
41-
return fmt.Errorf(`to override the "default", install via tiller`)
40+
if namespace != "kube-system" {
41+
return fmt.Errorf(`to override the "kube-system", install via tiller`)
4242
}
4343

4444
clientArch, clientOS := getClientArch()
@@ -70,11 +70,9 @@ func makeInstallMetricsServer() *cobra.Command {
7070
fmt.Println("Chart path: ", chartPath)
7171
outputPath := path.Join(chartPath, "metrics-server/rendered")
7272

73-
// ns:="kube-system"
74-
ns := "default"
7573
err = templateChart(chartPath,
7674
"metrics-server",
77-
ns,
75+
namespace,
7876
outputPath,
7977
"values.yaml",
8078
overrides)
@@ -83,7 +81,7 @@ func makeInstallMetricsServer() *cobra.Command {
8381
return err
8482
}
8583

86-
err = kubectl("apply", "-R", "-f", outputPath)
84+
err = kubectl("-n", namespace, "apply", "-R", "-f", outputPath)
8785

8886
if err != nil {
8987
return err

0 commit comments

Comments
 (0)