The Workspace Configuration
After completing this guide, you will have the necessary Workspace configuration for Kelda to boot your services in the development environment. Once you have this foundation, you will be able to write the Sync configuration to deploy local versions of services.
The Workspace configuration has two parts:
workspace.yamlfile that describes what services and tunnels should be created in the development environment.
- A directory per service that contains the Kubernetes YAML for each service.
When Kelda boots, it initializes the development environment by:
- Getting the list of services to deploy from the
- Deploying the Kubernetes YAML in each directory referenced in the service list.
- Creating tunnels between the local machine and remote cluster according to
the tunnels in the
workspace.yaml file is from the Node Todo example
For more explanation on the
workspace.yaml format see the docs
# The version of the configuration format. This doesn't need to be changed. version: "v1alpha1" # Note how each service has a corresponding directory in the "Example # Directory Structure" section below. services: - name: "mongodb" - name: "web-server" # Requests to localhost:8080 will get forwarded to port 8080 in the # web-server service. # Note how the "web-server" service name is also in the "services" list above. tunnels: - serviceName: "web-server" remotePort: 8080 localPort: 8080
Example Directory Structure
The Node Todo example application
has the following directory structure. Note how there's a
file, along with a directory for each service referenced in the file.
├── mongodb │ ├── mongodb-secret.yaml │ ├── mongodb-statefulset.yaml │ └── mongodb-svc.yaml ├── web-server │ ├── web-server-dep.yaml │ └── web-server-svc.yaml └── workspace.yaml
Create a directory for your workspace configuration.
workspace.yamlfile, adding service names and tunnels as appropriate for your application.
version: "v1alpha1" services: - name: <name of first service> - name: <name of second service>
Gather your Kubernetes YAML used for deploying the services.
- If you have production Kubernetes YAML, then you're good to go.
- If you're using Helm, place the Helm chart in the workspace directory according to these instructions.
- If you're using Docker Compose, use
komposeto convert your
docker-compose.ymlinto Kubernetes YAML.
Special handling for Docker Compose volumes
Edit the Docker Compose file so that it doesn't have Docker-specific volume configuration since this is handled differently in Kubernetes.
Modify your Kubernetes YAML to be suitable for the development environment.
Although any Kubernetes YAML can be used with Kelda, production deployments often need to be tweaked to be suitable for development environments. See this guide for some common changes.
Group your Kubernetes YAML into services.
Create a directory per service containing the Kubernetes YAML for that service. Remember that the directory name must correspond with the name used in your
If your Kubernetes YAML references private Docker images, grant Kelda access to pull them by following the instructions here.
Point your user configuration at your new workspace.
kelda-configdirectory that you created in step 1, run
and answer the questions. This will update your
~/.kelda.yamlfile so that the
workspacefield points at your newly created Workspace configuration.
Test your Kubernetes YAML by deploying it with Kelda.
The following command will deploy all the services in the
workspace.yamlfile. We're using the
--no-syncflag because we haven't written any Sync configuration yet to tell Kelda what files to sync.
kelda dev --no-sync
If all goes well, your services should enter the Ready state. If not, follow the next step to fix your Kubernetes YAML.
Modify your Kubernetes YAML until your application behaves as expected.
To debug Kubernetes issues, access the cluster directly with
kubectl --namespace <namespace in ~/.kelda.yaml>
You will need to re-run
kelda devin order to deploy modifications to your YAML.
Add tunnels to your
workspace.yamlfile. These can be used to test your application.
tunnels: - serviceName: <name from above list> remotePort: <port in container> localPort: <port on localhost>
You will need to re-run
kelda devin order to deploy modifications to your