@@ -49,46 +49,65 @@ jobs:
4949 run : |
5050 echo "================= SERVICE ENDPOINTS ================="
5151
52- # Get ArgoCD endpoint (still using LoadBalancer)
52+ # Get ArgoCD and App LoadBalancer services
5353 ARGOCD_HOST=$(kubectl get svc argocd-server -n ${{ inputs.argocd_namespace }} -o jsonpath='{.status.loadBalancer.ingress[0].hostname}' 2>/dev/null || echo 'Not found')
54-
55- MONITORING_HOST=$(kubectl get ingress monitoring-ingress -n ${{ inputs.monitoring_namespace }} -o jsonpath='{.spec.rules[0].host}' 2>/dev/null || echo 'Not found')
54+ APP_HOST=$(kubectl get svc ${{ inputs.app_name }}-svc -n ${{ inputs.app_namespace }} -o jsonpath='{.status.loadBalancer.ingress[0].hostname}' 2>/dev/null || echo 'Not found')
5655
57- # Alternative: get ingress from kube-prometheus-stack if using helm ingress
58- if [ "$MONITORING_HOST" = "Not found" ]; then
59- MONITORING_HOST =$(kubectl get ingress -n ${{ inputs.monitoring_namespace }} -l app.kubernetes.io/name=kube-prometheus-stack - o jsonpath='{.items[0].spec.rules [0].host }' 2>/dev/null || echo 'Not found' )
60- fi
56+ # Get monitoring ingress information
57+ MONITORING_DOMAIN=$(kubectl get ingress -n ${{ inputs.monitoring_namespace }} -o jsonpath='{.items[0].spec.rules[0].host}' 2>/dev/null || echo 'Not found')
58+ INGRESS_IP =$(kubectl get ingress -n ${{ inputs.monitoring_namespace }} -o jsonpath='{.items[0].status.loadBalancer.ingress [0].ip }' 2>/dev/null)
59+ INGRESS_HOSTNAME=$(kubectl get ingress -n ${{ inputs.monitoring_namespace }} -o jsonpath='{.items[0].status.loadBalancer.ingress[0].hostname}' 2>/dev/null)
6160
62- # Get app endpoint
63- APP_HOST =$(kubectl get svc ${{ inputs.app_name }}-svc -n ${{ inputs.app_namespace }} -o jsonpath='{.status.loadBalancer.ingress[0].hostname}' 2>/dev/null || echo 'Not found')
61+ # Get NGINX ingress controller LoadBalancer
62+ NGINX_LB =$(kubectl get svc -n ingress-nginx ingress-nginx-controller -o jsonpath='{.status.loadBalancer.ingress[0].hostname}' 2>/dev/null || echo 'Not found')
6463
6564 # Print endpoints
66- echo "ArgoCD: http://$ARGOCD_HOST"
67-
68- if [ "$MONITORING_HOST" != "Not found" ]; then
69- echo "Prometheus: http://$MONITORING_HOST/prometheus"
70- echo "Grafana: http://$MONITORING_HOST/grafana"
71- echo "Alertmanager: http://$MONITORING_HOST/alertmanager"
65+ echo "🚀 ArgoCD: http://$ARGOCD_HOST"
66+ echo "🌟 App: http://$APP_HOST"
67+ echo ""
68+ echo "📊 Monitoring Services (via Ingress):"
69+ if [ "$MONITORING_DOMAIN" != "Not found" ]; then
70+ echo " Domain: $MONITORING_DOMAIN"
71+ echo " 📊 Prometheus: http://$MONITORING_DOMAIN/prometheus"
72+ echo " 📈 Grafana: http://$MONITORING_DOMAIN/grafana"
73+ echo " 🚨 Alertmanager: http://$MONITORING_DOMAIN/alertmanager"
74+ echo ""
75+ echo " Ingress Status:"
76+ if [ ! -z "$INGRESS_IP" ]; then
77+ echo " IP: $INGRESS_IP"
78+ fi
79+ if [ ! -z "$INGRESS_HOSTNAME" ]; then
80+ echo " LoadBalancer: $INGRESS_HOSTNAME"
81+ fi
7282 else
73- echo "Monitoring services: Not found (check ingress configuration) "
83+ echo " ⚠️ Ingress not found or not ready "
7484 fi
75-
76- echo "App: http://$APP_HOST "
85+ echo ""
86+ echo "🌐 NGINX Ingress Controller: $NGINX_LB "
7787
7888 echo ""
79- echo "================= INGRESS STATUS ================="
89+ echo "================= DETAILED INGRESS STATUS ================="
90+ echo "All Ingress Resources:"
91+ kubectl get ingress -A -o wide 2>/dev/null || echo "No ingress resources found"
92+ echo ""
93+ echo "Monitoring Namespace Ingress Details:"
94+ kubectl describe ingress -n ${{ inputs.monitoring_namespace }} 2>/dev/null || echo "No ingress in monitoring namespace"
8095
81- # Show ingress details for debugging
82- echo "Monitoring Ingress Status:"
83- kubectl get ingress -n ${{ inputs.monitoring_namespace }} -o wide 2>/dev/null || echo "No ingress found in monitoring namespace"
96+ echo ""
97+ echo "================= SERVICE STATUS ================="
98+ echo "Monitoring Services (should be ClusterIP):"
99+ kubectl get svc -n ${{ inputs.monitoring_namespace }} -l app.kubernetes.io/instance=kube-prometheus-stack
84100
85101 echo ""
86- echo "Load Balancer Services:"
102+ echo "All LoadBalancer Services:"
87103 kubectl get svc -A --field-selector spec.type=LoadBalancer -o wide
88104
89105 echo ""
90- echo "================= DEFAULT CREDENTIALS ================="
106+ echo "NGINX Ingress Controller Status:"
107+ kubectl get svc -n ingress-nginx -o wide 2>/dev/null || echo "NGINX Ingress Controller not found"
91108
109+ echo ""
110+ echo "================= DEFAULT CREDENTIALS ================="
92111 ARGOCD_PASS=$(kubectl -n ${{ inputs.argocd_namespace }} get secret argocd-initial-admin-secret -o jsonpath='{.data.password}' 2>/dev/null | base64 -d || echo 'Not found')
93112 echo "ArgoCD -> Username: admin"
94113 echo "ArgoCD -> Password: $ARGOCD_PASS"
@@ -97,7 +116,24 @@ jobs:
97116 echo "Prometheus -> No login needed (anonymous access by default)"
98117
99118 echo ""
100- echo "================= CONFIGURATION NOTES ================="
101- echo "• Monitoring services are accessed through a single ingress endpoint"
102- echo "• Make sure your DNS points to the ingress controller's LoadBalancer"
103- echo "• If monitoring host shows 'Not found', check ingress controller deployment"
119+ echo "================= TROUBLESHOOTING TIPS ================="
120+ LB_COUNT=$(kubectl get svc -A --field-selector spec.type=LoadBalancer --no-headers 2>/dev/null | wc -l)
121+ INGRESS_COUNT=$(kubectl get ingress -A --no-headers 2>/dev/null | wc -l)
122+
123+ echo "📊 Current LoadBalancers: $LB_COUNT"
124+ echo "📊 Current Ingress Resources: $INGRESS_COUNT"
125+ echo ""
126+ echo "🔍 If monitoring services aren't accessible:"
127+ echo " 1. Check if NGINX Ingress Controller is installed"
128+ echo " 2. Verify domain 'monitoring.yourdomain.com' points to NGINX LB"
129+ echo " 3. Check ingress resource was created successfully"
130+ echo " 4. Ensure kube-prometheus-stack synced without errors in ArgoCD"
131+ echo ""
132+ echo "💰 Cost Impact:"
133+ echo " • Target: 2 LoadBalancers (ArgoCD + NGINX Ingress)"
134+ echo " • Current: $LB_COUNT LoadBalancers"
135+ if [ "$LB_COUNT" -gt 2 ]; then
136+ EXCESS=$((LB_COUNT - 2))
137+ COST=$((EXCESS * 16))
138+ echo " • Potential monthly savings: ~\$COST (reducing $EXCESS extra LoadBalancers)"
139+ fi
0 commit comments