pegasus-io / a-k8s-demo

Demo Express Server Deployment for k8s, with extras
1 stars 0 forks source link

AJOUTER_TERRAFORM_ET_KUBEONE #1

Open Jean-Baptiste-Lasselle opened 4 years ago

Jean-Baptiste-Lasselle commented 4 years ago

Ajouter un service basé sur une image terraform, dans laquelle j'installe kubeone, avec un volume docker dédié. nom du service kubeone


export WORKDIR=$(pwd)
# amd64 only supported for the moment.
export KUBEONE_CPU_ARCH=amd64
# 'linux' or 'darwin', windows is not supported
export KUBEONE_OS=linux
export KUBEONE_VERSION=0.11.0
export KUBEONE_PKG_DWNLD_URI=https://github.com/kubermatic/kubeone/releases/download/v${KUBEONE_VERSION}/kubeone_${KUBEONE_VERSION}_${KUBEONE_OS}_${KUBEONE_CPU_ARCH}.zip
export KUBEONE_CHKSUMS_DWNLD_URI=https://github.com/kubermatic/kubeone/releases/download/v${KUBEONE_VERSION}/kubeone_${KUBEONE_VERSION}_checksums.txt
KUBEONE_INSTALLATION_HOME=$BUMBLEBEE_HOME_INSIDE_CONTAINER/kubeone/installation/${KUBEONE_VERSION}

mkdir -p ${KUBEONE_INSTALLATION_HOME}

# etc.. tel que décrit dans https://dzone.com/articles/running-ha-kubernetes-clusters-on-aws-using-kubeon

curl -LO ${KBONE_PKG_DWNLD_URI}

curl -LO ${KUBEONE_CHKSUMS_DWNLD_URI}
cat kubeone_${KUBEONE_VERSION}_checksums.txt | grep ${KUBEONE_OS} | grep ${KUBEONE_CPU_ARCH} | tee ./kubeone_checksums.txt
sha256sum -c ./kubeone_checksums.txt
if [ "$?" == "0" ]; then
  echo "Successfully checked integrity of the downloaded kubeone version ${KUBEONE_VERSION} package for ${KUBEONE_OS} OS on ${KUBEONE_CPU_ARCH} cpu"
  echo "Proceeding installation"
  unzip -d kubeone_${KUBEONE_VERSION}_${KUBEONE_OS}_${KUBEONE_CPU_ARCH}.zip ${KUBEONE_INSTALLATION_HOME}/
  ln -s ${KUBEONE_INSTALLATION_HOME}/kubeone /usr/local/bin/kubeone
else
  echo "Integrity check failed for the downloaded kubeone version ${KUBEONE_VERSION} package for ${KUBEONE_OS} OS on ${KUBEONE_CPU_ARCH} cpu"
  echo "check yourself the integrity breach running the following command : "
  echo "   cd ${WORKDIR} && sha256sum -c sha256sum -c ./kubeone_checksums.txt"
  exit 3
fi;

# -----
# Now we'll retrieve from KubeOne github repo the
# aws example terraform: fully operational, and how 
# any kubeone run should start 

git clone https://github.com/kubermatic/kubeone ./kubeone/source
cd ./kubeone/source
git checkout v${KUBEONE_VERSION}
cp -Rf examples/terraform/aws/ ${WORKDIR}/workspace

# ---
# and we initialiuze the git flow on the ATLANTIC GIT REPO

cd ${WORKDIR}/workpsace
git init 
git add remote origin $
git flow init --defaults
git push -u origin 
Jean-Baptiste-Lasselle commented 4 years ago

alternative envisageable , kops : https://medium.com/containermind/how-to-create-a-kubernetes-cluster-on-aws-in-few-minutes-89dda10354f4

Jean-Baptiste-Lasselle commented 4 years ago

Ajouts : Terraform ansible inventory plugin

https://github.com/adammck/terraform-inventory

Dans l'image du service kubeone_operator, j'ajouterai l'installation d'un plugin particulier de Terraform, le Terraform ansible inventory plugin :