ingress-nginx配置basic认证 SoulChild 收录于 kubernetes 2020-08-28 11:00 约 69 字 预计阅读 1 分钟 - 次阅读 目录 1.创建认证文件(注意文件名必须叫auth)2.生成secret3.配置ingress警告本文最后更新于 2020-08-28 11:08,文中内容可能已过时。1.创建认证文件(注意文件名必须叫auth)1 htpasswd -bc auth admin 123456 2.生成secret1 kubectl create secret generic --from-file=auth --namespace=kube-ops prome-basic-auth 3.配置ingress 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: prometheus namespace: kube-ops annotations: kubernetes.io/ingress.class: "nginx" nginx.ingress.kubernetes.io/auth-type: basic nginx.ingress.kubernetes.io/auth-secret: prome-basic-auth nginx.ingress.kubernetes.io/auth-realm: '提示信息' spec: rules: - host: prom.soulchild.cn http: paths: - path: / backend: serviceName: prometheus servicePort: http 请我喝杯水 赞赏 微信号 微信打赏Please enable JavaScript to view the comments powered by giscus.