首页 > 解决方案 > 在 Kubernetes 上转发部署时出现 HTTP/2 302 错误

问题描述

我已经在 Kubernetes 上部署了启用了安全性的 elasticsearch/kibana helm chart,测试表明一切正常,并且测试在 local 上使用 curl,

对于弹性搜索:

{
  "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云平台的UI来暴露用于暴露服务的服务UI,另一种是使用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

任何人都可以帮助我吗?

标签: kuberneteskibana

解决方案


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

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

您可以按照本指南自定义规则。

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

如果这不起作用,则编辑default-allow-internal规则以接受来自任何您想要的流量。

请让我知道这是否有帮助。


推荐阅读