Skip to content

Instantly share code, notes, and snippets.

@vfarcic
Last active January 18, 2022 00:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vfarcic/81bef768d6cdd0ac85e8bd862f1f8ea6 to your computer and use it in GitHub Desktop.
Save vfarcic/81bef768d6cdd0ac85e8bd862f1f8ea6 to your computer and use it in GitHub Desktop.
# Source: https://gist.github.com/81bef768d6cdd0ac85e8bd862f1f8ea6
####################
# Create a Cluster #
####################
# Only if you did not yet clone that repository
git clone \
https://github.com/vfarcic/devops-catalog-code.git
cd devops-catalog-code
git pull
cd terraform-lke/simple
# Open https://cloud.linode.com/profile/tokens, create a *Personal Access Token*, and replace `[...]` in the command that follows with it
export TF_VAR_token=[...]
# NOTE: k8s_version 1.19 might not be available any more
export TF_VAR_k8s_version=1.19
terraform init
terraform apply \
--var ingress_nginx=true
export KUBECONFIG=$PWD/kubeconfig
kubectl get nodes
cd ../../..
######################
# Ingress Controller #
######################
export INGRESS_HOSTNAME=$(kubectl \
--namespace ingress-nginx \
get svc ingress-nginx-controller \
--output jsonpath="{.status.loadBalancer.ingress[0].hostname}")
export INGRESS_HOST=$(\
dig +short $INGRESS_HOSTNAME)
echo $INGRESS_HOST
# Repeat the `export` commands if the output is empty
#######################
# Destroy The Cluster #
#######################
cd devops-catalog-code/terraform-lke/simple
terraform destroy
cd ../../../
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment