Skip to content

Automate the creation of an AKS cluster with ingress and HTTPS using Terraform.

Notifications You must be signed in to change notification settings

AluBhorta/tf-aks-ingress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tf-aks-with-ingress

Automate the creation of an AKS cluster with ingress and HTTPS using Terraform.

prerequisites

  • terraform
  • azure cli
  • kubectl
  • helm

getting started

Initialize Terraform and apply the configuration:

terraform init

terraform apply

After the Terraform apply is complete, configure your kubectl to use the newly created AKS cluster:

az aks get-credentials --resource-group myResourceGroup --name myAKSCluster

Install flannel CNI:

kubectl apply -f https://github.com/flannel-io/flannel/releases/latest/download/kube-flannel.yml

Create the deployment and service for pf-hello-world example:

kubectl apply -f examples-apps/pf-hello-world-deploy-svc.yaml

Test if you can reach your application on localhost:3000:

kubectl port-forward services/pf-hello-world 3000:3000

Run all the example applications:

kubectl apply -f examples-apps

Deploy ingress:

kubectl apply -f ingress/http-ingress.yaml

Get the public IP of the ingress:

kubectl get ingress

NOTE: you may need to wait a moment since public load balancer provisioning might take a bit of time.

Then, update cloudflare DNS record CNAME to point your subdomain (eg. aks.example.com) to the IP of the ingress; make sure to enable proxy status.

and voila! your app with HTTPS on AKS is deployed! 🚀

You should be able to reach all 3 deployed applications:

  • pf-hello-world on https://aks.example.com/
  • nginx on https://aks.example.com/nginx
  • whoami on https://aks.example.com/whoami

replace example.com with your domain.


note about tls/https

The HTTPS/TLS is generated by the Cloudflare proxy and not on the LB on Azure. The latter requires further configuration.

clean up

clean up all the resources in reverse order

kubectl delete -f ingress/http-ingress.yaml

kubectl delete -f examples-apps

terraform destroy

refs

About

Automate the creation of an AKS cluster with ingress and HTTPS using Terraform.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages