-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-k8s-services.sh
More file actions
executable file
·61 lines (54 loc) · 1.96 KB
/
Copy pathsetup-k8s-services.sh
File metadata and controls
executable file
·61 lines (54 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
echo "=== OpenClaw K8s Services Setup ==="
echo "This script sets up Kubernetes services to work alongside WSL-based OpenClaw"
echo
# Check if kubectl is available
if ! command -v kubectl &> /dev/null; then
echo "❌ kubectl is not installed or not in PATH"
echo "Please install kubectl and ensure it's in your PATH"
exit 1
fi
# Check if we have a kubernetes cluster available
if ! timeout 10 kubectl cluster-info &> /dev/null; then
echo "❌ No Kubernetes cluster is currently accessible"
echo
echo "To set up k3s, please run the following commands as root:"
echo
echo " # Install k3s"
echo " curl -sfL https://get.k3s.io | sh -s - --write-kubeconfig-mode 644"
echo
echo " # Or if you want to start k3s server manually:"
echo " sudo k3s server --write-kubeconfig-mode 644 &"
echo
echo " # Then copy the kubeconfig to your user directory:"
echo " mkdir -p ~/.kube"
echo " sudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/config"
echo " sudo chown \$USER:\$USER ~/.kube/config"
echo
echo "After setting up k3s, please run this script again."
exit 1
fi
echo "✅ Kubernetes cluster is accessible"
echo
echo "Setting up OpenClaw services in Kubernetes..."
kubectl apply -f k8s-openclaw-services.yaml
echo
echo "Waiting for PostgreSQL to be ready..."
kubectl wait --for=condition=ready pod -l app=postgres-db -n openclaw-services --timeout=120s
echo
echo "=== K8s Services Setup Complete ==="
echo "PostgreSQL is now running in Kubernetes"
echo "WSL-based OpenClaw services can connect to it using:"
echo " Host: postgres-db.openclaw-services.svc.cluster.local"
echo " Port: 5432"
echo " Database: financial_analysis"
echo " User: finance_user"
echo " Password: secure_finance_password"
echo
echo "Services:"
kubectl get svc -n openclaw-services
echo
echo "Deployments:"
kubectl get deployments -n openclaw-services
echo
echo "Note: OpenClaw gateway services continue to run in WSL for your direct management"