This Terraform configuration creates a kubernetes pod and service in the namespace.
export ARM_SUBSCRIPTION_ID="x"
export ARM_TENANT_ID="x"
export ARM_CLIENT_ID="x"
export ARM_CLIENT_SECRET="x"
export TF_VAR_client_id=${ARM_CLIENT_ID}
export TF_VAR_client_secret=${ARM_CLIENT_SECRET}
Run Terraform init, plan and apply
*Creating storage container to store Terraform state
az storage container create -n tfstate --account-name x --account-key x
terraform init -backend-config="storage_account_name=x" -backend-config="container_name=tfstate" -backend-config="access_key=x" -backend-config="key=codelab.microsoft.tfstate"
terraform validate
terraform plan -out out.plan
terraform apply out.plan
Creating a kubernetes service of Type=LoadBalancer
might take upwards of 3-5 mins since
Azure is creating a load balancer in the background and Terraform will wait for the
load balancer to be available.
Check whether pod, service, and namespace is created successfully
kubectl get pods,services,namespace