@@ -8,44 +8,41 @@ ms.author: ariaamini
88ms.custom : innovation-engine, linux-related-content
99---
1010
11- ## Provision Resources ( ~ 10 minutes)
12- Run terraform to provision all the required Azure resources
11+ ## Provision Resources with Terraform ( ~ 8 minutes)
12+ Run terraform to provision all the Azure resources required to setup your new OpenAI website.
1313``` bash
14- # Terraform parses TF_VAR_* (Ex: TF_VAR_xname -> xname )
14+ # Terraform parses TF_VAR_* as vars (Ex: TF_VAR_name -> name )
1515export TF_VAR_location=" westus3"
1616export TF_VAR_kubernetes_version=" 1.30.7"
1717export TF_VAR_model_name=" gpt-4o-mini"
1818export TF_VAR_model_version=" 2024-07-18"
19-
20- terraform -chdir=infra init
21- terraform -chdir=infra apply -auto-approve
19+ # Terraform consumes sub id as $ARM_SUBSCRIPTION_ID
20+ export ARM_SUBSCRIPTION_ID=$SUBSCRIPTION_ID
21+ # Run Terraform
22+ terraform -chdir=terraform init
23+ terraform -chdir=terraform apply -auto-approve
2224```
2325
2426## Login to Cluster
27+ In order to use the kubectl to run commands on the newly created cluster, you must first login.
2528``` bash
26- RESOURCE_GROUP=$( terraform -chdir=infra output -raw resource_group_name)
29+ RESOURCE_GROUP=$( terraform -chdir=terraform output -raw resource_group_name)
2730az aks get-credentials --admin --name AksCluster --resource-group $RESOURCE_GROUP --subscription $SUBSCRIPTION_ID
2831```
2932
3033## Deploy
34+ Apply/Deploy Manifest File
3135``` bash
32- # # Build Dockerfile
33- ACR_LOGIN_URL=$( terraform -chdir=infra output -raw acr_login_url)
34- IMAGE=" $ACR_LOGIN_URL /magic8ball:v1"
35- az acr login --name $ACR_LOGIN_URL
36- docker build -t $IMAGE ./magic8ball --push
37-
38- # Apply Manifest File
39- export IMAGE
40- export WORKLOAD_IDENTITY_CLIENT_ID=$( terraform -chdir=infra output -raw workload_identity_client_id)
41- export AZURE_OPENAI_DEPLOYMENT=$( terraform -chdir=infra output -raw openai_deployment)
42- export AZURE_OPENAI_ENDPOINT=$( terraform -chdir=infra output -raw openai_endpoint)
43- envsubst < quickstart-app.yml | kubectl apply -f -` ` `
36+ export IMAGE=" aamini8/magic8ball:v1"
37+ export WORKLOAD_IDENTITY_CLIENT_ID=$( terraform -chdir=terraform output -raw workload_identity_client_id)
38+ export AZURE_OPENAI_DEPLOYMENT=$( terraform -chdir=terraform output -raw openai_deployment)
39+ export AZURE_OPENAI_ENDPOINT=$( terraform -chdir=terraform output -raw openai_endpoint)
40+ envsubst < quickstart-app.yml | kubectl apply -f -
4441```
4542
4643## Wait for public IP
4744``` bash
48- kubectl wait --for=jsonpath=" {.status.loadBalancer.ingress[0].ip}" service/magic8ball-service
49- PUBLIC_IP=$( kubectl get service/magic8ball-service -o=jsonpath=" {.status.loadBalancer.ingress[0].ip}" )
45+ kubectl wait --for=jsonpath=" {.status.loadBalancer.ingress[0].ip}" service/magic8ball
46+ PUBLIC_IP=$( kubectl get service/magic8ball -o=jsonpath=" {.status.loadBalancer.ingress[0].ip}" )
5047echo " Connect to app: $PUBLIC_IP "
5148```
0 commit comments