K8sdiy Env
repo for preview env with flux operator 2.5
Install / Use
npx skills add den-vasyliev/k8sdiy-envInstalls into whichever agent you are using.
README
Application Setup Guide
This guide explains how to set up and deploy the Ephemeral Environments using OpenTofu, Kubernetes.
Prerequisites
- Linux/Unix-based system
- curl
- wget
- Kubernetes cluster (kind)
- Git
Installation Steps
1. Install Required Tools
First, install OpenTofu and K9s:
# Install OpenTofu
curl -fsSL https://get.opentofu.org/install-opentofu.sh | sh -s -- --install-method standalone
# Install K9S for cluster management
curl -sS https://webi.sh/k9s | sh
2. Setup Aliases
Add these helpful aliases to your shell configuration:
alias kk="EDITOR='code --wait' k9s"
alias tf=tofu
alias k=kubectl
3. Initialize and Apply Infrastructure
# Navigate to bootstrap directory
cd bootstrap
# Initialize OpenTofu
tofu init
# Set up GitHub authentication
# You will be prompted to enter your GitHub token securely
export TF_VAR_github_token="$GITHUB_TOKEN"
# Apply the infrastructure configuration
tofu apply
4. Deploy Gateway API
# Install Gateway API components
k apply -f ../gatewayapi
# Verify services
k get svc
5. Install Kind Load Balancer
wget https://github.com/kubernetes-sigs/cloud-provider-kind/releases/download/v0.6.0/cloud-provider-kind_0.6.0_linux_amd64.tar.gz
tar -xvzf cloud-provider-kind_0.6.0_linux_amd64.tar.gz -C /go/bin
/go/bin/cloud-provider-kind >/dev/null 2>&1 &
6. Deploy Application Components
# Deploy release configuration
k apply -f ../release
# Deploy preview configuration
k apply -f ../preview
# Create GitHub authentication secret in preview namespace
kubectl create secret generic github-auth \
--from-literal=username=git \
--from-literal=password=${GITHUB_TOKEN} \
-n app-preview
7. Verify Deployment
To verify the deployment, you can check the LoadBalancer IP and test the endpoints:
# Get LoadBalancer IP
LB_IP=$(kubectl get svc -o jsonpath='{.items[?(@.metadata.name matches "envoy-envoy-gateway.*")].status.loadBalancer.ingress[0].ip}' -n envoy-gateway-system)
# Test the main endpoint
curl $LB_IP -HHost:kbot.example.com
# Test preview endpoint
curl $LB_IP/pr-40 -HHost:kbot.example.com
Next Steps
After successful deployment:
- Create Pull Request
# Test preview endpoint
# Note: use your PR number e.g. 40
curl $LB_IP/pr-40 -HHost:kbot.example.com
- Merge your Pull Request
- Create a Release
# Test release endpoint
curl $LB_IP -HHost:kbot.example.com
Notes
- Make sure to keep your GitHub token secure
- Ensure all prerequisites are installed before starting the setup
- Check service status using
kubectl get svcif you encounter any issues
Related Skills
node-connect
385.5kDiagnose OpenClaw Android, iOS, or macOS node pairing, QR/setup code, route, auth, and connection failures.
blender-python-addon
40.5kBlender Python add-on rules for operators, panels, properties, registration, testing, and API-safe scripting
flutter-development-guidelines-cursorrules-prompt-file
40.5kCursor rules for Flutter development with MVVM architecture, Riverpod state management, Material widgets, and Dart style guidelines.
commit-push-pr
140.7kCommit, push, and open a PR
