ambassador 能夠在請求路由以前進行認證處理,通常的咱們可能會使用第三方的認證服務git
基本的環境安裝能夠參考相關文檔github
能夠參考官方文檔,或者https://github.com/rongfengliang/ambassador-learning
https://github.com/datawire/ambassador-auth-service
--- apiVersion: v1 kind: Service metadata: name: example-auth spec: type: ClusterIP selector: app: example-auth ports: - port: 3000 name: http-example-auth targetPort: http-api --- apiVersion: extensions/v1beta1 kind: Deployment metadata: name: example-auth spec: replicas: 1 strategy: type: RollingUpdate template: metadata: labels: app: example-auth spec: containers: - name: example-auth image: datawire/ambassador-auth-service:1.1.1 imagePullPolicy: Always ports: - name: http-api containerPort: 3000 resources: limits: cpu: "0.1" memory: 100Mi kubectl apply -f https://www.getambassador.io/yaml/demo/demo-auth.yaml
--- apiVersion: v1 kind: Service metadata: name: example-auth annotations: getambassador.io/config: | --- apiVersion: ambassador/v0 kind: AuthService name: authentication auth_service: "example-auth:3000" path_prefix: "/extauth" allowed_headers: - "x-qotm-session" spec: type: ClusterIP selector: app: example-auth ports: - port: 3000 name: http-example-auth targetPort: http-api 使用官方提供的配置文件 kubectl apply -f https://www.getambassador.io/yaml/demo/demo-auth-enable.yaml
總的來講仍是比較簡單的,同時比較方便
https://www.getambassador.io/user-guide/auth-tutorial
https://github.com/rongfengliang/ambassador-learningapi