ingress-nginx 配置 basic 认证

目录
警告
本文最后更新于 2020-08-28 11:08,文中内容可能已过时。
1
htpasswd -bc auth admin 123456
1
kubectl create secret generic --from-file=auth --namespace=kube-ops prome-basic-auth
 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
请我喝杯水
SoulChild 微信号 微信号
SoulChild 微信打赏 微信打赏
0%