We use a java app called be-index-search-service which runs on k8s, its
service name:
➜  ~ kbg svc -n beta | grep -i index
be-index-search-service                 NodePort       172.19.0.112
 <none>           8080:31777/TCP                  54d

Within k8s cluster i can access this service only by typing `curl
be-index-search-service.beta.svc.cluster.local:8080`:

```
bash-4.4# curl -I be-index-search-service.beta.svc.cluster.local:8080
HTTP/1.1 404
Content-Type: text/html;charset=utf-8
Content-Language: en
Transfer-Encoding: chunked
Date: Tue, 19 Nov 2019 09:14:15 GMT
```

And we use tengine for reverse proxy to access this service on internet via
host: index-search.beta.cnsa.work.
Tengine's config looks like:





































*apiVersion: v1data:  index-search.beta.cnsa.work.conf: |    upstream
index-search_beta_svr {        # vnswrr; # enable VNSWRR load balancing
algorithm.        dynamic_resolve fallback=stale fail_timeout=30s;
server be-index-search-service.beta.svc.cluster.local:8080; # not the
172.19.0.112, because the service ip is dynamic(when delete and re-create)
      keepalive 32;    }    server {        listen                 80;
  server_name            index-search.beta.cnsa.work
<http://index-search.beta.cnsa.work>;        location / {
proxy_connect_timeout       5;            proxy_send_timeout          300;
          proxy_read_timeout          300;            # proxy_set_header
X-Forwarded-Host $host;            proxy_set_header   Host      $host;
      # proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;            #
proxy_set_header   X-Real-IP $remote_addr;
#添加http1.1声明和header中connection重写            proxy_http_version 1.1;
    proxy_set_header Connection "";            proxy_pass
http://index-search_beta_svr <http://index-search_beta_svr>;        }
}kind: ConfigMapmetadata:  name: ngx-gw-index-search.beta.cnsa.work.conf
namespace: cnsa-dot-work*


YuanSheng Wang <[email protected]> 于2019年11月19日周二 下午4:16写道:

> Hi:
>
> Can you supply an example?
>
> I am confused with your question.
>
>
>
> On Tue, Nov 19, 2019 at 3:27 PM Lang Wang <[email protected]> wrote:
>
> > Hi devs,
> >
> > In the k8s service scenario, an upstream maybe like
> > *$SVC.$NS.svc.cluster.local:$PORT, *and the service's ip is None when we
> > set it's type to ClusterIP:None.
> > but apisix only support ip for the Nodex value now.
> >
>
>
> --
> *MembPhis*
> My github: https://github.com/membphis
> Apache APISIX: https://github.com/apache/incubator-apisix
>

Reply via email to