> For the complete documentation index, see [llms.txt](https://ed.sunbird.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ed.sunbird.org/misc/archived/getting-started/install/provision-cloud-infrastructure.md).

# Provision Cloud Infrastructure

#### **Creating the AKS cluster from the Azure console**

> To create AKS cluster follow the steps given below to create the Kubernetes cluster in Azure. The AKS cluster and VM’s should be in same vnet. If they are in different vnet, you have to peer the vnets. To successfully peer, the IP address of the vnets should not overlap.

* Create a service principal and assign a contributor role to the service principal. Ref: <https://learn.microsoft.com/en-us/cli/azure/azure-cli-sp-tutorial-1?tabs=bash>
* Get the secrets and client ID of service principal
* Create the AKS cluster either via the Azure portal or using `az aks` command line
* Refer to Azure documentation for all the available options
* Below is a sample command that you can use&#x20;

```bash
  az aks create --resource-group <resouse-group-name> --node-resource-group <k8s-resource-group-name> --name <cluster name>  --node-count 5 --admin-username deployer --kubernetes-version 1.24 --service-principal "<service principal id>" --node-vm-size Standard_D4s_v3 --client-secret "<client id>" --network-plugin azure --ssh-key-value @deployer.pub -l <region> --vm-set-type VirtualMachineScaleSets --vnet-subnet-id /subscriptions/<subscription id>/resourceGroups/<resouse-group-name>/providers/Microsoft.Network/virtualNetworks/<vnet-name>/subnets/<subnet name>
```

> Note: Ensure you have allocated at least 1024 IPs for your Kubernetes subnet (CIDR notation as x.x.x.x/22)

Get the kubeconfig file for your cluster with the below command -

```bash
  az aks get-credentials --resource-group <resource group name> --name <cluster name> --file  k8s.yaml
```

#### Configuring the Azure storage account <a href="#configuring-the-azure-storage-account" id="configuring-the-azure-storage-account"></a>

* Update the CORS rule for the storage account as follows:

```bash
    Allowed Origins: *
    Allowed Methods: GET,HEAD,OPTIONS, PUT
    Allowed Headers: Access-Control-Allow-Origin,Access-Control-Allow-Method,Origin,x-ms-meta-qq,x-ms-blob-type,x-ms-blob-content-type,Content-Type
    Exposed Headers: Access-Control-Allow-Origin,Access-Control-Allow-Methods
    Max Age: 200

```

* Disable **Secure transfer required** in storage account configuration

#### **Provisioning infrastructure on other cloud service providers except Azure**

* Object storage with CORS enabled
* Virtual network to host VM's and Kubernetes cluster
* Kubernetes cluster with 5 worker nodes each node with 4 Core, 16GB RAM configuration
* Create Compute Instances/VM's as mentioned in pre-requisites section
* Make sure kubernetes cluster and VM's can communicate with each other


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ed.sunbird.org/misc/archived/getting-started/install/provision-cloud-infrastructure.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
