Developing on Kubernetes#
To develop on Kubernetes, you will need to have a Kubernetes cluster running. We recommend using K3d to run a local Kubernetes cluster. You can also use Kind or Minikube. You will also need to have Skaffold installed. Skaffold is a tool that facilitates continuous development for Kubernetes applications. It is used to build and deploy the project to the Kubernetes cluster. We recommend using the recommended installation method for your operating system.
Creating a Kubernetes Cluster#
K3d#
To create a Kubernetes cluster using K3d, run the following command:
k3d cluster create k3d-cluster
Kind#
To create a Kubernetes cluster using Kind, run the following command:
sh k8s/environments/development/cluster/generate-ip-address-pool-kind.sh && kind create cluster --config k8s/environments/development/cluster/kind.yaml
Configuring Development Environment#
Inside k8s/environments/development, there are files that are used to configure the development environment. Usually, you will not need to change these files. However, if you need to change the configuration, you can do so by editing the files in this folder.
Deploying to Kubernetes#
We use Skaffold, a tool that facilitates continuous development for Kubernetes applications, to deploy the project to the Kubernetes cluster. To deploy the project to the Kubernetes cluster, run the following command:
skaffold run
To deploy the project in dev mode (with hot reload)ing), run the following command:
skaffold dev
Note#
Kind#
To ensure the MetalLB load balancer has the correct IP address, run the following command:
sh k8s/environments/development/cluster/generate-ip-address-pool-kind.sh
Then, it will generate a MetalLB config manifest that needs to be applied.
To load images into the Kind cluster, run the following command:
kind load docker-image <image name>