https://github.com/rishabkumar7/aks-terraform-starter
A k8s starter project to launch AKS cluster in Azure using Terraform.
https://github.com/rishabkumar7/aks-terraform-starter
aks kubernetes terraform
Last synced: about 1 year ago
JSON representation
A k8s starter project to launch AKS cluster in Azure using Terraform.
- Host: GitHub
- URL: https://github.com/rishabkumar7/aks-terraform-starter
- Owner: rishabkumar7
- License: mit
- Created: 2024-02-08T04:08:13.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-12T19:52:01.000Z (over 2 years ago)
- Last Synced: 2025-04-07T03:34:44.574Z (about 1 year ago)
- Topics: aks, kubernetes, terraform
- Language: HCL
- Homepage:
- Size: 9.77 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# aks-terraform-starter
This terraform code deploys a minimal AKS cluster.
## Requirements
You will need the following installed:
- [Terraform](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli)
- [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/)
- [Kubectl](https://kubernetes.io/docs/tasks/tools/)
## Get Started
### 1. Authenticate with your Azure Account
Run `az login` to authenticate with your Azure Account.
### 2. Deploy the infrastructure with Terraform
Update the defaults in `./variables.tf`.
``` bash
terraform apply
```
[!IMPORTANT]
You can run `terraform plan` first to see what all resources will be deployed.
### 3. Connect Kubectl to the deployed cluster
After `terraform apply` is done running, you will get the following output:
``` bash
Apply complete! Resources: 8 added, 0 changed, 0 destroyed.
Outputs:
client_certificate =
client_key =
cluster_ca_certificate =
cluster_password =
cluster_username =
host =
key_data =
kube_config =
kubernetes_cluster_name = "cluster-upright-tapir"
resource_group_name = "rg-upright-tapir"
```
Make a note of the `kubernetes_cluster_name`
``` bash
az aks get-credentials --resource-group learning-aks-rg --name
```
The above command will save the file in default `.kube\config` directory, to get `kubeconfig` file in the specific location use the following:
```bash
az aks get-credentials --resource-group learning-aks-rg --name --file
```
### 4. Create an app with a deployment and service
``` bash
kubectl apply -f app.yaml
```
## Your App
You can check what pods are running in your cluster:
``` bash
kubectl get pods
```
To get the external IP for your load-balancer, you can:
``` bash
kubectl get service aks-sample-linux-service
```
## Author
- GitHub - [Rishab Kumar](https://github.com/rishabkumar7)
- Twitter - [Rishab Kumar](https://x.com/rishabincloud)