Create new AKS cluster using OCLI
The following document shows how to create a new Azure EKS cluster using OCLI
Prerequisites
- Install git if not already present.
- Install azure cli >= 2.50.
- Log in and set a subscription. Please ensure that the user has
Contributor
andRBAC admin
roles in the Subscription
# login
az login
# setting the subscription
az account set --subscription $SUBSCRIPTION_ID
Suggestion
We highly recommend you to please go through the Azure Infrastructure requirementscarefully.
Installing OCLI
- Download the binary using the below command.
curl -H 'Cache-Control: max-age=0' -s "https://releases.ocli.truefoundry.tech/binaries/ocli_$(curl -H 'Cache-Control: max-age=0' -s https://releases.ocli.truefoundry.tech/stable.txt)_darwin_arm64" -o ocli
curl -H 'Cache-Control: max-age=0' -s "https://releases.ocli.truefoundry.tech/binaries/ocli_$(curl -H 'Cache-Control: max-age=0' -s https://releases.ocli.truefoundry.tech/stable.txt)_darwin_amd64" -o ocli
curl -H 'Cache-Control: max-age=0' -s "https://releases.ocli.truefoundry.tech/binaries/ocli_$(curl -H 'Cache-Control: max-age=0' -s https://releases.ocli.truefoundry.tech/stable.txt)_linux_arm64" -o ocli
curl -H 'Cache-Control: max-age=0' -s "https://releases.ocli.truefoundry.tech/binaries/ocli_$(curl -H 'Cache-Control: max-age=0' -s https://releases.ocli.truefoundry.tech/stable.txt)_linux_amd64" -o ocli
- Make the binary executable and move it to
$PATH
sudo chmod +x ./ocli sudo mv ocli /usr/local/bin
- Confirm by running the command
ocli --version
Configuring input config file
- To create a new cluster, you would require your Azure
Subscription
,Location
,Resource Group
. - Run the following command to fill in the inputs interactively
ocli init-compute-plane
- For networking, there are the following possible configurations:
- New resource group & network (Recommended) - This will create a new resource group and a new Virtual network.
- Existing resource group with existing network - You can use an existing resource group and an existing Virtual network.
- Existing resource group with new network - You can use an existing resource group while creating a new Virtual network
- Once all the inputs are filled, an input config file with the name
tfy-config.yaml
would be generated in your current directory. We highly recommend you to once go through the generated config file and tally your inputs. You can also customize the inputs directly by editing the file. Below is the sample for the same:
aws: null
azure:
cluster:
name: coolml
location: East US
network:
existing: true
subnet_cidr: ""
subnet_id: /subscriptions/xxxxx-xxxxx-xxxxx-xxxxxxxxx/resourceGroups/existingrg1/providers/Microsoft.Network/virtualNetworks/existingvnet1/subnets/existingvnet1-default-subnet
vnet_cidr: ""
vnet_id: /subscriptions/xxxxx-xxxxx-xxxxx-xxxxxxxxx/resourceGroups/existingrg1/providers/Microsoft.Network/virtualNetworks/existingvnet1
vnet_name: existingvnet1
resource_group:
existing: true
name: resourceGroup1
state:
container_name: ""
resource_group: ""
storage_account_name: ""
subscription:
id: xxxxx-xxxxx-xxxxx-xxxxxxxxx
name: subscription-name
binaries:
terraform:
binary_path: null
terragrunt:
binary_path: null
gcp: null
provider: azure
aws: null
azure:
cluster:
name: coolml
location: West US
network:
existing: false
subnet_cidr: 10.10.0.0/16
subnet_id: ""
vnet_cidr: 10.0.0.0/8
vnet_id: ""
vnet_name: ""
resource_group:
existing: true
name: existingrg1
state:
container_name: ""
resource_group: ""
storage_account_name: ""
subscription:
id: xxxxx-xxxxx-xxxxx-xxxxxxxxx
name: subscription-name
binaries:
terraform:
binary_path: null
terragrunt:
binary_path: null
gcp: null
provider: azure
aws: null
azure:
cluster:
name: coolml
location: West US
network:
existing: false
subnet_cidr: 10.10.0.0/16
subnet_id: ""
vnet_cidr: 10.0.0.0/8
vnet_id: ""
vnet_name: ""
resource_group:
existing: false
name: coolmlrg
state:
container_name: ""
resource_group: ""
storage_account_name: ""
subscription:
id: xxxxx-xxxxx-xxxxx-xxxxxxxxx
name: subscription-name
binaries:
terraform:
binary_path: null
terragrunt:
binary_path: null
gcp: null
provider: azure
Create the cluster
Run the following command to create the AKS cluster.
ocli run --file tfy-config.yaml
This command may take around 30-45 minutes to complete.
Connecting the cluster
- Head over to the TrueFoundry platform and log in. If you haven't logged in, then you can sign up here.
- Once you have logged in, navigate to
Integrations
tab from the left panel and click onSetup Cluster
. - Give the name of the EKS cluster and select the cluster type as
Azure AKS
. - Copy the resulting ocli command. This command installs the agent in your AKS cluster which will connect your cluster to the TrueFoundry control plane. The command looks similar to the following:
ocli connect-compute-plane --cloud azure-aks --control-plane-url https://coolml.truefoundry.tech \
--token xxxxxxx --tenant coolml
- Run the command from the current directory where your
tfy-config.yaml
is present.
Saving the output file
Once the above command finishes, save the output using the command below:
ocli output --file tfy-config.yaml > output.txt
Connect your cluster
Updated 12 days ago