通过Kubernetes设置AWS SSL证书

发布于 2025-02-05 04:38:49 字数 873 浏览 2 评论 0原文

问题:重新启动入口后,将删除SSL证书,您必须不断安装它们。搜索后,我发现您可以以某种方式在YAML配置文件中配置SSL证书。使用我无法实现所需结果的配置。

带有入口服务配置的YAML:

apiVersion: v1
kind: Service

metadata:
  name: nginx-ingress
  annotations:
    nginx.ingress.kubernetes.io/aws-load-balancer-ssl-cert: arn:aws:acm:...
    nginx.ingress.kubernetes.io/aws-load-balancer-backend-protocol: TCP
    nginx.ingress.kubernetes.io/aws-load-balancer-ssl-ports: "https"

spec:
  type: LoadBalancer

  selector:
    name: nginx-ingress

  ports:
  - name: http
    port: 80
    targetPort: 80
    nodePort: 31823
    protocol: TCP

  - name: https
    port: 443
    targetPort: 443
    nodePort: 31822
    protocol: TCP

这就是AWS中的工作设置。如何通过配置文件实现此结果?

Problem: after restarting ingress, ssl certificates are removed and you have to constantly install them back. After some searching, I found out that you can somehow configure ssl certificates in the yaml configuration file. Playing with the configs I did not manage to achieve the desired result.

yaml with ingress service configs:

apiVersion: v1
kind: Service

metadata:
  name: nginx-ingress
  annotations:
    nginx.ingress.kubernetes.io/aws-load-balancer-ssl-cert: arn:aws:acm:...
    nginx.ingress.kubernetes.io/aws-load-balancer-backend-protocol: TCP
    nginx.ingress.kubernetes.io/aws-load-balancer-ssl-ports: "https"

spec:
  type: LoadBalancer

  selector:
    name: nginx-ingress

  ports:
  - name: http
    port: 80
    targetPort: 80
    nodePort: 31823
    protocol: TCP

  - name: https
    port: 443
    targetPort: 443
    nodePort: 31822
    protocol: TCP

This is what the working settings in aws look like. How can you achieve this result through the configuration file?

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜司空 2025-02-12 04:38:49

解决方案是删除这条线

nginx.ingress.kubernetes.io/aws-load-balancer-backend-protocol: TCP

,并将HTTPS的目标端口值从443更改为80

- name: https
  port: 443
  targetPort: 80
  nodePort: 31822
  protocol: TCP

The solution was to remove this line

nginx.ingress.kubernetes.io/aws-load-balancer-backend-protocol: TCP

And change the targetPort value of https from 443 to 80

- name: https
  port: 443
  targetPort: 80
  nodePort: 31822
  protocol: TCP
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文