Skip to content

Commit 2ba88b2

Browse files
authored
better configure storage class docs (sourcegraph#194)
1 parent b86cccc commit 2ba88b2

File tree

1 file changed

+76
-67
lines changed

1 file changed

+76
-67
lines changed

docs/configure.md

Lines changed: 76 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -126,22 +126,22 @@ Add a network rule that allows ingress traffic to port 30080 (HTTP) on at least
126126

127127
1. Change the type of the `sourcegraph-frontend` service in [base/frontend/sourcegraph-frontend.Service.yaml](../base/frontend/sourcegraph-frontend.Service.yaml) from `ClusterIP` to `NodePort`:
128128

129-
```diff
130-
spec:
131-
ports:
132-
- name: http
133-
port: 30080
134-
+ nodePort: 30080
135-
- type: ClusterIP
136-
+ type: NodePort
137-
```
138-
129+
```diff
130+
spec:
131+
ports:
132+
- name: http
133+
port: 30080
134+
+ nodePort: 30080
135+
- type: ClusterIP
136+
+ type: NodePort
137+
```
138+
139139
1. Directly applying this change to the service [will fail](https://github.com/kubernetes/kubernetes/issues/42282). Instead, you must delete the old service and then create the new one (this will result in a few seconds of downtime):
140140

141-
```shell
142-
kubectl delete svc sourcegraph-frontend
143-
kubectl apply -f base/frontend/sourcegraph-frontend.Service.yaml
144-
```
141+
```shell
142+
kubectl delete svc sourcegraph-frontend
143+
kubectl apply -f base/frontend/sourcegraph-frontend.Service.yaml
144+
```
145145

146146
1. Find a node name.
147147

@@ -196,9 +196,9 @@ For the impatient, site configuration changes can be applied immediately by chan
196196
197197
If you intend to make your Sourcegraph instance accessible on the Internet or another untrusted network, you should use TLS so that all traffic will be served over HTTPS.
198198
199-
### Ingress controller
199+
### Ingress controller
200200
201-
If you exposed your Sourcegraph instance via an ingress controller as described in ["Ingress controller (recommended)"](#ingress-controller-recommended):
201+
If you exposed your Sourcegraph instance via an ingress controller as described in ["Ingress controller (recommended)"](#ingress-controller-recommended):
202202
203203
1. Create a [TLS secret](https://kubernetes.io/docs/concepts/configuration/secret/) that contains your TLS certificate and private key.
204204
@@ -218,7 +218,7 @@ If you exposed your Sourcegraph instance via an ingress controller as described
218218
# base/frontend/sourcegraph-frontend.Ingress.yaml
219219
tls:
220220
- hosts:
221-
- example.sourcegraph.com
221+
- example.sourcegraph.com
222222
secretName: sourcegraph-tls
223223
```
224224
@@ -246,7 +246,7 @@ private **and** you are okay with storing secrets in it).
246246
247247
### NGINX service
248248
249-
If you exposed your Sourcegraph instance via the altenative nginx service as described in ["nginx service"](#nginx-service), those instructions already walked you through setting up TLS/SSL.
249+
If you exposed your Sourcegraph instance via the altenative nginx service as described in ["nginx service"](#nginx-service), those instructions already walked you through setting up TLS/SSL.
250250
251251
## Configure repository cloning via SSH
252252
@@ -393,67 +393,76 @@ See [the official documentation](https://kubernetes.io/docs/concepts/configurati
393393
394394
## Configure a storage class
395395
396-
Sourcegraph expects there to be storage class named `sourcegraph` that it uses for all its persistent volume claims. This storage class must be configured before applying the base configuration to your cluster. The configuration details differ depending on your hosting provider, so you should:
397-
398-
1. Create a stub `base/sourcegraph.StorageClass.yaml`.
396+
Sourcegraph expects there to be storage class named `sourcegraph` that it uses for all its persistent volume claims. This storage class must be configured before applying the base configuration to your cluster.
399397
400-
```yaml
401-
# base/sourcegraph.StorageClass.yaml
402-
kind: StorageClass
403-
apiVersion: storage.k8s.io/v1
404-
metadata:
405-
name: sourcegraph
406-
labels:
407-
deploy: sourcegraph
408-
#
409-
# The values of the "provisioner" and "parameters" fields will differ depending on the cloud provider that you are using. Please read through https://kubernetes.io/docs/concepts/storage/storage-classes/ in order to know what values to add. 🚨 We recommend specifying SSDs as the disk type if possible. 🚨
410-
#
411-
# For example, if you are using GKE with a cluster whose nodes are all in the "us-central1-a" zone, you could use the following values:
412-
#
413-
# provisioner: kubernetes.io/gce-pd
414-
# parameters:
415-
# type: pd-ssd
416-
# zones: us-central1-a
417-
```
398+
Create `base/sourcegraph.StorageClass.yaml` with the appropriate configuration for your cloud provider and commit the file to your fork.
418399
419-
1. Read through the [Kubernetes storage class documentation](https://kubernetes.io/docs/concepts/storage/storage-classes/), and fill in the `provisioner` and `parameters` fields in `base/sourcegraph.StorageClass.yaml` with the correct values for your hosting provider (e.x.: [GCP](https://kubernetes.io/docs/concepts/storage/storage-classes/#gce-pd), [AWS](https://kubernetes.io/docs/concepts/storage/storage-classes/#aws), [Azure](https://kubernetes.io/docs/concepts/storage/storage-classes/#azure-disk)).
400+
### Google Cloud Platform (GCP)
420401
421-
- Note that if you're using GCP with Kubernetes `v1.9.*`, you should omit the `replication-type` parameter mentioned in [the documentation](https://kubernetes.io/docs/concepts/storage/storage-classes/#gce-pd) from your `base/sourcegraph.StorageClass.yaml` file. That field wasn't added until Kubernetes `v.1.10.*+`, and you'll see errors like the following if you try to use it with an older version:
402+
```yaml
403+
# base/sourcegraph.StorageClass.yaml
404+
kind: StorageClass
405+
apiVersion: storage.k8s.io/v1
406+
metadata:
407+
name: sourcegraph
408+
labels:
409+
deploy: sourcegraph
410+
provisioner: kubernetes.io/gce-pd
411+
parameters:
412+
type: pd-ssd # This configures SSDs (recommended).
413+
```
422414
423-
```
424-
Failed to provision volume with StorageClass "sourcegraph": invalid option "replication-type" for volume plugin kubernetes.io/gce-pd
425-
```
415+
[Additional documentation](https://kubernetes.io/docs/concepts/storage/storage-classes/#gce-pd).
426416
427-
- **We highly recommend that the storage class use SSDs as the underlying disk type.** Using the snippets below will create a storage class backed by SSDs:
417+
### Amazon Web Services (AWS)
428418
429-
- [GCP](https://kubernetes.io/docs/concepts/storage/storage-classes/#gce-pd):
419+
```yaml
420+
# base/sourcegraph.StorageClass.yaml
421+
kind: StorageClass
422+
apiVersion: storage.k8s.io/v1
423+
metadata:
424+
name: sourcegraph
425+
labels:
426+
deploy: sourcegraph
427+
provisioner: kubernetes.io/aws-ebs
428+
parameters:
429+
type: gp2 # This configures SSDs (recommended).
430+
```
430431
431-
```yaml
432-
# base/sourcegraph.StorageClass.yaml
433-
provisioner: kubernetes.io/gce-pd
434-
parameters:
435-
type: pd-ssd
436-
```
432+
[Additional documentation](https://kubernetes.io/docs/concepts/storage/storage-classes/#aws-ebs).
437433
438-
- [AWS](https://kubernetes.io/docs/concepts/storage/storage-classes/#aws):
434+
### Azure
439435
440-
```yaml
441-
# base/sourcegraph.StorageClass.yaml
442-
provisioner: kubernetes.io/aws-ebs
443-
parameters:
444-
type: gp2
445-
```
436+
```yaml
437+
# base/sourcegraph.StorageClass.yaml
438+
kind: StorageClass
439+
apiVersion: storage.k8s.io/v1
440+
metadata:
441+
name: sourcegraph
442+
labels:
443+
deploy: sourcegraph
444+
provisioner: kubernetes.io/azure-disk
445+
parameters:
446+
storageaccounttype: Premium_LRS # This configures SSDs (recommended). A Premium VM is required.
447+
```
446448
447-
- [Azure](https://kubernetes.io/docs/concepts/storage/storage-classes/#azure-disk):
449+
[Additional documentation](https://kubernetes.io/docs/concepts/storage/storage-classes/#azure-disk).
448450
449-
```yaml
450-
# base/sourcegraph.StorageClass.yaml
451-
provisioner: kubernetes.io/azure-disk
452-
parameters:
453-
storageaccounttype: Premium_LRS
454-
```
451+
### Other cloud providers
455452
456-
1. Commit `base/sourcegraph.StorageClass.yaml` to your fork.
453+
```yaml
454+
# base/sourcegraph.StorageClass.yaml
455+
kind: StorageClass
456+
apiVersion: storage.k8s.io/v1
457+
metadata:
458+
name: sourcegraph
459+
labels:
460+
deploy: sourcegraph
461+
# Read https://kubernetes.io/docs/concepts/storage/storage-classes/ to configure the "provisioner" and "parameters" fields for your cloud provider.
462+
# SSDs are highly recommended!
463+
# provisioner:
464+
# parameters:
465+
```
457466
458467
### Using a storage class with an alternate name
459468

0 commit comments

Comments
 (0)