在Kubernetes上转发部署时发生HTTP / 2 302错误

时间:2019-07-12 12:41:28

标签: kubernetes kibana

我已经在Kubernetes上部署了启用了安全性的elasticsearch / kibana掌舵图,测试显示一切正常,并且测试在本地上使用curl

用于Elasticsearch:

{
  "cluster_name" : "security",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 3,
  "number_of_data_nodes" : 3,
  "active_primary_shards" : 3,
  "active_shards" : 6,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 100.0
}

curl -I -k -u elastic:$ Password https://localhost:5601/app/kibana

HTTP/1.1 200 OK
content-security-policy: script-src 'unsafe-eval' 'nonce-hVJdRFhEJHdFV5kW'; worker-src blob:; child-src blob:
kbn-name: kibana
kbn-xpack-sig: 0ebe654e32c040bd4b2aff05c3931890
cache-control: no-cache
content-type: text/html; charset=utf-8
content-length: 81348
vary: accept-encoding
connection: close
Date: Thu, 11 Jul 2019 11:23:38 GMT

但是当我转发部署以获取UI时,出现此错误:

  

错误:

     

无法在端口8080上连接到Cloud Shell。

     

确保您的服务器正在侦听端口8080,然后重试。

此外,当我卷曲转发的链接时,它还会显示HTTP / 2 302错误。

我使用了2种方法,一种是使用Google Cloud Platform的用户界面来公开服务UI used to expose the service, 另一个是通过shell使用端口转发:

&& echo "# When the next line says 'Forwarding from...', go to: https://ssh.cloud.google.com/devshell/proxy?port=8080" && kubectl port-forward $(kubectl get pod --selector="app=kibana,release=
helm-kibana-security" --output jsonpath='{.items[0].metadata.name}') 8080:5601--project test-dev \
Fetching cluster endpoint and auth data.orwarding from...', go to: https://ssh.cloud.google.com/devshell/proxy?port=8080" && kubectl port-forward $(kubectl getpod --selector="app=kibana,release=h
kubeconfig entry generated for test-backend.
# When the next line says 'Forwarding from...', go to: https://ssh.cloud.google.com/devshell/proxy?port=8080
Forwarding from 127.0.0.1:8080 -> 5601

请问有人可以帮我吗?

1 个答案:

答案 0 :(得分:0)

这看起来像是防火墙规则问题。

您可以通过控制台>项目>网络> VPC网络>防火墙规则>创建防火墙规则来创建其他规则。

您可以按照以下guide自定义规则。

如果需要,还可以删除目标标签。

如果那行不通,那就编辑{{1}}规则以接受来自您想要的任何流量。

请让我知道是否有帮助。