diff --git a/README.md b/README.md index 140f5e5..f532880 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,8 @@ Example: curl -X POST -H "Content-Type: application/json" -d '{"who": "me"}' http://localhost:8090/api/v1/execution/salute ``` +To deploy the container in Kubernetes, a reference deployment is available and documented at [deployments](deployments/). + ## Testing `pytest` is used for testing. You can run the tests with the following command: diff --git a/deployments/README.md b/deployments/README.md new file mode 100644 index 0000000..64ebcc2 --- /dev/null +++ b/deployments/README.md @@ -0,0 +1,8 @@ +# Kubernetes deployment of eidos +This folder contains all required files and configuration to have a working deployment of `eidos` in Kubernetes. + +The configuration provided creates a deployment with 3 replicas using the base `eidos` instance (to deploy a instance with custom functions just change the docker image) behind a service for load balancing between the different pods. + +# Disclaimer + +The provided Kubernetes manifests are for reference only. You must review and adjust these manifests to suit your specific cluster and configuration. Ensure that resource requests and limits, image names, environment variables, and other configurations are appropriate for your setup. \ No newline at end of file diff --git a/deployments/eidos-deployment.yaml b/deployments/eidos-deployment.yaml new file mode 100644 index 0000000..2e44069 --- /dev/null +++ b/deployments/eidos-deployment.yaml @@ -0,0 +1,78 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: eidos-namespace + labels: + app: eidos +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: eidos-deployment + labels: + app: eidos + namespace: eidos-namespace +spec: + replicas: 3 + selector: + matchLabels: + app: eidos + template: + metadata: + labels: + app: eidos + namespace: eidos-namespace + spec: + containers: + - name: eidos + image: ghcr.io/khaosresearch/eidos:v1.0.0 # This image must be changed to deploy a custom functions + imagePullPolicy: Always + ports: + - containerPort: 80 + resources: + limits: + memory: "1Gi" + cpu: "1" + requests: + memory: "256Mi" + cpu: "500m" + env: + - name: API_KEY + valueFrom: + configMapKeyRef: + name: eidos-configmap + key: EIDOS_API_KEY + - name: ROOT_PATH + valueFrom: + configMapKeyRef: + name: eidos-configmap + key: EIDOS_ROOT_PATH + - name: FUNCTIONS_FOLDER + valueFrom: + configMapKeyRef: + name: eidos-configmap + key: EIDOS_FUNCTIONS_FOLDER +--- +apiVersion: v1 +kind: Service +metadata: + name: eidos-service + namespace: eidos-namespace +spec: + type: NodePort + selector: + app: eidos + ports: + - protocol: TCP + port: 80 + targetPort: 80 +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: eidos-configmap + namespace: eidos-namespace +data: + EIDOS_API_KEY: "Sample_API_key_for_eidos" + EIDOS_ROOT_PATH: "/eidos" + EIDOS_FUNCTIONS_FOLDER: "functions" \ No newline at end of file