From e3c7d3d4153d3a9383d4ebcaa004e54b1b0b64c2 Mon Sep 17 00:00:00 2001 From: Todd Malsbary Date: Tue, 27 Oct 2020 14:46:29 -0700 Subject: Upgrade kubespray from 2.12.6 to 2.14.1 - Replace move of ansible.cfg from kubespray distribution to /etc/ansible with ANSIBLE_CONFIG environment variable. Ansible modifies ansible.cfg during installation, and the paths in it are relative. - kubespray 2.14.1 requires a kubernetes version > 1.16. Use the default versions of kubernetes and helm provided by kubespray 2.14.1. - kubespray 2.14.1 replaces helm 2 with helm 3. This removes support for helm init and helm serve. It is no longer necessary to call helm init, and the helm serve repository is replaced with file relative URLs. This also triggered a subsequent update of the kubernetes-helm ansible module to include the newer helm versions. - Add "storageType: hostPath" to etcd/values.yaml. Helm deploy of etcd will fail without this due to nil PersistentVolume.metadata.labels.type. - The mitogen module used by kubespray/ansible requires python2 on the hosts. Use the linear strategy to bypass mitogen and install python2 on the cluster hosts. Issue-ID: MULTICLOUD-1230 Signed-off-by: Todd Malsbary Change-Id: I9f50bb4e123fdcacab6b6a97e79cd09fb5c96634 --- kud/hosting_providers/containerized/installer.sh | 12 ++++++++---- .../containerized/inventory/group_vars/k8s-cluster.yml | 3 --- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'kud/hosting_providers/containerized') diff --git a/kud/hosting_providers/containerized/installer.sh b/kud/hosting_providers/containerized/installer.sh index ae16b1dd..6fd7c915 100755 --- a/kud/hosting_providers/containerized/installer.sh +++ b/kud/hosting_providers/containerized/installer.sh @@ -36,7 +36,6 @@ function _install_ansible { pip install --no-cache-dir ansible==$version } -# install_k8s() - Install Kubernetes using kubespray tool function install_kubespray { echo "Deploying kubernetes" version=$(grep "kubespray_version" ${kud_playbooks}/kud-vars.yml | \ @@ -50,7 +49,6 @@ function install_kubespray { _install_ansible wget https://github.com/kubernetes-incubator/kubespray/archive/$tarball tar -C $dest_folder -xzf $tarball - mv $dest_folder/kubespray-$version/ansible.cfg /etc/ansible/ansible.cfg chown -R root:root $dest_folder/kubespray-$version mkdir -p ${local_release_dir}/containers rm $tarball @@ -79,10 +77,13 @@ function install_kubespray { fi } +# install_k8s() - Install Kubernetes using kubespray tool function install_k8s { - version=$(grep "kubespray_version" ${kud_playbooks}/kud-vars.yml | \ - awk -F ': ' '{print $2}') local cluster_name=$1 + ansible-playbook $verbose -i \ + $kud_inventory $kud_playbooks/preconfigure-kubespray.yml \ + --become --become-user=root | \ + tee $cluster_log/setup-kubernetes.log ansible-playbook $verbose -i \ $kud_inventory $dest_folder/kubespray-$version/cluster.yml \ -e cluster_name=$cluster_name --become --become-user=root | \ @@ -199,6 +200,9 @@ function install_pkg { } function install_cluster { + version=$(grep "kubespray_version" ${kud_playbooks}/kud-vars.yml | \ + awk -F ': ' '{print $2}') + export ANSIBLE_CONFIG=$dest_folder/kubespray-$version/ansible.cfg install_k8s $1 if [ ${2:+1} ]; then echo "install default addons and $2" diff --git a/kud/hosting_providers/containerized/inventory/group_vars/k8s-cluster.yml b/kud/hosting_providers/containerized/inventory/group_vars/k8s-cluster.yml index 5560dd97..0a2953ce 100644 --- a/kud/hosting_providers/containerized/inventory/group_vars/k8s-cluster.yml +++ b/kud/hosting_providers/containerized/inventory/group_vars/k8s-cluster.yml @@ -49,9 +49,6 @@ kubectl_localhost: true local_volumes_enabled: true local_volume_provisioner_enabled: true -## Change this to use another Kubernetes version, e.g. a current beta release -kube_version: v1.16.9 - # Helm deployment helm_enabled: true -- cgit 1.2.3-korg