https://github.com/peterj/ec-kube
https://github.com/peterj/ec-kube
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/peterj/ec-kube
- Owner: peterj
- Created: 2024-01-27T22:48:38.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-04T00:37:07.000Z (over 2 years ago)
- Last Synced: 2025-03-19T21:43:09.790Z (about 1 year ago)
- Language: Go
- Size: 51.8 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ec-kube
As part of my weekend AI streams, I am building a Kubernetes controller that will manage Embedchain AI apps.
Streams:
- Part 1: [Watch here](https://www.youtube.com/watch?v=X-irXixeo1Y)
- Part 2: [Join here](https://www.youtube.com/watch?v=q2sG9cRJh-w)
## What are we building?
1. Create the Kubernetes controller (I'll use the kubebuilder)
```yaml
spec:
secretRef:
name: this-is-my-secret
config: |-
{
// Embedchain config
}
```
2. Embedchain API Docker image
## Running the image in Kubernetes
Create a ConfigMap that holds the Embedchain config file:
```sh
kubectl create configmap ec-config --from-file=ec-image/config/config.yaml
```
Create a Secret that holds the `OPENAI_API_KEY` (for now):
```sh
kubectl create secret generic ec-secret --from-literal='OPENAI_API_KEY=${OPENAI_API_KEY}'
```
## Kubernetes controller
```shell
kubebuilder init --domain learncloudnative.com --repo learncloudnative.com/aiapps
kubebuilder create api --group aiapps --version v1 --kind EmbedchainApp
# Create webhook
kubebuilder create webhook --group aiapps --version v1 --kind EmbedchainApp --defaulting --programmatic-validation
```
To run it locally, make sure you have a K8s cluster running and run:
```shell
ENABLE_WEBHOOKS=false make run
```
> Setting `ENABLE_WEBHOOKS` to `false`, because the webhook requires a valid certificate.
Try deploying a basic resource:
```yaml
apiVersion: aiapps.learncloudnative.com/v1
kind: EmbedchainApp
metadata:
name: myapp
spec:
configRef:
name: ec-config
namespace: default
secretRef:
name: ec-secret
namespace: default
```