Last active
February 5, 2022 21:36
-
-
Save vfarcic/0e28b2a9f10b2f643502f80391ca6ce8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source: https://gist.github.com/0e28b2a9f10b2f643502f80391ca6ce8 | |
#################### | |
# Create a Cluster # | |
#################### | |
# This script assumes that you followed the instructions from the "Creating And Managing Google Kubernetes Engine (GKE) Clusters With Terraform" section" section. | |
# It assumes that you have: | |
# * The resource group *devops-catalog-aks* | |
# * The storage account *devopscatalog* | |
# * The storage container *devopscatalog* | |
# Make sure that you are inside the local copy of the devops-catalog-code repository | |
cd terraform-aks/minimal | |
terraform init | |
az aks get-versions --location eastus | |
# Replace `[...]` with a valid orchestratorVersion from the previous output | |
export K8S_VERSION=[...] | |
terraform refresh \ | |
--var k8s_version=$K8S_VERSION | |
terraform apply \ | |
--var k8s_version=$K8S_VERSION | |
export KUBECONFIG=$PWD/kubeconfig | |
az aks get-credentials \ | |
--name \ | |
$(terraform output --raw cluster_name) \ | |
--resource-group \ | |
$(terraform output --raw resource_group) \ | |
--file \ | |
$KUBECONFIG | |
kubectl get nodes | |
cd ../.. | |
############################# | |
# Deploy Ingress Controller # | |
############################# | |
kubectl apply \ | |
--filename https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.1.0/deploy/static/provider/cloud/deploy.yaml | |
export INGRESS_HOST=$(kubectl \ | |
--namespace ingress-nginx \ | |
get svc ingress-nginx-controller \ | |
--output jsonpath="{.status.loadBalancer.ingress[0].ip}") | |
echo $INGRESS_HOST | |
# Repeat the `export` command if the output is empty | |
####################### | |
# Destroy The Cluster # | |
####################### | |
cd terraform-aks/minimal | |
terraform destroy \ | |
--var k8s_version=$K8S_VERSION \ | |
--target azurerm_kubernetes_cluster.primary | |
cd ../.. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment