我和kubernetes K3S,Istio,MetalLB和CertManager有个问题。
我的集群托管在一个带有一个公共ip的VPS上。由于我的服务提供商为我提供了一个负载均衡器,我正在使用MetlLb和我的公共Ip通过ingressgateway连接互联网。
在thsis集群中,我的应用程序有三个名称空间,一个用于qa环境、othe和prod环境。
我用公共ip配置了dns提供程序中的ip,并将CertManager配置为从letsencrypt获得证书(我使用的是颁发程序而不是ClusterIssuer,因为我希望对dev和qa使用暂存api,对于prod使用prod)。证书是可以颁发的,但是istio的网关只在我使用端口80时才在路由流量,当我启用通过https无法到达站点的443时,才会得到一个"ERR_CONNECTION_RESET“。
我不明白为什么80岁的人都好,而443人的人不行。我的应用程序通过http公开端口80中的通信量。
这是我的yaml文件:
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-v1
spec:
replicas: 3
selector:
matchLabels:
app: hello-v1
template:
metadata:
labels:
app: hello-v1
spec:
containers:
- name: hello
image: pablin.dynu.net:5000/chevaca/chevacaweb:latest
imagePullPolicy: IfNotPresent
ports:
- containerPort: 80
resources:
requests:
memory: "64Mi"
cpu: "200m"
limits:
memory: "128Mi"
cpu: "500m"kind: Service
apiVersion: v1
metadata:
name: hello-v1-svc
namespace: chevaca-qa
spec:
selector:
app: hello-v1
ports:
- protocol: TCP
port: 80
targetPort: 80apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: qa-app-gateway
namespace: chevaca-qa
spec:
selector:
istio: ingressgateway
servers:
- port:
name: http
number: 80
protocol: HTTP
hosts:
- qa-app.chevaca.com
- port:
name: https
number: 443
protocol: HTTPS
tls:
mode: SIMPLE
credentialName: front-cert
hosts:
- qa-app.chevaca.comapiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: front-app
namespace: chevaca-qa
spec:
hosts:
- qa-app.chevaca.com
gateways:
- qa-app-gateway
http:
- route:
- destination:
host: hello-v1-svc
port:
number: 80发布于 2022-08-29 03:31:01
是固定的,
解决方案是在istio命名空间中创建证书,其秘密名称为ingressgateway certs。
这样,证书就从istio安装在入口网关服务中,无需在来自istio的自定义资源上配置其他任何东西。如果您有多个名称空间,就像我的场景一样,您可以在证书上使用多个主机,也可以使用通配符。
发布于 2022-08-29 01:12:35
我取得了一些进展,我可以在名称空间istio-system上使用https,但在默认情况下不能使用https,也不能使用我的任何custon名称空间。我现在正在研究如何解决这个问题。
https://stackoverflow.com/questions/73339535
复制相似问题