<p>I'm trying to setup Azure Kubernetes Services with Terraform with the 'Azure Voting'-app.</p>
<p>I'm using the code mentioned below, however I keep getting the error on the Load Balancer: &quot;Internal Server Error&quot;. Any idea what is going wrong here?</p>
<p>Seems like the Load Balancer to Endpoint (POD) is configured correclt,y thus not sure what is missing here.</p>
<p><strong>main.tf</strong></p>
<pre><code>provider &quot;azurerm&quot; {
  features {}
}

data &quot;azurerm_kubernetes_cluster&quot; &quot;aks&quot; {
  name                = &quot;kubernetescluster&quot;
  resource_group_name = &quot;myResourceGroup&quot;
}

provider &quot;kubernetes&quot; {
  host = data.azurerm_kubernetes_cluster.aks.kube_config[0].host

  client_certificate     = base64decode(data.azurerm_kubernetes_cluster.aks.kube_config.0.client_certificate)
  client_key             = base64decode(data.azurerm_kubernetes_cluster.aks.kube_config.0.client_key)
  cluster_ca_certificate = base64decode(data.azurerm_kubernetes_cluster.aks.kube_config.0.cluster_ca_certificate)
}

resource &quot;kubernetes_namespace&quot; &quot;azurevote&quot; {
  metadata {
    annotations = {
      name = &quot;azurevote-annotation&quot;
    }

    labels = {
      mylabel = &quot;azurevote-value&quot;
    }

    name = &quot;azurevote&quot;
  }
}

resource &quot;kubernetes_service&quot; &quot;example&quot; {
  metadata {
    name = &quot;terraform-example&quot;
  }
  spec {
    selector = {
      app = kubernetes_pod.example.metadata.0.labels.app
    }
    session_affinity = &quot;ClientIP&quot;
    port {
      port        = 80
      target_port = 80
    }

    type = &quot;LoadBalancer&quot;
  }
}

resource &quot;kubernetes_pod&quot; &quot;example&quot; {
  metadata {
    name = &quot;terraform-example&quot;
    labels = {
      app = &quot;azure-vote-front&quot;
    }
  }

  spec {
    container {
        image = &quot;mcr.microsoft.com/azuredocs/azure-vote-front:v1&quot;
        name  = &quot;example&quot;
    }
  }
}
</code></pre>
<p><strong>variables.tf</strong></p>
<pre><code>variable &quot;prefix&quot; {
    type = string
    default = &quot;ab&quot;
    description = &quot;A prefix used for all resources in this example&quot;
}
</code></pre>

Jay
<p>It seems that your infrastructure setup is ok, the only thing is the application itself, you create only the front app, and you need to create the backend app to.</p>
<p>You can see the deployment examples <a href="https://github.com/Azure-Samples/azure-voting-app-redis/blob/master/azure-vote-all-in-one-redis.yaml" rel="nofollow noreferrer">here</a>.</p>
<p>You also can see <a href="https://github.com/Azure-Samples/azure-voting-app-redis/blob/0382ae322dfe5639b25a0e5ad94255119bc2ed0e/azure-vote/azure-vote/main.py#L41" rel="nofollow noreferrer">here</a> the exception when you run the frontend without the backend.</p>
