Skip to content

Commit fd96fa0

Browse files
committed
Updates
1 parent 30ddbc9 commit fd96fa0

File tree

3 files changed

+490
-163
lines changed

3 files changed

+490
-163
lines changed

docs-source/site/docs/platform/eureka.md

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,180 @@ server.features.eureka.client.fetch-registry=true
8080
server.features.eureka.instance.preferIpAddress=true
8181
```
8282

83+
## Testing and Debugging
84+
85+
### Verify Eureka Server is Running
86+
87+
Check that the Eureka server pod is running and healthy:
88+
89+
```bash
90+
kubectl get pods -n eureka
91+
```
92+
93+
Expected output:
94+
95+
```text
96+
NAME READY STATUS RESTARTS AGE
97+
eureka-7b8f9d5c4d-x9k2m 1/1 Running 0 5m
98+
```
99+
100+
Check the Eureka service:
101+
102+
```bash
103+
kubectl get svc -n eureka
104+
```
105+
106+
Expected output:
107+
108+
```text
109+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
110+
eureka ClusterIP 10.96.123.456 <none> 8761/TCP 5m
111+
```
112+
113+
### Test Service Registration
114+
115+
After deploying an application configured to register with Eureka, verify it appears in the Eureka registry:
116+
117+
**Option 1: Using the Eureka Web UI**
118+
119+
1. Port-forward to Eureka:
120+
```bash
121+
kubectl port-forward -n eureka svc/eureka 8761
122+
```
123+
124+
2. Open [http://localhost:8761](http://localhost:8761) in your browser
125+
126+
3. Check the "Instances currently registered with Eureka" section. Your application should appear under "Application" with its name in uppercase
127+
128+
**Option 2: Using Eureka REST API**
129+
130+
Query the Eureka REST API to see all registered services:
131+
132+
```bash
133+
kubectl port-forward -n eureka svc/eureka 8761 &
134+
curl -s http://localhost:8761/eureka/apps | grep -i "<app>"
135+
```
136+
137+
Or check a specific application:
138+
139+
```bash
140+
curl -s http://localhost:8761/eureka/apps/YOUR-APPLICATION-NAME
141+
```
142+
143+
### Common Issues and Debugging
144+
145+
#### Services Not Appearing in Eureka
146+
147+
**Check application logs for registration errors:**
148+
149+
```bash
150+
kubectl logs -n <your-namespace> <your-pod-name> | grep -i eureka
151+
```
152+
153+
**Common causes:**
154+
155+
1. **Incorrect Eureka URL:** Verify the `eureka.client.service-url.defaultZone` property points to the correct Eureka service URL (typically `http://eureka.eureka:8761/eureka`)
156+
157+
2. **Network connectivity:** Test connectivity from your application pod to Eureka:
158+
```bash
159+
kubectl exec -n <your-namespace> <your-pod-name> -- curl -v http://eureka.eureka:8761/eureka/apps
160+
```
161+
162+
3. **Missing dependencies:** Ensure the Eureka client dependency is included in your application
163+
164+
4. **Registration disabled:** Check that `eureka.client.register-with-eureka` is set to `true`
165+
166+
#### Service Registration Delays
167+
168+
Eureka uses a heartbeat mechanism with default intervals:
169+
- **Registration delay:** Up to 30 seconds after application startup
170+
- **Discovery delay:** Up to 30 seconds for other services to discover the new instance
171+
- **Deregistration delay:** Up to 90 seconds after an instance goes down
172+
173+
To reduce these delays for development/testing, add to your application configuration:
174+
175+
```yaml
176+
eureka:
177+
instance:
178+
lease-renewal-interval-in-seconds: 5
179+
lease-expiration-duration-in-seconds: 10
180+
client:
181+
registry-fetch-interval-seconds: 5
182+
```
183+
184+
:::warning
185+
Do not use these shortened intervals in production as they increase network traffic and server load.
186+
:::
187+
188+
#### Check Eureka Server Logs
189+
190+
View Eureka server logs to diagnose registration or discovery issues:
191+
192+
```bash
193+
kubectl logs -n eureka -l app=eureka --tail=100 -f
194+
```
195+
196+
Look for:
197+
- Registration events: `Registered instance ... with status UP`
198+
- Heartbeat failures: `Lease expired for ...`
199+
- Replication errors (if running multiple Eureka servers)
200+
201+
#### Verify Environment Variables
202+
203+
Check that the Eureka environment variables are correctly injected into your application pod:
204+
205+
```bash
206+
kubectl exec -n <your-namespace> <your-pod-name> -- env | grep -i eureka
207+
```
208+
209+
Expected variables:
210+
```text
211+
EUREKA_SERVICE_URL=http://eureka.eureka:8761/eureka
212+
```
213+
214+
#### Application Shows as DOWN in Eureka
215+
216+
**Possible causes:**
217+
218+
1. **Health check endpoint failing:** Verify your application's health endpoint is responding:
219+
```bash
220+
kubectl exec -n <your-namespace> <your-pod-name> -- curl http://localhost:<port>/actuator/health
221+
```
222+
223+
2. **Incorrect health check URL:** Check the `eureka.instance.health-check-url-path` configuration
224+
225+
3. **Application startup incomplete:** The application may still be initializing
226+
227+
#### Multiple Instances Not Load Balancing
228+
229+
If you have multiple instances of a service but requests always go to the same instance:
230+
231+
1. **Verify all instances are registered:**
232+
```bash
233+
curl -s http://localhost:8761/eureka/apps/YOUR-SERVICE-NAME | grep instanceId
234+
```
235+
236+
2. **Check load balancer configuration:** Ensure your client is using a load-balanced RestTemplate or WebClient (for Spring Boot)
237+
238+
3. **Verify client-side load balancing:** Spring Cloud LoadBalancer should be on the classpath
239+
240+
### Enable Debug Logging
241+
242+
To get more detailed Eureka logs in your application, add to your `application.yaml`:
243+
244+
```yaml
245+
logging:
246+
level:
247+
com.netflix.discovery: DEBUG
248+
com.netflix.eureka: DEBUG
249+
```
250+
251+
For the Eureka server, edit the deployment and add environment variables:
252+
253+
```bash
254+
kubectl set env deployment/eureka -n eureka LOGGING_LEVEL_COM_NETFLIX_EUREKA=DEBUG
255+
```
256+
83257
## Getting Help
84258

85259
- [#oracle-db-microservices Slack channel](https://oracledevs.slack.com/archives/C06L9CDGR6Z) in the Oracle Developers slack workspace.

0 commit comments

Comments
 (0)