首页 > 解决方案 > 从我的前端 React 应用程序访问我在启用了 istio 的集群中部署的 python graphql 应用程序

问题描述

我有一个示例反应应用程序,它查询 Graphql Python 应用程序以在屏幕上打印硬编码的员工姓名列表。我已经将这两个应用程序部署在一个集群和一个启用了 istio 的命名空间上。

目前,我正在通过我的 React 应用程序中的外部负载均衡器访问 graphql python 应用程序。像这样 -

const cache = new InMemoryCache();
const link = new HttpLink({
  uri: "http://**<<<External-ELB>>**:5555/graphql"
})

//appolo client setup
const client = new ApolloClient({
  cache,
  link

})
class App extends Component{
  render(){
    return(
      <ApolloProvider client={client}>

        <div className="main">
          <h1> Employee Data List</h1>
          <Routes />
        </div>

      </ApolloProvider>
    );
  }
}

我已经尝试为我的应用程序创建一个虚拟服务并添加istio-ingress-gateway ELB 代替External-ELB,这工作正常,但我仍然可以通过浏览器访问我的 graphql 应用程序,这是我想避免的。

有没有办法用 Istio 特使代理来处理这个问题?

我只想用 Istio-Ingress-ELB 公开我的前端并在不公开的情况下访问我的后端应用程序。现在,如何访问我的 python 应用程序而不将其公开为负载均衡器?

提前致谢。

标签: kubernetesgoogle-kubernetes-enginekubectlistiokubernetes-pod

解决方案


推荐阅读