Quick Start
This guide will help you create your first workspace and deploy a module in just a few minutes.
Prerequisites
Section titled “Prerequisites”- Forkspacer operator installed (Installation Guide)
kubectlconfigured to access your cluster
Step 1: Create Your First Workspace
Section titled “Step 1: Create Your First Workspace”Create a file named workspace.yaml:
apiVersion: batch.forkspacer.com/v1kind: Workspacemetadata: name: default namespace: defaultspec: type: kubernetes connection: type: in-clusterApply the workspace:
kubectl apply -f workspace.yamlCheck the workspace status:
kubectl get workspacesOutput:
NAME PHASE AGEdefault ready 30sStep 2: Deploy a Module
Section titled “Step 2: Deploy a Module”Create a Redis module. Save this as module_helm.yaml:
apiVersion: batch.forkspacer.com/v1kind: Modulemetadata: name: redis namespace: default
config: - name: "Redis Version" alias: "version" option: editable: true required: false default: "21.2.9" values: - "21.2.9" - "21.2.7" - "21.2.6"
- name: "Replica Count" alias: "replicaCount" integer: editable: true required: false default: 1 min: 0 max: 5
spec: helm: chart: repo: url: https://charts.bitnami.com/bitnami chart: redis version: "{{.config.version}}"
namespace: default
values: - raw: replica: replicaCount: "{{.config.replicaCount}}" image: repository: bitnamilegacy/redis global: security: allowInsecureImages: true
cleanup: removePVCs: true
workspace: name: default namespace: default
hibernated: false
config: version: "21.2.7" replicaCount: 1Deploy the module:
kubectl apply -f module_helm.yamlCheck the module status:
kubectl get modulesOutput:
NAME WORKSPACE PHASE AGEredis default ready 45sUnderstanding What You Created
Section titled “Understanding What You Created”Before we continue, let’s understand what just happened:
You now have three components working together:
- Workspace (
default): An isolated Kubernetes environment managed by Forkspacer - Module (
redis): A Kubernetes CRD that declares “install Redis in the default workspace” - Module Definition: A YAML template hosted on GitHub that describes how to install Redis using a Helm chart
When you created the Module, the Forkspacer operator:
- Detected the new Module CRD
- Fetched the module definition from the GitHub URL
- Parsed the Helm configuration in that definition
- Installed Redis using the Helm chart specified in the definition
- Applied your configuration values (
replicaCount,version)
What’s in that URL? The GitHub URL points to a module definition - a reusable template that describes how to install Redis. Module definitions can be shared across teams and stored in Git repositories. View the Redis module definition →
Step 3: Verify the Deployment
Section titled “Step 3: Verify the Deployment”Check the pods created by the module:
kubectl get pods -l app.kubernetes.io/name=redisYou should see Redis pods running:
NAME READY STATUS RESTARTS AGEredis-master-0 1/1 Running 0 1mredis-replicas-0 1/1 Running 0 1mStep 4: Test Hibernation
Section titled “Step 4: Test Hibernation”Manually hibernate the workspace:
kubectl patch workspace default -p '{"spec":{"hibernated":true}}' --type=mergeCheck the workspace status:
kubectl get workspace defaultOutput:
NAME PHASE AGEdefault hibernated 5mThe module will automatically scale down when the workspace hibernates.
Wake up the workspace:
kubectl patch workspace default -p '{"spec":{"hibernated":false}}' --type=mergeStep 5: Clean Up
Section titled “Step 5: Clean Up”Delete the module:
kubectl delete module redisDelete the workspace:
kubectl delete workspace defaultWhat’s Next?
Section titled “What’s Next?”Learn More
Section titled “Learn More”- Workspace CRD Reference - Complete API documentation
- Module CRD Reference - Complete API documentation
Common Use Cases
Section titled “Common Use Cases”Development Environments:
# Auto-hibernate outside business hours to save costsspec: autoHibernation: enabled: true schedule: "0 18 * * 1-5" # 6 PM weekdays wakeSchedule: "0 8 * * 1-5" # 8 AM weekdaysTesting Environments:
# Fork from production workspacespec: type: kubernetes from: name: production-workspace namespace: prodStaging Environments:
# Deploy a PostgreSQL Helm chartspec: helm: chart: repo: url: https://charts.bitnami.com/bitnami chart: postgresql version: "14.0.0" namespace: default values: - raw: persistence: size: "50Gi" replication: enabled: true slaveReplicas: 2Troubleshooting
Section titled “Troubleshooting”Workspace Not Ready
Section titled “Workspace Not Ready”Check the workspace status:
kubectl describe workspace dev-workspaceLook at the Conditions section for error messages.
Module Installation Failed
Section titled “Module Installation Failed”Check the module status:
kubectl describe module nginx-appCheck operator logs:
kubectl logs -n forkspacer-system deployment/forkspacer-controller-manager