The following is a guide to setting up a local development environment for the executor within a Kubernetes cluster.
- Install kubectl
- Install Docker Desktop
- Enable Kubernetes in Docker Desktop
- Settings > Kubernetes > Enable Kubernetes
- Install MiniKube
- Start MiniKube
minikube start
- Load the images
minikube image load executor-kubernetes:latestminikube image load sourcegraph/batcheshelper:insiders
If you run codeintel, you may need to tinker with the EXECUTOR_KUBERNETES_RESOURCE_REQUEST_MEMORY
and EXECUTOR_MAXIMUM_NUM_JOBS to ensure that each Job has enough memory to run and that the node does not run out of
memory.
You can use sg to run Executors with either batches or codeintel.
sg start batches-kubernetessg start codeintel-kubernetesAny changes to Executor code will cause sg to rebuild the Executor image and restart the Executor pod.
To run Executors in Kubernetes you will need to build the executor-kubernetes image. If you are running Server Side
Batch Changes, you will also need to build the batcheshelper image.
Run the following command to build the executor image.
# Build the image in cmd/executor-kubernetes
IMAGE=executor-kubernetes ../../executor-kubernetes/build.shIf you are running Server Side Batch Changes, you will need to build the batches helper image.
IMAGE=sourcegraph/batcheshelper:insiders ../../batcheshelper/build.shThe frontend password should be stored in a Kubernetes secret. Run the following command to create the secret.
kubectl create secret generic executor-frontend-password --from-literal=EXECUTOR_FRONTEND_PASSWORD=hunter2hunter2hunter2Run the following command in either the batches or codeintel directory to deploy the executor.
kubectl apply -f .An executor pod should now be created. Confirm this by running the following command.
kubectl get podsYou should see an executor pod in the Running state.
You can also check the Site admin Page to see the registered executor.
Run the following command to delete the executor.
kubectl delete -f .