Install kubectl client during K3s cluster installation
Change-Id: I09743f3bf8f8c3c26112e78303ee2b6017f99a7e
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
diff --git a/installers/install_k3s_cluster.sh b/installers/install_k3s_cluster.sh
index 86bc135..e117ab4 100755
--- a/installers/install_k3s_cluster.sh
+++ b/installers/install_k3s_cluster.sh
@@ -16,6 +16,7 @@
set +eux
# K3s releases: https://github.com/k3s-io/k3s/releases/
+K8S_CLIENT_VERSION="v1.29.3"
K8S_VERSION="v1.29.3+k3s1"
# configure registry
@@ -143,6 +144,15 @@
[ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
}
+# Install kubectl client
+function install_kubectl() {
+ [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
+ curl -LO "https://dl.k8s.io/release/${K8S_CLIENT_VERSION}/bin/linux/amd64/kubectl"
+ sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
+ rm kubectl
+ [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
+}
+
# Initializes kubeconfig file
function save_kubeconfig() {
[ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
@@ -226,5 +236,6 @@
# update_service_nodeport_range
# check_for_readiness
# track k8scluster k3s_update_nodeport_range_ok
+install_kubectl
save_kubeconfig
track k8scluster k3s_creds_ok