+
+# remove infrastructure stack if present
+# note the order of the packages being removed.
+for PKG in kubeadm docker.io; do
+ INSTALLED_VERSION=$(dpkg --list |grep ${PKG} |tr -s " " |cut -f3 -d ' ')
+ if [ ! -z ${INSTALLED_VERSION} ]; then
+ if [ "${PKG}" == "kubeadm" ]; then
+ kubeadm reset -f
+ rm -rf ~/.kube
+ apt-get -y $APTOPTS remove kubeadm kubelet kubectl kubernetes-cni
+ else
+ apt-get -y $APTOPTS remove "${PKG}"
+ fi
+ fi
+done
+apt-get -y autoremove
+
+# install docker