how does zuul work without eureka and ribbon for dynamic destination from kubernetes - kubernetes

I am a beginner of using Zuul. I would like to create a http proxy for dynamic destination (ip address) from kubernetes. I checked Can Zuul Edge Server be used without Eureka / Ribbon which is helpful, but I don't want to specify lists-of-servers.
What I have now is a simpleRouteFilter extends ZuulFilter based on spring-boot. In the filter, it will change the destination ip address according to what I get from kubernetes. And I also turn off the eureka stuff by using ribbon.eureka.enabled=false.
The problem is that it looks good in the local environment, but after I deploy the project into kubernetes, it will show Load balancer does not have available server for client: sample-all-services, but it indeed works. The reason why I put a sample-all-service (service id) there is that when I remove zuul config in the properties, the zuul function doesn't work properly. And I know that I didn't put any server for that id because it's dynamic.
Question:
(1) Is Zuul fit in my scenario?
(2) if yes, how to tune Zuul confguration to accept all the http requests without showing load balancer not available warn.
(3) Is that something related to the kubernetes?
The yaml file is:
zuul:
routes:
sample-all-services:
path: /**
server:
port: 8080
ribbon:
eureka:
enabled: false
sample-all-services:
ribbon:
ReadTimeout: 15000
Thanks.

Related

TCP/IP Monitoring in Eclipse-Stub based client call

I generated Web service client using the given WSDL in Eclipse. I have written a main method to invoke the Proxy class for getting the response.
https://val-p1-all-vim:8080/Selfcare/address?wsdl
I want to see the request that am making for debugging. I don't know what to configure as a Local monitoring port.
Local monitoring port: ?
Host name: val-p1-all-vim
Port: ?
Type: ?
Please help me with this.
You are free to choose a port that is not in use on your system like 8080. In your program change server to localhost:, e.g. localhost:8080.
A problem is that you can't connect to https. Your web service should also allow http.

Eureka and Consul

I am implementing a service discovery and I evaluating two options: Eureka and Consul.
Help me decide! I am leaning towards Eureka, but I need to clear a main tech problem. My infrastructure is based on openshift. I can have multiple containers running Eureka Servers behind a load balancer. As far as I know each server needs to communicate with each other. Also, Eureka is mainly used with AWS...
(newbie) Question:
1) How can I configure each Eureka Server to communicate with each other? I have a single (load balanced) URL. My fear is that each server potentially may become desynchronized.
2) Am i missing something?
You're right, each of the Eureka Server must communicate with each other. You can also play with regions depending on your approach.
To make it work (without zones), you must configure the property:
eureka.client.service-url.defaultZone: http://1st-eureka-server-ip-or-hostname:port/eureka/,http://2nd-eureka-server-hostname:porta/eureka/
The configuration above accepts a comma-delimited set of IP/hostname of all the Eureka Servers.
If you want to have a multi-zone configuration, I recommend you to read this blog post.
To Configure each Eureka Server to communicate with each other try this way to make a diffrent diffrent zone in resource in folder.
application-zone1.yml
server.port: 8001
eureka:
instance:
hostname: localhost
metadataMap.zone: zone1
application-zone2.yml
server.port: 8002
eureka:
instance:
hostname: 127.0.0.1
metadataMap.zone: zone2
application.yml
client:
register-with-eureka: false
fetch-registry: false
region: region-1
service-url:
zone1: http://localhost:8001/eureka/
zone2: http://127.0.0.1:800/eureka/
availability-zones:
region-1: zone1,zone2
spring.profiles.active: zone1
Follow this tutorial

WSO2 APIM Management: Use standard ports for HTTP and HTTPS

I am currently working on deploying the WSO2 APIM on a Kubernetes cluster. All the pods and services are configured and running correctly.
On the ingress settings we want to use expose default HTTP ports 80/443 instead of the default ports used by the product i.e. 9763/9443. We are not using any offsets for the port.
When testing the config we notice that the URL is always being redirected to port 9443 which is being blocked by the ingress.
Enabling HTTP protocol for admin also does not work as the redirection is happening to the default HTTP port configured in the product i.e. 9763
Is there a configuration in the carbon.xml/axis2.xml which can be changed to achieve the desired result or do we need to make changes in the Ingress setting for rewriting the URLs.
You can set proxy ports in PRODUCT_HOME/repository/conf/tomcat/catalina-server.xml file. For 9443 you can set the port 443 and for port 9763 you can use the port 80.
<Connector protocol="org.apache.coyote.http11.Http11NioProtocol"
port="9763"
proxyPort="80" ............
<Connector protocol="org.apache.coyote.http11.Http11NioProtocol"
port="9443"
proxyPort="443" ...........
Please refer https://docs.wso2.com/display/Carbon430/Adding+a+Custom+Proxy+Path

Configuration based fallback for route

There are two instances of an application: instance-1 and instance-2.
Let us assume that
instance-1 is reachable at localhost:8090
instance-2 is reachable at localhost:9080
How do I configure zuul proxy so that --- First visit instance-1 and in case of any exception / failure, switch to instance-2
Note: Not using Eureka
I was able to get it work using hystrix with a facade controller and in the fallback, calling instance-2 via RestTemplate.
But I am looking for some better approach wherein the routing is taken care by Zuul along with mirroring of HTTPHeaders, HttpMethod and other request attributes.
If anyone have tried similar thing, please suggest me.
You can configure Zuul to retry on current and next instance.
zuul:
retryable: true
ribbon:
MaxAutoRetries: 1
MaxAutoRetriesNextServer: 3
OkToRetryOnAllOperations: true
yourApplication:
ribbon:
listOfServers: localhost:8090, localhost:9080
As per above configuration, if routing to 8090 instance fails Zuul will try one more time to connect to 8090 and if that call also fails, Zuul will route to 9080 for the next call. You can read more about these retry configurations here.

How can I get my services to register with a specific port in Eureka?

My Setup
I have some services that register with Eureka. This registration info is used by Zuul to route requests to my services. Most of these services run on a port like 9999 or 8080. Each service is on it's own EC2 instance, and I have Nginx routing requests from port 80 to the server's port, so that I can keep my Security Group rules simple.
My Problem
When my service registers with Eureka, it gets registered with ${server.port}, which ends up being 8080 or 9999, etc. When Zuul attempts to route to {ec2host}:8080, it gets blocked by my Security Group rules. Based on the documentation, it looks like I should be able to specify a host and port with eureka.instance.hostname and eureka.instance.nonSecurePort. Whether I use those properties or not, my service registers with it's specific port.
Is there a way to get the Eureka client to register my service with port 80, instead of the server's port?