feat: Providing some clusters for kubernetes
This commit is contained in:
44
examples/kubernetes/clusters/redis.rhai
Normal file
44
examples/kubernetes/clusters/redis.rhai
Normal file
@@ -0,0 +1,44 @@
|
||||
//! Redis Cluster Deployment Example (Rhai)
|
||||
//!
|
||||
//! This script shows how to deploy a Redis cluster using Rhai scripting
|
||||
//! with the KubernetesManager convenience methods.
|
||||
|
||||
print("=== Redis Cluster Deployment ===");
|
||||
|
||||
// Create Kubernetes manager for the cache namespace
|
||||
print("Creating Kubernetes manager for 'cache' namespace...");
|
||||
let km = kubernetes_manager_new("cache");
|
||||
print("✓ Kubernetes manager created");
|
||||
|
||||
// Create Redis cluster using the convenience method
|
||||
print("\nDeploying Redis cluster...");
|
||||
|
||||
try {
|
||||
// Deploy Redis using the convenience method
|
||||
let result = deploy_application(km, "redis-cluster", "redis:7-alpine", 3, 6379, #{
|
||||
"app": "redis-cluster",
|
||||
"type": "cache",
|
||||
"engine": "redis"
|
||||
});
|
||||
print("✓ " + result);
|
||||
|
||||
print("\n✅ Redis cluster deployed successfully!");
|
||||
|
||||
print("\n📋 Connection Information:");
|
||||
print(" Host: redis-cluster.cache.svc.cluster.local");
|
||||
print(" Port: 6379");
|
||||
|
||||
print("\n🔧 To connect from another pod:");
|
||||
print(" redis-cli -h redis-cluster.cache.svc.cluster.local");
|
||||
|
||||
print("\n💡 Next steps:");
|
||||
print(" • Configure Redis authentication");
|
||||
print(" • Set up Redis clustering configuration");
|
||||
print(" • Add persistent storage");
|
||||
print(" • Configure memory policies");
|
||||
|
||||
} catch(e) {
|
||||
print("❌ Failed to deploy Redis cluster: " + e);
|
||||
}
|
||||
|
||||
print("\n=== Deployment Complete ===");
|
Reference in New Issue
Block a user