Sourcegraph with Kubernetes

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

Requirements for using Kubernetes

Our Kubernetes support has the following requirements:

  • Sourcegraph Enterprise license. You can run through these instructions without one, but you must obtain a license for instances of more than 10 users
  • Minimum Kubernetes version: v1.19 and kubectl v1.19 or later (check kubectl docs for backward and forward compatibility with Kubernetes versions)
  • Support for Persistent Volumes (SSDs recommended)

We also recommend some familiarity with the following Kubernetes concepts before proceeding:

Not sure if Kubernetes is the right choice for you? Learn more about the various Sourcegraph installation options.

Installation

Before starting, we recommend reading the configuration guide, ensuring you have prepared the items below so that you're ready to start your installation:

Once you are all set up, either install Sourcegraph directly or deploy Sourcegraph to a cloud of your choice.

Reference repository

Sourcegraph for Kubernetes is configured using our sourcegraph/deploy-sourcegraph reference repository. This repository contains everything you need to spin up and configure a Sourcegraph deployment on Kubernetes.

Direct installation

  • After meeting all the requirements, make sure you can access your cluster with kubectl.

  • cd to the forked local copy of the deploy-sourcegraph repository previously set up during configuration.

  • Deploy the desired version of Sourcegraph to your cluster by applying the Kubernetes manifests:

    ./kubectl-apply-all.sh
    
  • Monitor the status of the deployment:

    kubectl get pods -o wide --watch
    
  • After deployment is completed, verify Sourcegraph is running by temporarily making the frontend port accessible:

    kubectl port-forward svc/sourcegraph-frontend 3080:30080
    
  • Open http://localhost:3080 in your browser and you will see a setup page. Congratulations, you have Sourcegraph up and running! 🎉

Cloud installation

Follow the instructions linked in the table below to provision a Kubernetes cluster for the infrastructure provider of your choice, using the recommended node and list types in the table.

Provider Node type Boot/ephemeral disk size
Amazon EKS (better than plain EC2) m5.4xlarge 100 GB (SSD preferred)
AWS EC2 m5.4xlarge 100 GB (SSD preferred)
Google Kubernetes Engine (GKE) n1-standard-16 100 GB (default)
Azure D16 v3 100 GB (SSD preferred)
Other 16 vCPU, 60 GiB memory per node 100 GB (SSD preferred)

ARM / ARM64 support