Skip to content

Terraform create Azure K8S Cluster, and basic configurations including Helm, ACI Connector

Notifications You must be signed in to change notification settings

tf-module/azure-aks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform Create Azure AKS

Terraform Create Azure AKS cluster, configure helm, aci-connector

1. Create RABC Role for aks service:

az ad sp create-for-rbac --role="Contributor" --name="K8S-Dev" --scopes="/subscriptions/{your_subscription_id}"

2. Export environment varibles in console:

#Used for azurerm provider, visit: https://www.terraform.io/docs/providers/azurerm/auth/service_principal_client_secret.html
export ARM_CLIENT_ID=xxx
export ARM_CLIENT_SECRET=xxx
export ARM_SUBSCRIPTION_ID=xxx
export ARM_TENANT_ID=xxx

#The following varibles are used for AKS service principle
export TF_VAR_K8S_CLUSTER_NAME=xxx
export TF_VAR_K8S_CLIENT_ID=xxx
export TF_VAR_K8S_CLIENT_SECRET=xxx

3. Run terraform command

terraform init
terraform apply

4. Configure k8s for helm

aks get-credentials --name {your cluster name} --resource-group {your resource group name}
kubectl config use-context {your cluster name)
kubectl apply -f manifests/helm-rbac.yaml

5. Install ingress controller

helm install stable/nginx-ingress \
    --namespace ingress-basic \
    --set controller.replicaCount=2 \
    --set controller.nodeSelector."beta\.kubernetes\.io/os"=linux \
    --set defaultBackend.nodeSelector."beta\.kubernetes\.io/os"=linux

6. A demo to deploy an application

kubectl apply -f manifests/deployment.yaml

About

Terraform create Azure K8S Cluster, and basic configurations including Helm, ACI Connector

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages