-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Expand file tree
/
Copy pathdeploy-private-aks.sh
More file actions
64 lines (53 loc) · 1.76 KB
/
deploy-private-aks.sh
File metadata and controls
64 lines (53 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
#Define a set of environment variables to be used in resource creations.
#
#!/bin/bash
#Get Subscription ID and resource groups. It is used as default for controller, SQL Server Master instance (sa account) and Knox.
#
read -p "Your Azure Subscription: " subscription
echo
read -p "Your Resource Group Name: " resourcegroup
echo
read -p "In which region you're deploying: " region
echo
#Define a set of environment variables to be used in resource creations.
export SUBID=$subscription
export REGION_NAME=$region
export RESOURCE_GROUP=$resourcegroup
export KUBERNETES_VERSION=$version
export SUBNET_NAME=aks-subnet
export VNET_NAME=bdc-vnet
export AKS_NAME=bdcaksprivatecluster
#Set Azure subscription current in use
az account set --subscription $subscription
#Create Azure Resource Group
az group create -n $RESOURCE_GROUP -l $REGION_NAME
#Create Azure Virtual Network to host your AKS clus
az network vnet create \
--resource-group $RESOURCE_GROUP \
--location $REGION_NAME \
--name $VNET_NAME \
--address-prefixes 10.0.0.0/8 \
--subnet-name $SUBNET_NAME \
--subnet-prefix 10.1.0.0/16
SUBNET_ID=$(az network vnet subnet show \
--resource-group $RESOURCE_GROUP \
--vnet-name $VNET_NAME \
--name $SUBNET_NAME \
--query id -o tsv)
#Create AKS Cluster
az aks create \
--resource-group $RESOURCE_GROUP \
--name $AKS_NAME \
--load-balancer-sku standard \
--enable-private-cluster \
--kubernetes-version $version \
--network-plugin azure \
--vnet-subnet-id $SUBNET_ID \
--docker-bridge-address 172.17.0.1/16 \
--dns-service-ip 10.2.0.10 \
--service-cidr 10.2.0.0/24 \
--node-vm-size Standard_D13_v2 \
--node-count 2 \
--generate-ssh-keys
az aks get-credentials -g $RESOURCE_GROUP -n $AKS_NAME