Basic Authentication¶
This example shows how to add authentication in a Ingress rule using a secret that contains a file generated with htpasswd
. It's important the file generated is named auth
(actually - that the secret has a key data.auth
), otherwise the ingress-controller returns a 503.
Create htpasswd file¶
$ htpasswd -c auth foo
New password: <bar>
New password:
Re-type new password:
Adding password for user foo
Convert htpasswd into a secret¶
$ kubectl create secret -n generic basic-auth --from-file=auth
secret "basic-auth" created
Examine secret¶
$ kubectl get secret basic-auth -o yaml
apiVersion: v1
data:
auth: Zm9vOiRhcHIxJE9GRzNYeWJwJGNrTDBGSERBa29YWUlsSDkuY3lzVDAK
kind: Secret
metadata:
name: basic-auth
namespace: default
type: Opaque
?内容类评语?
每一个段落都紧密相连,逻辑清晰,展现了作者高超的写作技巧。
作者的观点新颖且实用,让人在阅读中获得了新的思考和灵感。