美文网首页nginx从入门到放弃
traffic ingress basic 认证

traffic ingress basic 认证

作者: 大鹏一怒乘风起 | 来源:发表于2020-12-09 10:27 被阅读0次

    basic文件创建
    htpasswd -c auth test
    第一次创建的时候需要加-c
    后面追加不需要

    在K8S创建key文件
    kubectl -n kube-system create secret generic basic-auth --from-file=auth

    ingress 文件覆盖
    1.nginx ingress 模板
    apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
    name: prometheus-ingress
    namespace: kube-system
    annotations:
    nginx.ingress.kubernetes.io/auth-type: basic
    nginx.ingress.kubernetes.io/auth-secret: basic-auth
    spec:
    rules:

    • host: prometheus.devops-test.com
      http:
      paths:
      • path: /
        backend:
        serviceName: prometheus
        servicePort: 9090

    2.traefik ingress 模板
    apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
    name: prometheus-ingress
    namespace: kube-system
    annotations:
    kubernetes.io/ingress.class: traefik
    ingress.kubernetes.io/auth-type: basic
    ingress.kubernetes.io/auth-secret: basic-auth
    spec:
    rules:

    • host: prometheus.devops-test.com
      http:
      paths:
      • path: /
        backend:
        serviceName: prometheus
        servicePort: 9090

    相关文章

      网友评论

        本文标题:traffic ingress basic 认证

        本文链接:https://www.haomeiwen.com/subject/clzcgktx.html