From 6075ff205f8e2ff7705fd55c20e9d88b49123e55 Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Thu, 19 Sep 2024 12:38:36 +0200 Subject: [PATCH] Install kubectl client during K3s cluster installation Change-Id: I09743f3bf8f8c3c26112e78303ee2b6017f99a7e Signed-off-by: garciadeblas --- installers/install_k3s_cluster.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/installers/install_k3s_cluster.sh b/installers/install_k3s_cluster.sh index 86bc1353..e117ab44 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 @@ function check_for_readiness() { [ -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 @@ track k8scluster k3s_node_ready_ok # update_service_nodeport_range # check_for_readiness # track k8scluster k3s_update_nodeport_range_ok +install_kubectl save_kubeconfig track k8scluster k3s_creds_ok -- 2.25.1