Skip to content

About

AKS with Terraform and Argo CD sample app

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

AKS with Terraform and Argo CD sample app

Table of Contents

Sample app screenshot

Screenshot

Sample app URL

http://hellok8s.japps.cloud

Notes

  • This code deploys an AKS cluster using Terraform CLI, ArgoCD, a sample app, and configures access through an ingress controller.
  • Configured for a single environment to keep the setup simple.
  • The Domain / FQDN may be configured in the file kubernetes/argocd/ingress.yaml
  • It is possible to set the KUBECONFIG variable before running the commands, rather than prefixing it.
  • This is a demo app and therefore uses HTTP only. ArgoCD is deployed in non high availability mode to reduce deployment time and simplify the setup.
export KUBECONFIG=~/.kube/azurek8s

Prerequisites

Usage

mkdir ~/gh
cd ~/gh
git clone https://github.com/eranoc1/aks-tf-argocd.git
cd ~/gh/aks-tf-argocd/terraform
terraform init -upgrade
terraform plan -out "tfplan"
terraform apply "tfplan" # Manual approval. This may take a few minutes
echo "$(terraform output kube_config | grep -Ev 'EOT|<< EOT')" > ~/.kube/azurek8s # Save the AKS kubeconfig file
KUBECONFIG=~/.kube/azurek8s kubectl create namespace argocd
KUBECONFIG=~/.kube/azurek8s kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
KUBECONFIG=~/.kube/azurek8s kubectl get pods -n argocd # Verify all pods are in "ready" state
cd ~/gh/aks-tf-argocd/kubernetes/argocd
KUBECONFIG=~/.kube/azurek8s kubectl apply -f ns.yaml
KUBECONFIG=~/.kube/azurek8s kubectl apply -f app.yaml
curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.10.1/deploy/static/provider/cloud/deploy.yaml |\
sed 's/namespace: ingress-nginx/namespace: hello-kubernetes/g' | KUBECONFIG=~/.kube/azurek8s kubectl apply -f -
KUBECONFIG=~/.kube/azurek8s kubectl apply -f ingress.yaml # It might take a short time before it starts working
KUBECONFIG=~/.kube/azurek8s kubectl get svc -n hello-kubernetes | grep -E "NAME|ingress-nginx-controller "  # Get the ingress public IP to be used in the DNS record
grep "host:" ingress.yaml | cut -d : -f 2 | awk '{print $1}' # Get the FQDN for the DNS record
curl http://hellok8s.japps.cloud # Use the relevant FQDN

Create the appropriate DNS record. Open the app URL in your browser.

Clean up resources

terraform plan -destroy -out "tfplan"
terraform apply -destroy "tfplan"

About

AKS with Terraform and Argo CD sample app

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages