• Kubernetes Ingress配置HTTPS


    简介

    K8S的Ingress启用Https

    准备:

    1. 一个https的证书,阿里云可以免费申请一个单域名证书,有效期一年

    步骤:

    1. 创建 secret
    $unzip unzip 3937326_app.*****.com_nginx.zip  #该文件就是阿里云上下载下来的证书
    $mv 3937326_app.*****.com.pem tls.crt
    $mv 3937326_app.*****.com.key tls.key
    $kubectl -n prod create secret tls app-*****-com-secret --key ./tls.key --cert ./tls.crt
    1. 在Ingress中引用secret,配置https
    ---
    apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
      name: *****-prod
      namespace: prod
      labels:
        app: *****-prod
      annotations:
        nginx.ingress.kubernetes.io/rewrite-target: / #重写路径
        nginx.ingress.kubernetes.io/ssl-redirect: 'true' #http 自动转https
        nginx.ingress.kubernetes.io/proxy-connect-timeout: "600" #修改代理超时时间,默认是60s
        nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
        nginx.ingress.kubernetes.io/proxy-send-timeout: "600"
    spec:
      tls:
      - hosts:
        - 'app.*****.com'
        secretName: app-*****-com-secret
      rules:
        - host: "app.*****.com"
          http:
            paths:
              
              
              - path: /
                backend:
                  serviceName: qwer-mobile-prod
                  servicePort: 80
     
    1. 通过https://app.*****.com访问服务
  • 相关阅读:
    Surface RT2装Win10出现 "INF不包含数字签名信息"【已解决】
    树上倍增LCA模版
    sql注入
    python 调用 telnet
    ss
    【总结氵】2021.02.27 省选模拟
    2021.03.13省选模拟 抽卡(card)
    树链剖分之重链剖分 模板
    多项式求逆 模板
    NTT快速数论变换 模板
  • 原文地址:https://www.cnblogs.com/litzhiai/p/15090986.html
Copyright © 2020-2023  润新知