- Metrics service toegevoegd

- Applicatie services starten op, behalve eveai_chat_client
- Connectiviteit naar admin / eveai_app niet functioneel
This commit is contained in:
Josako
2025-08-20 11:49:19 +02:00
parent d6a2635e50
commit 9c63ecb17f
5 changed files with 156 additions and 283 deletions

View File

@@ -233,6 +233,118 @@ install_ingress_controller() {
kubectl get services -n ingress-nginx
}
# Patch Ingress Controller Resources
patch_ingress_resources() {
print_status "Patching Ingress Controller resources..."
# Wait a moment for the deployment to be fully created
sleep 5
# Check if patch file exists
local patch_file="ingress-nginx-resources-patch.yaml"
if [[ ! -f "$patch_file" ]]; then
print_error "Patch file not found: $patch_file"
return 1
fi
# Patch the ingress-nginx-controller deployment with higher resource limits
print_status "Updating resource limits for ingress-nginx-controller using manifest file..."
# Apply patch with retry logic
local max_attempts=5
local attempt=1
local success=false
while [ $attempt -le $max_attempts ] && [ "$success" = false ]; do
print_status "Attempt $attempt/$max_attempts - patching ingress controller resources..."
if kubectl patch deployment ingress-nginx-controller -n ingress-nginx --patch-file "$patch_file"; then
print_success "Successfully patched ingress-nginx-controller resources"
success=true
else
if [ $attempt -lt $max_attempts ]; then
print_warning "Patch attempt $attempt failed, retrying in 5 seconds..."
sleep 5
attempt=$((attempt + 1))
else
print_error "Failed to patch ingress-nginx-controller resources after $max_attempts attempts"
return 1
fi
fi
done
# Wait for rollout to complete
print_status "Waiting for ingress controller rollout to complete..."
kubectl rollout status deployment/ingress-nginx-controller -n ingress-nginx --timeout=300s
if [ $? -eq 0 ]; then
print_success "Ingress Controller resource patch completed successfully"
# Verify the new resource settings
print_status "Verifying new resource settings..."
kubectl describe deployment ingress-nginx-controller -n ingress-nginx | grep -A 10 "Limits:\|Requests:" || true
else
print_error "Ingress Controller rollout failed"
return 1
fi
}
# Install Metrics Server
install_metrics_server() {
print_status "Installing Metrics Server..."
# Apply metrics server with Kind-specific configuration
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
# Check if patch file exists
local patch_file="metrics-server-patch.yaml"
if [[ ! -f "$patch_file" ]]; then
print_error "Patch file not found: $patch_file"
return 1
fi
# Patch metrics server for Kind (disable TLS verification)
print_status "Patching Metrics Server for Kind compatibility using manifest file..."
# Wait for metrics server deployment to exist
local max_wait=30
local wait_count=0
while ! kubectl get deployment metrics-server -n kube-system &> /dev/null; do
if [ $wait_count -ge $max_wait ]; then
print_error "Metrics server deployment not found after waiting"
return 1
fi
sleep 2
wait_count=$((wait_count + 1))
done
# Apply the patch
if kubectl patch deployment metrics-server -n kube-system --patch-file "$patch_file"; then
print_success "Successfully patched metrics-server configuration"
else
print_warning "Failed to patch metrics-server, but continuing..."
fi
# Wait for metrics server to be ready
print_status "Waiting for Metrics Server to be ready..."
kubectl wait --for=condition=available deployment/metrics-server -n kube-system --timeout=300s
if [ $? -eq 0 ]; then
print_success "Metrics Server installed and ready"
# Test metrics server
print_status "Testing metrics server..."
sleep 10 # Give metrics server time to collect initial metrics
if kubectl top nodes &> /dev/null; then
print_success "Metrics Server is working correctly"
else
print_warning "Metrics Server installed but may need more time to collect metrics"
fi
else
print_warning "Metrics Server installation completed but readiness check failed"
fi
}
# Apply Kubernetes manifests
apply_manifests() {
print_status "Applying Kubernetes manifests..."
@@ -351,6 +463,8 @@ main() {
create_cluster
verify_cri_status
install_ingress_controller
patch_ingress_resources
install_metrics_server
apply_manifests
configure_registry_certificates
verify_cluster