Loadbalance and upstream

I just started using kong(v0.13) , some doubts about kong’s loadbalance reference , ref : https://getkong.org/docs/0.13.x/loadbalancing/#ring-balancer

follow the reference

$ curl -X POST http://kong:8001/upstreams \
    --data "name=address.v1.service"

# add two targets to the upstream
$ curl -X POST http://kong:8001/upstreams/address.v1.service/targets \
    --data "target=192.168.34.15:80"
    --data "weight=100"
$ curl -X POST http://kong:8001/upstreams/address.v1.service/targets \
    --data "target=192.168.34.16:80"
    --data "weight=50"

i already have the upstream address.v1.service,and its targets 192.168.34.15:80 and 192.168.34.16:80
maybe it corresponds to nginx’s config

upstream address.v1.service{
    server 192.168.34.15:80 weight=100;
    server 192.168.34.16:80 weight=50;
}

but i don’t konw how to configure the location to map my request,like nginx’s config

location /hello {
    proxy_pass http://address.v1.service/
}

how can map the request uri /hello to the upstream address.v1.service in kong?

kong’s route may only link to a service , can’t link to a upstream.

The API entity was deprecated in Kong 0.13.0. I note this.

You don’t need Nginx’s config to use the loadbalancing features.

if your upstream is called address.v1.service, you can create a service by specifying url=http://address.v1.service/some/path. When Kong does DNS resolution for a backend service, it will first check if the name is available as an upstream, if so, that upstream will be used to loadbalance the requests over the targets as defined in the upstream.

thanks ,it works:grinning: