-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update K8s example #3493
Merged
Merged
Update K8s example #3493
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
fdcebda
Update example values to work with current Postgres chart version
tillprochaska 709e922
Add ingress class annotation to ensure the Nginx ingress doesn’t igno…
tillprochaska 544ef3f
Use ES Helm chart for ES 7
tillprochaska b2c3661
Mark secret key ref for `SENTRY_DSN` as optional
tillprochaska 545804c
Update K8s example
tillprochaska 69f80a7
Emphasize that selecting the correct kubectl context may be necessary
tillprochaska 62935a3
Update default ingest-file version in Helm chart
tillprochaska ee064a6
Add note on Docker Desktop memory resource limits
tillprochaska 18b81c2
Add note about `kubernetes.docker.internal` host
tillprochaska 259063f
Add upgrade instructions
tillprochaska f18f4e0
Simplify secrets setup
tillprochaska ed962f1
Document how to create a user, known issues
tillprochaska 139457b
Fix typo
tillprochaska 6c31295
Replace deprecated `kubernetes.io/ingress.class` annotation
tillprochaska 76a4111
Fix default ingest-file version in Helm chart (again…)
tillprochaska File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
charts/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
dependencies: | ||
- name: aleph | ||
repository: file://../../charts/aleph | ||
version: 3.15.4 | ||
- name: ingress-nginx | ||
repository: https://kubernetes.github.io/ingress-nginx | ||
version: 4.8.3 | ||
- name: postgresql | ||
repository: https://charts.bitnami.com/bitnami | ||
version: 12.10.1 | ||
- name: elasticsearch | ||
repository: https://helm.elastic.co | ||
version: 7.17.3 | ||
- name: minio | ||
repository: https://helm.min.io/ | ||
version: 8.0.10 | ||
- name: redis | ||
repository: https://charts.bitnami.com/bitnami | ||
version: 18.0.2 | ||
digest: sha256:cfaa9778a9da148217fe65d2bc9eebed248436f932e35b7ac9414321eb7e8f4d | ||
generated: "2023-11-10T12:47:21.424991+01:00" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
apiVersion: v2 | ||
type: application | ||
name: aleph-dev | ||
version: 0.1.0 | ||
dependencies: | ||
- name: aleph | ||
repository: file://../../charts/aleph | ||
version: 3.15.4 | ||
condition: aleph.enabled | ||
|
||
- name: ingress-nginx | ||
repository: https://kubernetes.github.io/ingress-nginx | ||
version: 4.8.3 | ||
|
||
- name: postgresql | ||
repository: https://charts.bitnami.com/bitnami | ||
version: v12.10.1 | ||
|
||
- name: elasticsearch | ||
alias: elasticsearch | ||
repository: https://helm.elastic.co | ||
version: v7.17.3 | ||
|
||
- name: minio | ||
repository: https://helm.min.io/ | ||
version: v8.0.10 | ||
|
||
- name: redis | ||
repository: https://charts.bitnami.com/bitnami | ||
version: v18.0.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# Kubernetes Development Environment | ||
|
||
The example in this directory shows how to install Aleph using Kubernetes on your development machine. | ||
|
||
## Prerequisites | ||
|
||
* You need to run a Kuberentes cluster on your development machine. A simple way to run a single-node Kubernetes cluster on Linux, macOS, and Windows is using Docker Desktop. Follow the steps outlined in the [Docker Desktop documentation](https://docs.docker.com/desktop/kubernetes/) to enable Kubernetes. | ||
|
||
* If you’re already using the `kubectl` CLI with other clusters, make sure to switch to the `docker-dekstop` context: | ||
|
||
``` | ||
kubectl config use-context docker-desktop | ||
``` | ||
|
||
* Running this example may require up to 8GB of memory, so make sure to [update the resource settings](https://docs.docker.com/desktop/settings/mac/#resources) in Docker Desktop if necessary. | ||
|
||
* You also need Helm, a tool for packaging Kubernetes resources. Please refer to the [Helm documentation](https://helm.sh/docs/intro/install/) for instructions on how to install Helm on your machine. | ||
|
||
## Installation | ||
|
||
Once you have installed Helm and have a Kubernetes cluster running on your machine, follow the following steps to install Aleph and dependent services in your cluster. | ||
|
||
### Create secrets | ||
|
||
Some sensitive configuration options should be stored using Kubernetes secrets. These configuration options are stored in files in the `secrets` directory. | ||
|
||
> [!IMPORTANT] | ||
> In a production setting, you have to encrypt the secret files, e.g. using [git-crypt](https://github.com/AGWA/git-crypt). Alternatively, you can configure an external service to retrieve secrets from. For more information, refer to [Secrets Best Practices](https://kubernetes.io/docs/concepts/security/secrets-good-practices/). | ||
|
||
Use the `kubectl` CLI to create `Secret` objects based on the files in the `secrets` directory: | ||
|
||
``` | ||
kubectl create secret generic aleph-secrets --from-file=./secrets/aleph | ||
kubectl create secret generic postgresql-secrets --from-file=./secrets/postgresql | ||
kubectl create secret generic minio-secrets --from-file=./secrets/minio | ||
``` | ||
|
||
### Install services | ||
|
||
Aleph depends on a number of services, including PostgreSQL and Elasticsearch. Installing Aleph before these services are available will cause errors. Run the following command to install all services required by Aleph, but not Aleph itself: | ||
|
||
``` | ||
helm install --dependency-update --set "aleph.enabled=false" aleph . | ||
``` | ||
|
||
This command downloads Helm charts for dependencies listed in the `Chart.yaml` file in this directory and installs everything in your local Kubernetes cluster, except for Aleph itself. | ||
|
||
Once you’ve run the command above, you can run `watch kubectl get pods` to observe how Kubernetes pods for the multiple services are started. Wait until everything is running and ready. | ||
|
||
### Install Aleph | ||
|
||
Next, run the following command to install Aleph: | ||
|
||
``` | ||
helm upgrade --set "aleph.enabled=true" aleph . | ||
``` | ||
|
||
This will create all Kubernetes resources for Aleph itself and runs SQL and Elasticsearch migrations. This may take a few minutes. | ||
|
||
### Open the Aleph UI | ||
|
||
Wait until all pods are running and ready, then open `http://kubernetes.docker.internal` in your web browser. You should see the Aleph homepage. | ||
|
||
> [!NOTE] | ||
> Usually Docker Desktop should automatically add an entry to `/etc/hosts` to resolve `kubernetes.docker.internal`. If `kubernetes.docker.internal` can’t be resolved, you may need to manually add an entry to `/etc/hosts`: | ||
> | ||
> ``` | ||
> 127.0.0.1 kubernetes.docker.internal | ||
> ``` | ||
|
||
## Upgrading | ||
|
||
In order to upgrade your installation after you’ve made changes to the Aleph Helm chart run: | ||
|
||
``` | ||
helm upgrade --set "aleph.enabled=true" --dependency-update aleph . | ||
``` | ||
|
||
## Creating a user | ||
|
||
Run the following command to open a shell inside of the Aleph API container: | ||
|
||
``` | ||
kubectl exec -it svc/aleph-api -- bash | ||
``` | ||
|
||
In order to create a new (admin) user run: | ||
|
||
``` | ||
aleph createuser --name "Test User" --password "12345678" --admin mail@example.org | ||
``` | ||
|
||
## Viewing and downloading files | ||
|
||
Because the MinIO endpoint is only accessible from within the cluster network, you won’t be able to preview or download files from the Aleph UI. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
postgresql://aleph:aleph@aleph-postgresql.default.svc/aleph |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
postgresql://aleph:aleph@aleph-postgresql.default.svc/aleph |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
admin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
aleph |
7 changes: 4 additions & 3 deletions
7
helm/examples/kind/k8s/ingress.dev.yaml → helm/examples/dev/templates/ingress.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
aleph: | ||
global: | ||
commonEnv: | ||
REDIS_URL: redis://aleph-redis-master.default.svc.cluster.local:6379/0 | ||
ARCHIVE_TYPE: s3 | ||
ARCHIVE_BUCKET: aleph-archive | ||
ARCHIVE_ENDPOINT_URL: http://aleph-minio.default.svc.cluster.local:9000 | ||
env: | ||
ALEPH_UI_URL: http://kubernetes.docker.internal/ | ||
ALEPH_ELASTICSEARCH_URI: http://aleph-index-master.default.svc.cluster.local:9200 | ||
|
||
ui: | ||
replicas: 1 | ||
|
||
api: | ||
hpa: | ||
minReplicas: 1 | ||
maxReplicas: 1 | ||
|
||
containerResources: | ||
requests: | ||
memory: 1000Mi | ||
limits: | ||
memory: 1000Mi | ||
|
||
ingestfile: | ||
hpa: | ||
minReplicas: 1 | ||
maxreplicas: 1 | ||
|
||
containerResources: | ||
requests: | ||
memory: 1000Mi | ||
limits: | ||
memory: 1000Mi | ||
|
||
worker: | ||
replicas: 1 | ||
|
||
containerResources: | ||
requests: | ||
cpu: 30m | ||
memory: 500Mi | ||
limits: | ||
memory: 500Mi | ||
|
||
postgresql: | ||
auth: | ||
database: aleph | ||
username: aleph | ||
existingSecret: postgresql-secrets | ||
secretKeys: | ||
adminPasswordKey: adminPassword | ||
userPasswordKey: userPassword | ||
|
||
resources: | ||
requests: | ||
memory: 500Mi | ||
limits: | ||
memory: 500Mi | ||
|
||
elasticsearch: | ||
clusterName: "aleph-index" | ||
|
||
replicas: 1 | ||
minimumMasterNodes: 1 | ||
|
||
image: "ghcr.io/alephdata/aleph-elasticsearch" | ||
imageTag: "3bb5dbed97cfdb9955324d11e5c623a5c5bbc410" | ||
imagePullPolicy: "IfNotPresent" | ||
|
||
esJavaOpts: "-Xmx2g -Xms2g" | ||
esConfig: | ||
elasticsearch.yml: | | ||
xpack: | ||
graph: | ||
enabled: "false" | ||
ml: | ||
enabled: "false" | ||
security: | ||
enabled: "false" | ||
|
||
resources: | ||
requests: | ||
cpu: 1000m | ||
memory: 3Gi | ||
limits: | ||
memory: 3Gi | ||
|
||
volumeClaimTemplate: | ||
accessModes: | ||
- "ReadWriteOnce" | ||
resources: | ||
requests: | ||
storage: 5Gi | ||
|
||
clusterHealthCheckParams: "wait_for_status=red&timeout=1s" | ||
|
||
minio: | ||
mode: standalone | ||
replicas: 1 | ||
existingSecret: minio-secrets | ||
|
||
resources: | ||
requests: | ||
memory: 500Mi | ||
limits: | ||
memory: 500Mi | ||
|
||
redis: | ||
architecture: standalone | ||
|
||
auth: | ||
enabled: false | ||
|
||
resources: | ||
requests: | ||
memory: 500Mi | ||
limits: | ||
memory: 500Mi |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if I did something wrong, but I get aleph
3.15.1
:/There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, that’s weird… I just reset my cluster, removed local images, and set up everything again from scratch. But looking at the about page and at the version specified inside of the container I see
3.15.4
. We could look into it together tomorrow if you’d like :)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only other reason for this I could imagine is that this branch used to be based off of 3.15.1, and I later rebased it and force pushed to be up to date with develop. But that was a few days before you looked at it, I think…