@@ -36,13 +36,13 @@ az network vnet subnet create \
36
36
--address-prefixes 192.168.2.0/24
37
37
38
38
# Crear un service principal
39
- az ad sp create-for-rbac --skip-assignment
40
- SP_ID= " a53cffe7-cb13-40d5-aefd-e36c5569869c "
41
- SP_PASSWORD= " qqbZ0z3l2Zac104_wvh0HBj_-KyTzFeVO~ "
39
+ az ad sp create-for-rbac --name kubelet-demo > auth.json
40
+ CLIENT_ID= $( jq -r ' .appId ' auth.json )
41
+ PASSWORD= $( jq -r ' .password ' auth.json )
42
42
43
43
# Asignamos permisos a la red virtual para que el cluster pueda gestionarla
44
44
VNET_ID=$( az network vnet show --resource-group $RESOURCE_GROUP --name $AKS_VNET --query id -o tsv)
45
- az role assignment create --assignee $SP_ID --scope $VNET_ID --role Contributor
45
+ az role assignment create --assignee $CLIENT_ID --scope $VNET_ID --role Contributor
46
46
47
47
# Obtenemos el ID de la subnet donde va a ir el cluster de AKS
48
48
SUBNET_ID=$( az network vnet subnet show --resource-group $RESOURCE_GROUP --vnet-name $AKS_VNET --name $AKS_SUBNET --query id -o tsv)
@@ -53,12 +53,9 @@ az aks create \
53
53
--name $AKS_NAME \
54
54
--node-count 1 \
55
55
--network-plugin azure \
56
- --service-cidr 10.0.0.0/16 \
57
- --dns-service-ip 10.0.0.10 \
58
- --docker-bridge-address 172.17.0.1/16 \
59
56
--vnet-subnet-id $SUBNET_ID \
60
- --service-principal $SP_ID \
61
- --client-secret $SP_PASSWORD
57
+ --service-principal $CLIENT_ID \
58
+ --client-secret $PASSWORD
62
59
63
60
# Recuperar el contexto para este clúster
64
61
az aks get-credentials -n $AKS_NAME -g $RESOURCE_GROUP
0 commit comments