Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/kubernetes/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Networking 你';对Kubernetes中启用SSL的服务器端口讲普通HTTP_Networking_Kubernetes_Istio - Fatal编程技术网

Networking 你';对Kubernetes中启用SSL的服务器端口讲普通HTTP

Networking 你';对Kubernetes中启用SSL的服务器端口讲普通HTTP,networking,kubernetes,istio,Networking,Kubernetes,Istio,我的网关文件如下所示 apiVersion: networking.istio.io/v1alpha3 kind: Gateway metadata: name: my-gateway-secure namespace: myapp spec: selector: istio: ingressgateway # use istio default controller servers: - port: number: 443 name: htt

我的网关文件如下所示

apiVersion: networking.istio.io/v1alpha3 kind: Gateway metadata: name: my-gateway-secure namespace: myapp spec: selector: istio: ingressgateway # use istio default controller servers: - port: number: 443 name: https protocol: HTTPS tls: mode: SIMPLE serverCertificate: /etc/istio/ingressgateway-certs/tls.crt privateKey: /etc/istio/ingressgateway-certs/tls.key #caCertificates: /etc/istio/ingressgateway-ca-certs/kbundle.crt hosts: - "*" apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: name: my-gateway-service-secure namespace:myapp spec: hosts: - "sub.domaincom" gateways: - my-gateway-secure http: - route: - destination: host: my-mono port: number: 443 protocol: TCP apiVersion:networking.istio.io/v13 种类:网关 元数据: 姓名:我的网关安全 名称空间:myapp 规格: 选择器: istio:ingressgateway#使用istio默认控制器 服务器: -端口: 电话:443 名称:https 协议:HTTPS tls: 模式:简单 服务器证书:/etc/istio/ingresgateway证书/tls.crt 私钥:/etc/istio/ingresgateway证书/tls.key #caCertificates:/etc/istio/ingresgateway ca certs/kbundle.crt 主持人: - "*" apiVersion:networking.istio.io/v13 种类:虚拟服务 元数据: 名称:我的网关服务安全 名称空间:myapp 规格: 主持人: -“sub.domaincom” 网关: -我的大门是安全的 http: -路线: -目的地: 主持人:我的mono 端口: 电话:443 协议:TCP 我的服务文件是

apiVersion: v1 kind: Service metadata: name: my-mono namespace: myapp labels: tier: backend spec: selector: app: my-mono tier: backend ports: - port: 443 name: https protocol: TCP 版本:v1 种类:服务 元数据: 姓名:我的mono 名称空间:myapp 标签: 层:后端 规格: 选择器: 应用程序:我的单声道 层:后端 端口: -港口:443 名称:https 协议:TCP 部署文件如下所示

apiVersion: apps/v1 kind: Deployment metadata: name: my-mono namespace: myapp spec: replicas: 1 selector: matchLabels: app: my-mono template: metadata: labels: app: my-mono spec: containers: - name: my-mono image: myapacheimage imagePullPolicy: Never ports: - containerPort: 443 apiVersion:apps/v1 种类:部署 元数据: 姓名:我的mono 名称空间:myapp 规格: 副本:1份 选择器: 火柴标签: 应用程序:我的单声道 模板: 元数据: 标签: 应用程序:我的单声道 规格: 容器: -姓名:我的mono 图片:myapacheimage 政策:绝不 端口: -集装箱港口:443 当我使用网关访问我的服务时,它会显示

Bad Request Your browser sent a request that this server could not understand. Reason: You're speaking plain HTTP to an SSL-enabled server port. Instead use the HTTPS scheme to access this URL, please. Apache/2.4.38 (Debian) Server at 10.0.159.77 Port 443 错误的请求 您的浏览器发送了此服务器无法理解的请求。 原因:您正在对启用SSL的服务器端口使用普通HTTP。 请改用HTTPS方案访问此URL。 10.0.159.77端口443的Apache/2.4.38(Debian)服务器
我可以确认apache仅在443上侦听,并且配置正确

您的配置使用istio网关上的
TLS
终端。因此,进入istio入口的
HTTPS
流量在到达您的服务端点之前被解密为普通
HTTP
流量


要解决此问题,您需要配置对
HTTPS
服务的
HTTPS
入口访问,即配置入口网关以执行
SNI
直通,而不是对传入请求执行
TLS
终止

您可以在《istio文档指南》中找到不带TLS的入口网关示例


您的
网关
虚拟服务
应该如下所示:

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: my-gateway-secure
  namespace: myapp
spec:
  selector:
    istio: ingressgateway # use istio default controller
  servers:
  - port:
      number: 443
      name: https
      protocol: HTTPS
    tls:
      mode: PASSTHROUGH
    hosts:
    - "*"

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: my-gateway-service-secure
  namespace:myapp
spec:
  hosts:
  - "sub.domaincom"
  gateways:
  - my-gateway-secure
  tls:
  - match:
    - port: 443
      sni_hosts:
      - "sub.domaincom"
    route:
    - destination:
        host: my-mono
        port:
          number: 443

希望有帮助。

在url中使用https?是的,我正在使用https协议访问:TCP be https?10.0.159.77是什么的IP?在服务声明中不允许,在网关的服务声明中不显示任何不同的结果。最佳答案。多谢了,我知道了。但我对主机的价值和sni_主机有些困惑。你的回答帮助我彻底解决了这个问题。非常感谢。