-
Notifications
You must be signed in to change notification settings - Fork 54
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
Feature: Add support for Kubernetes deployment through Kustomize #187
Merged
Merged
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d54edc3
feat: add k8s support
saviogl fe23ae5
feat: add symbolic link to .env
saviogl 88fbc61
feat: source image versions from .env file
saviogl 3a5c246
chore: clean up
saviogl b46a8bd
chore: remove namespace reference from kustomization.yaml
saviogl df0200f
docs: add README.md
saviogl 04b0503
docs: fix typo and move up the file
saviogl 04e1bc6
style: add new line at the end
saviogl 8b404f7
fix: fix relative simbolic link
saviogl 4841909
docs: fix typos
saviogl File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
## Deploying FarosCE on Kubernetes | ||
|
||
We provide all required Kubernetes manifests for a full stack deployment in this repository under `kube/base`. These manifests can be used raw but are also exposed using [Kustomize](https://kustomize.io/) for a more flexible and scalable deployment model. | ||
|
||
> Local Kubernetes clusters can be setup in a few different ways. Here's a list of the few most common tools for local K8s deployment: [kind](https://kind.sigs.k8s.io/), [k3d](https://k3d.io/v5.4.3/) or [minikube](https://minikube.sigs.k8s.io/docs/start/). | ||
|
||
Provided you have have access to a Kubernetes cluster and have configured access to it via `kubectl`, FarosCE can be deployed with the following command: | ||
|
||
```base | ||
kustomize build --load-restrictor LoadRestrictionsNone https://github.com/faros-ai/faros-community-edition/kube/base | kubectl apply -f - | ||
``` | ||
|
||
Kustomize will load the deployment definition in this repository over Github, build the manifests and pipe them over to `kubectl` for deployment in the configured cluster. | ||
|
||
To access the deployed applications you can port forward onto the relevant services, for example: | ||
|
||
```yaml | ||
# Expose Airbyte to localhost | ||
kubectl port-forward svc/airbyte-webapp-svc 8000:80 | ||
# Expose Metabase to localhost | ||
kubectl port-forward svc/metabase 3000:80 | ||
# Expose Hasura to localhost | ||
kubectl port-forward svc/hasura 8080:80 | ||
# Expose N8N to localhost | ||
kubectl port-forward svc/n8n 5678:80 | ||
``` | ||
|
||
> Kubernetes services can also be exposed using NodePort, Ingress, or External LoadBalancers. This will vary depending on your Kubernetes cluster. | ||
|
||
### Using kustomization.yaml file | ||
|
||
For a more declarative and GitOps friendly deployment approach you can create your own local `kustomization.yaml` file, put it under a source control system and reference the same path in the resources attribute. | ||
|
||
```yaml | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- https://github.com/faros-ai/faros-community-edition/kube/base | ||
``` | ||
|
||
> This allow you to customize the Kubernetes resources objects in any way you want to meet whatever desired cluster requirements you might have | ||
|
||
With this file available you can run the following command from the same path to build and apply the manifests: | ||
|
||
```yaml | ||
kustomize build --load-restrictor LoadRestrictionsNone . | kubectl apply -f - | ||
``` |
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,7 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: airbyte-bootloader | ||
labels: | ||
app.kubernetes.io/name: airbyte-bootloader | ||
app.kubernetes.io/component: bootloader |
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,68 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: airbyte-db | ||
labels: | ||
app.kubernetes.io/name: airbyte-db | ||
app.kubernetes.io/component: database | ||
spec: | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: airbyte-db | ||
app.kubernetes.io/component: database | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: airbyte-db | ||
app.kubernetes.io/component: database | ||
spec: | ||
containers: | ||
- name: airbyte-db-container | ||
env: | ||
- name: CONFIG_DATABASE_PASSWORD | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: CONFIG_DATABASE_PASSWORD | ||
optional: true | ||
- name: CONFIG_DATABASE_URL | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: CONFIG_DATABASE_URL | ||
optional: true | ||
- name: CONFIG_DATABASE_USER | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: CONFIG_DATABASE_USER | ||
optional: true | ||
- name: DATABASE_PASSWORD | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: DATABASE_PASSWORD | ||
- name: DATABASE_URL | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: DATABASE_URL | ||
- name: DATABASE_USER | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: DATABASE_USER | ||
- name: POSTGRES_PASSWORD | ||
value: "" | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: DATABASE_PASSWORD | ||
- name: POSTGRES_USER | ||
value: "" | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: DATABASE_USER | ||
- name: POSTGRES_DB | ||
$patch: delete |
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,17 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: airbyte-scheduler | ||
labels: | ||
app.kubernetes.io/name: airbyte-scheduler | ||
app.kubernetes.io/component: scheduler | ||
spec: | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: airbyte-scheduler | ||
app.kubernetes.io/component: scheduler | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: airbyte-scheduler | ||
app.kubernetes.io/component: scheduler |
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,29 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: airbyte-server-svc | ||
labels: | ||
app.kubernetes.io/name: airbyte-server | ||
app.kubernetes.io/component: server | ||
spec: | ||
selector: | ||
app.kubernetes.io/name: airbyte-server | ||
app.kubernetes.io/component: server | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: airbyte-server | ||
labels: | ||
app.kubernetes.io/name: airbyte-server | ||
app.kubernetes.io/component: server | ||
spec: | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: airbyte-server | ||
app.kubernetes.io/component: server | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: airbyte-server | ||
app.kubernetes.io/component: server |
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,26 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: airbyte-temporal-svc | ||
spec: | ||
selector: | ||
app.kubernetes.io/name: airbyte-temporal | ||
app.kubernetes.io/component: temporal | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: airbyte-temporal | ||
labels: | ||
app.kubernetes.io/name: airbyte-temporal | ||
app.kubernetes.io/component: temporal | ||
spec: | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: airbyte-temporal | ||
app.kubernetes.io/component: temporal | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: airbyte-temporal | ||
app.kubernetes.io/component: temporal |
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,29 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: airbyte-webapp-svc | ||
labels: | ||
app.kubernetes.io/name: airbyte-webapp-svc | ||
app.kubernetes.io/component: webapp | ||
spec: | ||
selector: | ||
app.kubernetes.io/name: airbyte-webapp | ||
app.kubernetes.io/component: webapp | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: airbyte-webapp | ||
labels: | ||
app.kubernetes.io/name: airbyte-webapp | ||
app.kubernetes.io/component: webapp | ||
spec: | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: airbyte-webapp | ||
app.kubernetes.io/component: webapp | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: airbyte-webapp | ||
app.kubernetes.io/component: webapp |
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,17 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: airbyte-worker | ||
labels: | ||
app.kubernetes.io/name: airbyte-worker | ||
app.kubernetes.io/component: worker | ||
spec: | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: airbyte-worker | ||
app.kubernetes.io/component: worker | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: airbyte-worker | ||
app.kubernetes.io/component: worker |
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 @@ | ||
../../../../.env | ||
ypc-faros marked this conversation as resolved.
Show resolved
Hide resolved
|
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,13 @@ | ||
############################## Faros ########################################## | ||
FAROS_DB_HOST=airbyte-db-svc | ||
FAROS_CONFIG_DB_HOST=airbyte-db-svc | ||
|
||
############################## Airbyte ######################################## | ||
AIRBYTE_URL=http://airbyte-webapp-svc | ||
|
||
############################## Hasura ######################################## | ||
HASURA_URL=http://hasura | ||
|
||
############################## Metabase ######################################## | ||
METABASE_URL=http://metabase | ||
METABASE_FAROS_DB_HOST=airbyte-db-svc |
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,126 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: faros-init | ||
spec: | ||
ttlSecondsAfterFinished: 300 | ||
template: | ||
spec: | ||
restartPolicy: OnFailure | ||
containers: | ||
- name: faros-init | ||
image: farosai.docker.scarf.sh/farosai/faros-ce-init:latest | ||
env: | ||
- name: AIRBYTE_URL | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: AIRBYTE_URL | ||
- name: AIRBYTE_FORCE_SETUP | ||
value: "false" | ||
- name: AIRBYTE_DESTINATION_HASURA_URL | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: HASURA_URL | ||
- name: FAROS_DB_HOST | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: FAROS_DB_HOST | ||
- name: FAROS_DB_PORT | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: FAROS_DB_PORT | ||
- name: FAROS_DB_PASSWORD | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: FAROS_DB_PASSWORD | ||
- name: FAROS_DB_NAME | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: FAROS_DB_NAME | ||
- name: FAROS_DB_USER | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: FAROS_DB_USER | ||
- name: FAROS_CONFIG_DB_HOST | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: FAROS_CONFIG_DB_HOST | ||
- name: FAROS_CONFIG_DB_PORT | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: FAROS_CONFIG_DB_PORT | ||
- name: FAROS_CONFIG_DB_USER | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: FAROS_CONFIG_DB_USER | ||
- name: FAROS_CONFIG_DB_PASSWORD | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: FAROS_CONFIG_DB_PASSWORD | ||
- name: HASURA_DB_NAME | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: HASURA_DB_NAME | ||
- name: HASURA_URL | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: HASURA_URL | ||
- name: HASURA_GRAPHQL_ADMIN_SECRET | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: HASURA_GRAPHQL_ADMIN_SECRET | ||
- name: HASURA_GRAPHQL_DATABASE_URL | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: HASURA_GRAPHQL_DATABASE_URL | ||
optional: true | ||
- name: METABASE_DB_NAME | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: METABASE_DB_NAME | ||
- name: METABASE_FAROS_DB_HOST | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: METABASE_FAROS_DB_HOST | ||
- name: METABASE_USE_SSL | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: METABASE_USE_SSL | ||
- name: METABASE_PASSWORD | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: METABASE_PASSWORD | ||
- name: METABASE_URL | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: METABASE_URL | ||
- name: METABASE_USER | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: METABASE_USER | ||
- name: N8N_DB_NAME | ||
valueFrom: | ||
configMapKeyRef: | ||
name: faros-config | ||
key: N8N_DB_NAME |
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.
allow => allows