Install Sourcegraph with Kubernetes

Deploying Sourcegraph into a Kubernetes cluster is for organizations that need highly scalable and available code search and code intelligence.

The Kubernetes manifests for a Sourcegraph on Kubernetes installation are in the repository deploy-sourcegraph.

Requirements

Steps

   ./kubectl-apply-all.sh
  • Monitor the status of the deployment.
   watch kubectl get pods -o wide
  • Once the deployment completes, verify Sourcegraph is running by temporarily making the frontend port accessible:

kubectl 1.9.x:

   kubectl port-forward $(kubectl get pod -l app=sourcegraph-frontend -o template --template="{{(index .items 0).metadata.name}}") 3080

kubectl 1.10.0 or later:

   kubectl port-forward svc/sourcegraph-frontend 3080:30080

Open http://localhost:3080 in your browser and you will see a setup page. Congrats, you have Sourcegraph up and running!

Troubleshooting

See the Troubleshooting docs.

Updating

See the Upgrading Howto on how to upgrade. See the Upgrading docs for details on what changed in a version and if manual migration steps are necessary.

Cluster-admin privileges

Note: Not all organizations have this split in admin privileges. If your organization does not then you don’t need to change anything and can ignore this section.

The default installation has a few manifests that require cluster-admin privileges to apply. We have labelled all resources with a label indicating if they require cluster-admin privileges or not. This allows cluster admins to install the manifests that cannot be installed otherwise.

  • Manifests deployed by cluster-admin
   ./kubectl-apply-all.sh -l sourcegraph-resource-requires=cluster-admin
  • Manifests deployed by non-cluster-admin
   ./kubectl-apply-all.sh -l sourcegraph-resource-requires=no-cluster-admin

We also provide an overlay that generates a version of the manifests that does not require cluster-admin privileges.