You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apisix.apache.org by yawang liang <aa...@gmail.com> on 2022/06/02 07:54:26 UTC

外部apisix 如何通过k8s实现自动发现

尊敬的apisix开发团队您好:
  我通过apisix官网文档:https://apisix.apache.org/docs/apisix/discovery/kubernetes
配置了外部独立的apisix 并希望通过此配置让外部独立的apisix能过直接list watch到kubernetes内部的entpoints 列表
但是我根据文档配置完后发现一直在报错 报错如下:
2022/06/02 15:53:40 [error] 29284#29284: *175 [lua]
informer_factory.lua:292: list failed, kind: Endpoints, reason: Bad
Request: missing required Host header, message : 400 Bad Request: missing
required Host header, context: ngx.timer
希望得到您的帮助

Re: 外部apisix 如何通过k8s实现自动发现

Posted by zhixiongdu027 <ro...@libssl.com>.
你好:

    如果 Kubernetes 服务发现模块运行在集群外,
    你需要:
    1.   获取到  APIServer 的 Host, Port  地址

    2.   新建 一个  有 ListWatch  K8S Endpoints 的 ServiceAccount , 获取 其 
Token 值 .   获取 Token 值的方法在你发送的文档链接有提及
    3.   按如下格式填充配置

|discovery:kubernetes:service:schema:httpshost:# enter apiserver host 
value hereport:# enter apiServer port value hereclient:token:# enter 
serviceaccount token value here#token_file: # enter file path here|

Copy


     需要提醒你的是, 如果 apisix 运行在集群外部, 通过  discovery 获取到的 
pod ip  有可能无法访问 ( 视具体情况 )


> 尊敬的apisix开发团队您好:
>    我通过apisix官网文档:https://apisix.apache.org/docs/apisix/discovery/kubernetes
> 配置了外部独立的apisix 并希望通过此配置让外部独立的apisix能过直接list watch到kubernetes内部的entpoints 列表
> 但是我根据文档配置完后发现一直在报错 报错如下:
> 2022/06/02 15:53:40 [error] 29284#29284: *175 [lua]
> informer_factory.lua:292: list failed, kind: Endpoints, reason: Bad
> Request: missing required Host header, message : 400 Bad Request: missing
> required Host header, context: ngx.timer
> 希望得到您的帮助

Re: 外部apisix 如何通过k8s实现自动发现

Posted by Jintao Zhang <zh...@apache.org>.
In addition, you can also deploy the APISIX Ingress controller outside the
Kubernetes cluster

wei jin <kv...@apache.org> 于2022年6月5日周日 11:26写道:

> Please take a look at this project
> https://github.com/apache/apisix-ingress-controller, you can deploy Apache
> APISIX outside the kubernetes cluster, just deploy
> apisix-ingress-controller inside the kubernetes cluster.
>
>  apisix-ingress-controller will watch the endpoints in k8s, and sync to
> APISIX.
>
> zhixiongdu027 <ro...@libssl.com> 于2022年6月2日周四 16:33写道:
>
> > 你好:
> >
> >     如果 Kubernetes 服务发现模块运行在集群外,
> >     你需要:
> >     1.   获取到  APIServer 的 Host, Port  地址
> >
> >     2.   新建 一个  有 ListWatch  K8S Endpoints 的 ServiceAccount , 获取 其
> > Token 值 .   获取 Token 值的方法在你发送的文档链接有提及
> >     3.   按如下格式填充配置
> >
> > |discovery:kubernetes:service:schema:httpshost:# enter apiserver host
> > value hereport:# enter apiServer port value hereclient:token:# enter
> > serviceaccount token value here#token_file: # enter file path here|
> >
> > Copy
> >
> >
> >      需要提醒你的是, 如果 apisix 运行在集群外部, 通过  discovery 获取到的
> > pod ip  有可能无法访问 ( 视具体情况 )
> >
> >
> > > 尊敬的apisix开发团队您好:
> > >    我通过apisix官网文档:
> > https://apisix.apache.org/docs/apisix/discovery/kubernetes
> > > 配置了外部独立的apisix 并希望通过此配置让外部独立的apisix能过直接list
> watch到kubernetes内部的entpoints
> > 列表
> > > 但是我根据文档配置完后发现一直在报错 报错如下:
> > > 2022/06/02 15:53:40 [error] 29284#29284: *175 [lua]
> > > informer_factory.lua:292: list failed, kind: Endpoints, reason: Bad
> > > Request: missing required Host header, message : 400 Bad Request:
> missing
> > > required Host header, context: ngx.timer
> > > 希望得到您的帮助
>

Re: 外部apisix 如何通过k8s实现自动发现

Posted by wei jin <kv...@apache.org>.
Please take a look at this project
https://github.com/apache/apisix-ingress-controller, you can deploy Apache
APISIX outside the kubernetes cluster, just deploy
apisix-ingress-controller inside the kubernetes cluster.

 apisix-ingress-controller will watch the endpoints in k8s, and sync to
APISIX.

zhixiongdu027 <ro...@libssl.com> 于2022年6月2日周四 16:33写道:

> 你好:
>
>     如果 Kubernetes 服务发现模块运行在集群外,
>     你需要:
>     1.   获取到  APIServer 的 Host, Port  地址
>
>     2.   新建 一个  有 ListWatch  K8S Endpoints 的 ServiceAccount , 获取 其
> Token 值 .   获取 Token 值的方法在你发送的文档链接有提及
>     3.   按如下格式填充配置
>
> |discovery:kubernetes:service:schema:httpshost:# enter apiserver host
> value hereport:# enter apiServer port value hereclient:token:# enter
> serviceaccount token value here#token_file: # enter file path here|
>
> Copy
>
>
>      需要提醒你的是, 如果 apisix 运行在集群外部, 通过  discovery 获取到的
> pod ip  有可能无法访问 ( 视具体情况 )
>
>
> > 尊敬的apisix开发团队您好:
> >    我通过apisix官网文档:
> https://apisix.apache.org/docs/apisix/discovery/kubernetes
> > 配置了外部独立的apisix 并希望通过此配置让外部独立的apisix能过直接list watch到kubernetes内部的entpoints
> 列表
> > 但是我根据文档配置完后发现一直在报错 报错如下:
> > 2022/06/02 15:53:40 [error] 29284#29284: *175 [lua]
> > informer_factory.lua:292: list failed, kind: Endpoints, reason: Bad
> > Request: missing required Host header, message : 400 Bad Request: missing
> > required Host header, context: ngx.timer
> > 希望得到您的帮助