Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/admin/deploy/kubernetes/operations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -288,17 +288,17 @@ The following instructions apply only if you are restoring your databases into a

If you are restoring a previously running environment, see the instructions for [restoring a previously running deployment](#restoring-sourcegraph-databases-into-an-existing-environment)

A. Copy the database dump files (eg. `sourcegraph_db.out`, `codeintel_db.out` and `codeinsights_db.out`) into the root of the `deploy-sourcegraph` directory
A. Copy the database dump files (eg. `sourcegraph_db.out`, `codeintel_db.out` and `codeinsights_db.out`) into your deployment directory

B. Start the database services by running the following command from the root of the [deploy-sourcegraph](https://github.com/sourcegraph/deploy-sourcegraph) directory
B. Start the database services by running the following command from your deployment directory:

```bash
$ kubectl rollout restart deployment pgsql
$ kubectl rollout restart deployment codeintel-db
$ kubectl rollout restart deployment codeinsights-db
```

C. Copy the database files into the pods by running the following command from the root of the [deploy-sourcegraph](https://github.com/sourcegraph/deploy-sourcegraph) directory
C. Copy the database files into the pods by running the following commands:

```bash
$ kubectl cp sourcegraph_db.out $NAMESPACE/$pgsql_POD_NAME:/tmp/sourcegraph_db.out
Expand Down Expand Up @@ -355,7 +355,7 @@ $ kubectl delete pv $codeintel-db_PV_NAME --force
$ kubectl delete pv $codeinsights-db_PV_NAME --force
```

C. Copy the database dump files (eg. `sourcegraph_db.out`, `codeintel_db.out` and `codeinsights_db.out`) into the root of the `deploy-sourcegraph` directory
C. Copy the database dump files (eg. `sourcegraph_db.out`, `codeintel_db.out` and `codeinsights_db.out`) into your deployment directory

D. Start the database services only

Expand All @@ -365,7 +365,7 @@ $ kubectl rollout restart deployment codeintel-db
$ kubectl rollout restart deployment codeinsights-db
```

E. Copy the database files into the pods by running the following command from the root of the [deploy-sourcegraph](https://github.com/sourcegraph/deploy-sourcegraph) directory
E. Copy the database files into the pods by running the following commands:

```bash
$ kubectl cp sourcegraph_db.out $NAMESPACE/$pgsql_POD_NAME:/tmp/sourcegraph_db.out
Expand Down
2 changes: 1 addition & 1 deletion docs/admin/deploy/kubernetes/troubleshoot.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Run `kubectl get ingresses -A` to check if there is more than one ingress for `s

#### Error: error when creating "base/cadvisor/cadvisor.ClusterRoleBinding.yaml": subjects[0].namespace: Required value

Add `namespace: default` to the [base/cadvisor/cadvisor.ClusterRoleBinding.yaml](https://github.com/sourcegraph/deploy-sourcegraph/blob/master/base/cadvisor/cadvisor.ClusterRoleBinding.yaml) file under `subjects`.
This error occurs when using legacy deployment manifests. For modern deployments using deploy-sourcegraph-k8s, cadvisor is configured as a DaemonSet with a ServiceAccount and doesn't require a ClusterRoleBinding. If you encounter this error, ensure you're using the latest [deploy-sourcegraph-k8s](https://github.com/sourcegraph/deploy-sourcegraph-k8s) repository.


#### Multiple pods are stuck in Pending.
Expand Down
56 changes: 1 addition & 55 deletions docs/admin/deploy/kubernetes/upgrade.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -76,47 +76,7 @@ Apply the new manifests from the ouput file `cluster.yaml` to your cluster:

---

### Upgrade with Legacy Kubernetes

The following procedure is for performing a **standard upgrade** with Sourcegraph instances in versions **prior to `v4.5.0`**, or which **have not** [**migrated**](/admin/deploy/kubernetes/kustomize/migrate) and still use [deploy-sourcegraph](https://github.com/sourcegraph/deploy-sourcegraph).

**Step 1**: Merge the new version of Sourcegraph into your release branch.

```sh
cd $DEPLOY_SOURCEGRAPH_FORK
# get updates
git fetch upstream
# to merge the upstream release tag into your release branch.
git checkout release
# Choose which version you want to deploy from https://github.com/sourcegraph/deploy-sourcegraph/tags
git merge $NEW_VERSION
```

---

**Step 2**: Update your install script `kubectl-apply-all.sh`

By default, the install script `kubectl-apply-all.sh` applies our base manifests using [`kubectl apply` command](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#apply) with a variety of arguments specific to the layout of the [deploy-sourcegraph reference repository](https://github.com/sourcegraph/deploy-sourcegraph).

If you have specific commands that should be run whenever you apply your manifests, you should modify this script accordingly.

For example, if you use [overlays to make changes to the manifests](https://github.com/sourcegraph/deploy-sourcegraph/tree/master/overlays), you should modify this script to apply the manifests from the `generated cluster` directory instead.

---

**Step 3**: Apply the updates to your cluster.

```sh
$ ./kubectl-apply-all.sh
```

**Step 4**: Monitor the status of the deployment to determine its success.

```sh
$ kubectl get pods -o wide --watch
```

---

## Multi-version upgrades

Expand All @@ -129,7 +89,7 @@ To perform a multi-version upgrade via migrators [upgrade](/admin/updates/migrat
- Check the `Site Admin > Updates` page to determine [upgrade readiness](/admin/updates/#upgrade-readiness).

2. **Pull and merge upstream changes**:
- Follow the [standard legacy upgrade procedure](#upgrade-with-legacy-kubernetes) to pull and merge upstream changes from the version you are upgrading to to your `release` branch.
- Follow the [standard upgrade procedure](#upgrade-with-kubernetes-kustomize) to pull and merge upstream changes from the version you are upgrading to to your `release` branch.

3. **Update cluster.yaml and scale down non-database deployments and replicas**:
- In your cluster kustomization file (`instances/my-sourcegraph/kustomize.yaml`), uncomment the [multi-version-upgrade util](https://github.com/sourcegraph/deploy-sourcegraph-k8s/blob/main/instances/template/kustomization.template.yaml#L155). This will scale down all non-database deployments and statefulSets replicas to 0.
Expand Down Expand Up @@ -236,10 +196,6 @@ If you are rolling back more than a single version, then you must also [rollback

### Rollback with Kustomize

**For Sourcegraph version 4.5.0 and above, which have [migrated](/admin/deploy/kubernetes/kustomize/migrate) to [deploy-sourcegraph-k8s](https://github.com/sourcegraph/deploy-sourcegraph-k8s).**

For instances deployed using the [deploy-sourcegraph-k8s](https://github.com/sourcegraph/deploy-sourcegraph-k8s) repository:

```sh
# Re-generate manifests
kubectl kustomize instances/$YOUR_INSTANCE -o cluster-rollback.yaml
Expand All @@ -249,16 +205,6 @@ For instances deployed using the [deploy-sourcegraph-k8s](https://github.com/sou
kubectl apply --prune -l deploy=sourcegraph -f cluster-rollback.yaml
```

### Rollback without Kustomize

**For Sourcegraph version prior to 4.5.0 using our legacy [deploy-sourcegraph](https://github.com/sourcegraph/deploy-sourcegraph) manifests.**

For instances deployed using the old [deploy-sourcegraph](https://github.com/sourcegraph/deploy-sourcegraph) repository:

```sh
$ ./kubectl-apply-all.sh
```

### Rollback with `migrator downgrade`

For rolling back a multiversion upgrade use the `migrator` [downgrade](/admin/updates/migrator/migrator-operations#downgrade) command. Learn mor in our [downgrade docs](/admin/updates/migrator/downgrading).
Expand Down
8 changes: 3 additions & 5 deletions docs/admin/faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,9 @@ Docker image, you can deploy a reverse proxy such as [Caddy](https://caddyserver

If you are running Sourcegraph as a Kubernetes cluster, you have two additional options:

1. If you are using [NGINX
ingress](https://github.com/sourcegraph/deploy-sourcegraph/blob/master/docs/configure#ingress-controller)
(`kubectl get ingress | grep sourcegraph-frontend`), modify
[`sourcegraph-frontend.Ingress.yaml`](https://github.com/sourcegraph/deploy-sourcegraph/blob/master/base/frontend/sourcegraph-frontend.Ingress.yaml)
by [adding a rewrite rule](https://kubernetes.github.io/ingress-nginx/examples/rewrite/).
1. If you are using NGINX ingress (`kubectl get ingress | grep sourcegraph-frontend`), modify
[`sourcegraph-frontend.Ingress.yaml`](https://github.com/sourcegraph/deploy-sourcegraph-k8s/blob/main/base/sourcegraph/frontend/sourcegraph-frontend.Ingress.yaml)
by [adding a rewrite rule](https://kubernetes.github.io/ingress-nginx/examples/rewrite/). You can also refer to the [ingress configuration examples](https://github.com/sourcegraph/deploy-sourcegraph-k8s/tree/main/examples/ingress-controller).

## What external HTTP checks are configured?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ precise-code-intel-worker-9b69b5b59-z7xx4 0/1 CrashLoopBackOff 415

`kubectl get pods -o wide`

3. If MinIO is not deployed, create a fork of the [deploy-sourcegraph](https://github.com/sourcegraph/deploy-sourcegraph) repository and make sure you deploy MinIO (or blobstore in 3.4.2+).


3. If blobstore is not deployed, make sure you include the blobstore components in your Sourcegraph deployment. For modern Sourcegraph versions (3.4.2+), blobstore replaces MinIO.

## Further resources

* [Sourcegraph - Kubernetes Configuration](/admin/deploy/kubernetes/configure)
* [Deploy Sourcegraph - blobstore](https://github.com/sourcegraph/deploy-sourcegraph/tree/master/base/blobstore)
* [Deploy Sourcegraph K8s - blobstore](https://github.com/sourcegraph/deploy-sourcegraph-k8s/tree/main/base/sourcegraph/blobstore)
Loading