Skip to content

Commit

Permalink
Required to fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Thornton committed Mar 25, 2024
1 parent 6a99ad6 commit dc55adc
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 8 deletions.
14 changes: 14 additions & 0 deletions Terraform-AZURE-Services-Creation/AKS/rbac.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,17 @@ resource "azurerm_role_assignment" "appgwcontainernode" {
azurerm_user_assigned_identity.alb_identity
]
}

#fixing for "The client '62119122-6287-4620-98b4-bf86535e2ece' with object id '62119122-6287-4620-98b4-bf86535e2ece' does not have authorization to perform action 'Microsoft.ServiceNetworking/register/action' over scope '/subscriptions/XXXXX' or the scope is invalid. (As part of App Gw for containers - maanged by ALB controller setup)"
data "azurerm_subscription" "current" {
}

resource "azurerm_role_assignment" "appgwcontainer" {
principal_id = azurerm_user_assigned_identity.alb_identity.principal_id
scope = data.azurerm_subscription.current.subscription_id
role_definition_name = "Network Contributor"
depends_on = [
azurerm_kubernetes_cluster.k8s,
azurerm_user_assigned_identity.alb_identity
]
}
4 changes: 4 additions & 0 deletions kubernetes_manifest/alb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: alb-infra
40 changes: 32 additions & 8 deletions kubernetes_manifest/script/alb-controller-install-k8s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,37 @@
RESOURCE_GROUP="devopsthehardway-rg"
AKS_NAME="devopsthehardwayaks"
helm_resource_namespace="alb"
VNET_NAME="devopsthehardway-vnet"
ALB_SUBNET_NAME="appgw"

# create namespace
kubectl create namespace $helm_resource_namespace

# az aks get-credentials --resource-group $RESOURCE_GROUP --name $AKS_NAME
helm install alb-controller oci://mcr.microsoft.com/application-lb/charts/alb-controller \
--namespace $helm_resource_namespace \
--version 1.0.0 \
--set albController.namespace=$helm_resource_namespace \
--set albController.podIdentity.clientID=$(az identity show -g $RESOURCE_GROUP -n azure-alb-identity --query clientId -o tsv)
# kubectl create namespace $helm_resource_namespace

# # az aks get-credentials --resource-group $RESOURCE_GROUP --name $AKS_NAME
# helm install alb-controller oci://mcr.microsoft.com/application-lb/charts/alb-controller \
# --namespace $helm_resource_namespace \
# --version 1.0.0 \
# --set albController.namespace=$helm_resource_namespace \
# --set albController.podIdentity.clientID=$(az identity show -g $RESOURCE_GROUP -n azure-alb-identity --query clientId -o tsv)


ALB_SUBNET_ID=$(az network vnet subnet show --name $ALB_SUBNET_NAME --resource-group $RESOURCE_GROUP --vnet-name $VNET_NAME --query '[id]' --output tsv)

# Creates the namespace for alb-controller
kubectl apply -f - <<EOF
apiVersion: v1
kind: Namespace
metadata:
name: alb-infra
EOF

kubectl apply -f - <<EOF
apiVersion: alb.networking.azure.io/v1
kind: ApplicationLoadBalancer
metadata:
name: alb-devopshardway
namespace: alb-infra
spec:
associations:
- $ALB_SUBNET_ID
EOF

0 comments on commit dc55adc

Please sign in to comment.