Install Kubernetes metrics server as part of install_kubeadm_cluster.sh 03/14403/1
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Fri, 31 May 2024 15:52:09 +0000 (17:52 +0200)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Fri, 31 May 2024 15:52:15 +0000 (17:52 +0200)
Change-Id: I10cf820eb59d57285e001a6870c525b1a1ea6053
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
installers/install_kubeadm_cluster.sh

index c64e28f..8df4619 100755 (executable)
@@ -17,6 +17,7 @@ set +eux
 
 K8S_VERSION=1.30
 K8S_PACKAGE_VERSION="$K8S_VERSION".1-1.1
+K8S_METRICS_VERSION="v0.7.1"
 
 # installs kubernetes packages
 function install_kube() {
@@ -108,6 +109,15 @@ function check_and_track_k8s_ready_before_helm() {
     [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
 }
 
+# removes osm deployments and services
+function install_k8s_metrics() {
+    [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
+    echo "Installing Kubernetes metrics"
+    kubectl apply -f "https://github.com/kubernetes-sigs/metrics-server/releases/${K8S_METRICS_VERSION}/download/components.yaml"
+    kubectl -n kube-system patch deployment metrics-server --type=json -p '[{"op":"add","path":"/spec/template/spec/containers/0/args/-","value":"--kubelet-insecure-tls"}]'
+    [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
+}
+
 # removes osm deployments and services
 function remove_k8s_namespace() {
     [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
@@ -115,7 +125,6 @@ function remove_k8s_namespace() {
     kubectl delete ns $1 2>/dev/null
     [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
 }
-
 # main
 while getopts ":D:d:i:-: " o; do
     case "${o}" in
@@ -171,6 +180,8 @@ deploy_cni_provider
 taint_master_node
 check_and_track_k8s_ready_before_helm
 
+install_k8s_metrics
+
 remove_k8s_namespace osm
 
 # install_helm has been moved to install_helm_client.sh, run from full_install_osm.sh,