This README provides detailed instructions on deploying the Fern application in a Kubernetes environment using k3d, KubeVela, and Cloud Native PostgreSQL (cnpg). The process includes setting up a k3d cluster, installing KubeVela, deploying Cloud Native PostgreSQL using Helm, and finally, deploying the Fern application as defined in vela.yaml
. Additionally, this guide covers the installation of custom ComponentDefinitions for an enhanced gateway trait and Cloud Native PostgreSQL.
Before starting, ensure you have the following tools installed on your system:
- Docker
- k3d
- kubectl
- Helm
- KubeVela CLI
Create a new k3d cluster with the following command:
k3d cluster create my-k3d-cluster --port "8080:8080@loadbalancer" --agents 3
This command will set up a new Kubernetes cluster named my-k3d-cluster
running in Docker.
Install KubeVela in your k3d cluster using Helm:
helm repo add kubevela https://kubevela.github.io/charts
helm repo update
helm install --create-namespace -n vela-system kubevela kubevela/vela-core --wait
Confirm the installation by checking the deployed pods:
kubectl get pods -n vela-system
Add the Cloud Native PostgreSQL Helm repository and install it:
helm repo add cnpg https://cloudnative-pg.github.io/charts
helm repo update
helm upgrade --install cnpg \
--namespace cnpg-system \
--create-namespace \
cnpg/cloudnative-pg
Before deploying the Fern application, add the following custom ComponentDefinitions:
-
Install vela cli:
curl -fsSl https://kubevela.io/script/install.sh | bash
-
Gateway Component (gateway.cue):
This updates the existing gateway trait to support the service type LoadBalancer.
vela def apply ./docs/kubevela/gateway.cue
-
Cloud Native PostgreSQL Component (cnpg.cue):
Introduces a new component definition for Cloud Native PostgreSQL.
vela def apply ./docs/kubevela/cnpg.cue
Deploy your application using the provided vela.yaml
in a namespace called fern:
kubectl create ns fern
kubectl apply -f ./docs/kubevela/vela.yaml
To check the status of your deployment, use:
kubectl get all -n fern
- Ensure Docker is running prior to initiating the k3d cluster.
- Customize
gateway.cue
andcnpg.cue
according to your specific needs. - Adjust
vela.yaml
to fit the configuration of your Fern application.
We welcome your contributions! Feel free to submit pull requests or open issues to enhance the documentation or deployment procedures.
For questions or feedback, please create an issue in this repository.
Thank you for using or contributing to this project!