Thường thì cài kiali lúc show trang web thì chúng ta sẽ login bằng user “anonymous”
Nếu bạn muốn có authen chuẩn chỉ hơn thì sem bài viết này.
Authentication Strategies
Anonymous strategy
Access Kiali with no authentication.
Header strategy
Run Kiali behind a reverse proxy responsible for injecting the user’s token, or a token with impersonation.
OpenID Connect strategy
Access Kiali requiring authentication through a third-party OpenID Connect provider.
OpenShift strategy
Access Kiali requiring OpenShift authentication.
Token strategy
Access Kiali requiring a Kubernetes ServiceAccount token.
Như cung cấp ở bên trên thì chúng ta có nhiều cách để authen
1) OpenID Connect strategy
1.1) Config google
Đầu tiên là truy cập:
https://console.developers.google.com/
1.2) Config kiali
https://kiali.io/docs/configuration/authentication/openid/
Như bạn add manifest như hướng dẫn sẽ bị lỗi như ảnh bên dưới.
Chúng ta cần add thêm vào configmap của kiali
strategy: "openid"
openid:
client_id: "506853153623-xxxxxxxxtp21hsbb81n7cs7diujetuv9.apps.googleusercontent.com"
disable_rbac: true
issuer_uri: "https://accounts.google.com"
scopes: ["openid", "email"]
username_claim: "email"
redirect_uri: "http://kiali.nimtechnology.com/kiali"
Tiếp theo bạn apply 1 secret.
apiVersion: v1
kind: Secret
metadata:
name: kiali
namespace: istio-system
labels:
app: kiali
type: Opaque
data:
oidc-secret: "XXXXXXXXXVIb3RCdEUzQUtwT1VnZGktUVNSV0YzUG85WV8="
OK sau khi đã làm sau thì bạn cần redeploy lại kiali.
Và thực hiện đăng nhập thử
1.3) Filter email login follow domain
Note: I tested that the feature only worked with Kiali 1.43.0 ++
Thường thì nếu cấu hình đăng nhập theo hình thức trên, cứ email nào đăng nhập google thì đều có thể login vào kiali của bạn.
https://kiali.io/docs/configuration/authentication/openid/#configuring-allowed-domains
spec:
auth:
openid:
allowed_domains:
- example.com
- foo.com
1.4) mode read only on kiali
Ở thời điểm hiện tại thì đối với mình kiali cũng chỉ để view là chính và mình cũng không có nhu cầu config trên kiali
Nếu mình muốn force chỉ view trên kiali thì config như trong configmap kiali
view_only_mode: false