-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from Altonhe/feature/aks
azure: add aks deployment
- Loading branch information
Showing
12 changed files
with
214 additions
and
15 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ jobs: | |
fi | ||
- name: Run chart-testing (lint) | ||
run: ct lint --validate-maintainers=false --target-branch main | ||
run: ct lint --validate-maintainers=false --check-version-increment=false --target-branch main | ||
|
||
- name: Create kind cluster | ||
uses: helm/[email protected] | ||
|
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
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
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
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
provider "azurerm" { | ||
features {} | ||
} | ||
|
||
resource "azurerm_resource_group" "main" { | ||
name = var.resource_group_name | ||
location = var.location | ||
} | ||
|
||
resource "azurerm_kubernetes_cluster" "main" { | ||
name = var.aks_cluster_name | ||
location = azurerm_resource_group.main.location | ||
resource_group_name = azurerm_resource_group.main.name | ||
dns_prefix = var.dns_prefix | ||
|
||
default_node_pool { | ||
name = "agentpool" | ||
node_count = 2 | ||
vm_size = "Standard_DS2_v2" | ||
} | ||
|
||
identity { | ||
type = "SystemAssigned" | ||
} | ||
|
||
tags = var.tags | ||
} | ||
|
||
resource "azurerm_kubernetes_cluster_node_pool" "additional_node_pool" { | ||
count = 0 | ||
name = "nodepool" | ||
kubernetes_cluster_id = azurerm_kubernetes_cluster.main.id | ||
vm_size = "Standard_DS2_v2" | ||
node_count = 2 | ||
} | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
output "kube_config" { | ||
value = azurerm_kubernetes_cluster.main.kube_config_raw | ||
sensitive = true | ||
} | ||
|
||
output "resource_group_name" { | ||
value = azurerm_resource_group.main.name | ||
} | ||
|
||
output "aks_cluster_name" { | ||
value = azurerm_kubernetes_cluster.main.name | ||
} | ||
|
||
output "kube_config_path" { | ||
value = "${path.module}/kubeconfig_aks" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Deployment Guide for Azure AKS | ||
|
||
Azure Kubernetes Service (AKS) is a managed Kubernetes service provided by Azure, it provides a wide range of features and integrations with other Azure services. This guide will show you how to deploy Onebusaway server on Azure AKS. | ||
|
||
## Prerequisites | ||
|
||
1. An Azure account, if you don't have one, you can create a free account [here](https://azure.microsoft.com/en-us/free/). | ||
2. Azure CLI, you can install it by following the instructions [here](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli). | ||
3. Opentofu, an open-source Terraform alternative, you can install it by following the instructions [here](https://opentofu.org/docs/intro/install/). | ||
4. Make sure you install *ALL* the prerequisites before you start the deployment. | ||
|
||
## Steps | ||
|
||
1. Clone this repository to your local machine, you can run | ||
```bash | ||
git clone | ||
``` | ||
|
||
2. Change the directory to `modules/azure-aks`, you can use command | ||
```bash | ||
cd onebusaway-deployment/modules/azure-aks | ||
``` | ||
|
||
3. Login to your Azure account using Azure CLI | ||
```bash | ||
az login | ||
``` | ||
|
||
4. Initialize the project, this will download the necessary plugins and providers for the project | ||
```bash | ||
tofu init | ||
``` | ||
|
||
5. Deploy the project | ||
```bash | ||
tofu apply | ||
``` | ||
|
||
6. Configure kubectl to connect to the AKS cluster | ||
```bash | ||
az aks get-credentials --resource-group $(tofu output -raw resource_group_name) --name $(tofu output -raw aks_cluster_name) | ||
|
||
# check context | ||
kubectl config get-contexts | ||
``` | ||
|
||
7. Access Kubernetes Dashboard | ||
```bash | ||
az aks browse --resource-group $(tofu output -raw resource_group_name) --name $(tofu output -raw aks_cluster_name) | ||
``` | ||
|
||
8. Install Ingress Nginx | ||
|
||
Here is the [recommended way](https://kubernetes.github.io/ingress-nginx/deploy/#azure) to install Ingress Nginx on AKS: | ||
```bash | ||
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.11.1/deploy/static/provider/cloud/deploy.yaml | ||
``` | ||
|
||
9. Configure your domain | ||
|
||
You should add a DNS record to your domain to point to the IP address of the Ingress Nginx controller. You can find the IP address by running: | ||
```bash | ||
kubectl get svc -n ingress-nginx | ||
``` | ||
If you are using Cloudflare, you can follow the instructions [here](https://developers.cloudflare.com/dns/manage-dns-records/how-to/create-dns-records). | ||
|
||
10. deploy OneBusAway server | ||
|
||
Modify the `onebusaway/values.yaml` file to configure the application. You can find the parameters meaning in [onebusaway-docker](https://github.com/OneBusAway/onebusaway-docker/#deployment-parameters). | ||
You can use this command to deploy the application: | ||
```bash | ||
helm install onebusaway ../../charts/onebusaway | ||
``` | ||
Then you can check the status of the deployment by running: | ||
```bash | ||
kubectl get pods -n oba | ||
``` | ||
|
||
11. Access the OneBusAway server | ||
|
||
You can access the OneBusAway server by visiting the domain you configured in step 9. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
variable "location" { | ||
description = "The location where the resources will be created." | ||
default = "East US" | ||
type = string | ||
} | ||
|
||
variable "resource_group_name" { | ||
description = "The name of the resource group" | ||
default = "aks-rg" | ||
type = string | ||
} | ||
|
||
variable "aks_cluster_name" { | ||
description = "The name of the AKS cluster." | ||
default = "aks-cluster" | ||
type = string | ||
} | ||
|
||
variable "dns_prefix" { | ||
description = "The DNS prefix for the AKS cluster." | ||
default = "aks" | ||
type = string | ||
} | ||
|
||
variable "tags" { | ||
description = "Tags to apply to resources" | ||
type = map(string) | ||
default = { | ||
environment = "dev" | ||
} | ||
} |