[CI SKIP] Use ingress v1 for nginx-ingress basic auth demo

This commit is contained in:
niusmallnan 2023-04-10 17:18:15 +08:00
parent ea49f9d3b4
commit 10e5323c95
2 changed files with 8 additions and 6 deletions

View File

@ -13,9 +13,9 @@ htpasswd -nb username password | base64
To install this mode, just run this script: To install this mode, just run this script:
``` ```
kubectl apply -f ./secret.yaml kubectl create -f ./secret.yaml
export MY_IP=$(curl -sL ipinfo.io/ip) export MY_IP=$(curl -sL ipinfo.io/ip)
envsubst < ./ingress.yaml.tpl | kubectl apply -f - envsubst < ./ingress.yaml.tpl | kubectl create -f -
``` ```
For more infos: https://kubernetes.github.io/ingress-nginx/examples/auth/basic/ For more infos: https://kubernetes.github.io/ingress-nginx/examples/auth/basic/

View File

@ -2,7 +2,7 @@
# To use sslip.io: https://sslip.io/ # To use sslip.io: https://sslip.io/
# To get your public IP: curl ipinfo.io/ip # To get your public IP: curl ipinfo.io/ip
apiVersion: networking.k8s.io/v1beta1 apiVersion: networking.k8s.io/v1
kind: Ingress kind: Ingress
metadata: metadata:
name: kube-explorer name: kube-explorer
@ -10,7 +10,6 @@ metadata:
labels: labels:
app: kube-explorer app: kube-explorer
annotations: annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/auth-type: basic nginx.ingress.kubernetes.io/auth-type: basic
nginx.ingress.kubernetes.io/auth-secret: kube-explorer nginx.ingress.kubernetes.io/auth-secret: kube-explorer
nginx.ingress.kubernetes.io/auth-realm: 'Authentication Required - kube-explorer' nginx.ingress.kubernetes.io/auth-realm: 'Authentication Required - kube-explorer'
@ -20,6 +19,9 @@ spec:
http: http:
paths: paths:
- path: / - path: /
pathType: Prefix
backend: backend:
serviceName: kube-explorer service:
servicePort: 8989 name: kube-explorer
port:
number: 8989