簡體   English   中英

在Kubernetes集群中運行的Elasticsearch Pod的基本身份驗證

[英]Basic authentication for elasticsearch pod running in kubernetes cluster

我們需要為運行在我們的kubernetes集群中的elasticsearch和kibana oss(Apache許可證)創建基本(用戶名/密碼)身份驗證。 我們在AWS(EKS),Google Cloud(GKE),本地安裝中有多雲安裝,並且我們計划使用Azure。

我認為具有基本身份驗證的nginx反向代理在每個elasticsearch / kibana pod中作為sidecar容器運行。 這將是一個簡單且已知的解決方案。

問題是:什么是k8s集群中正確的解決方案? 我們可以從無數種易於維護的解決方案中得到什么?

好吧,如果您使用的是nginx ingress controller ,則可以添加如下基本身份驗證:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: kibana
  namespace: kibana
  annotations:
    kubernetes.io/ingress.class: "nginx"
    # type of authentication
    nginx.ingress.kubernetes.io/auth-type: basic
    # name of the secret that contains the user/password definitions
    nginx.ingress.kubernetes.io/auth-secret: my-secret-basic-auth
    # message to display with an appropriate context why the authentication is required
    nginx.ingress.kubernetes.io/auth-realm: 'Authentication Required - kibana-admin'
  ...
  ...

必須使用htpasswd創建my-secret-basic-auth

$ htpasswd -c auth foo
New password: <bar>
New password:
Re-type new password:
Adding password for user foo

然后,您需要創建秘密:

$ kubectl create secret generic my-secret-basic-auth --from-file=auth
secret "my-secret-basic-auth" created

這很簡單,易於維護,但是您將永遠與nginx ingress controller

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM