Sourcegraph with Kubernetes on Azure
WARNING: This guide applies exclusively to a Kubernetes deployment without Helm. If you have not deployed Sourcegraph yet, it is highly recommended to use Helm as it simplifies the configuration and greatly simplifies the later upgrade process. See our guidance on using Helm to deploy to Azure AKS.
Install the Azure CLI tool and log in:
SHELLaz login
Sourcegraph on Kubernetes requires at least 16 cores in the DSv3 family in the Azure location of your choice (e.g. eastus
), so make sure you have enough available (if not, request a quota increase):
SHELL$ az vm list-usage -l eastus -o table Name CurrentValue Limit -------------------------------- -------------- ------- ... Standard DSv3 Family vCPUs 0 32 ...
Ensure that these Azure service providers are enabled:
SHELLaz provider register -n Microsoft.Network az provider register -n Microsoft.Storage az provider register -n Microsoft.Compute az provider register -n Microsoft.ContainerService
Create a resource group:
SHELLaz group create --name sourcegraphResourceGroup --location eastus
Create a cluster:
SHELLaz aks create --resource-group sourcegraphResourceGroup --name sourcegraphCluster --node-count 1 --generate-ssh-keys --node-vm-size Standard_D16s_v3
Connect to the cluster for future kubectl
commands:
SHELLaz aks get-credentials --resource-group sourcegraphResourceGroup --name sourcegraphCluster
Follow the Sourcegraph cluster installation instructions with storageClass
set to managed-premium
in config.json
:
DIFF- "storageClass": "default" + "storageClass": "managed-premium"
You can see if the pods are ready and check for installation problems through the Kubernetes dashboard:
SHELLaz aks browse --resource-group sourcegraphResourceGroup --name sourcegraphCluster
Set up a load balancer to make the main web server accessible over the network to external users:
SHELLkubectl expose deployment sourcegraph-frontend --type=LoadBalancer --name=sourcegraph-load-balancer --port=80 --target-port=3080