-
Notifications
You must be signed in to change notification settings - Fork 25
/
3-oauth2-proxy.yaml
101 lines (101 loc) · 2.96 KB
/
3-oauth2-proxy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# Source: https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/docs/examples/auth/oauth-external-auth/oauth2-proxy.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
k8s-app: oauth2-proxy
name: oauth2-proxy
spec:
replicas: 1
selector:
matchLabels:
k8s-app: oauth2-proxy
template:
metadata:
labels:
k8s-app: oauth2-proxy
spec:
containers:
- args:
- --email-domain=* #
- --http-address=0.0.0.0:4180 # accept from anywhere to port 4180
- --whitelist-domain=.kubemaster.me # any subdomain
- --request-logging=true # logging
- --show-debug-on-error=true # logging
- --provider=google
- --cookie-secure=true # must have with https
- --cookie-domain=.kubemaster.me # authed to any subdomain
- --cookie-httponly=true # default
- --cookie-refresh=0 # no expiration
- --set-authorization-header=true
- --pass-authorization-header=true
# - --upstream=http://localhost:4180 # IRRELEVANT - used only when there's 1 backend server
# - --redirect-url= IRRELEVANT - fetched from /oauth2/start?rd=https://$host$escaped_request_uri
env:
- name: OAUTH2_PROXY_COOKIE_SECRET
valueFrom:
secretKeyRef:
name: oauth2-proxy-cookie-secret
key: oauth2_proxy_cookie_secret
- name: OAUTH2_PROXY_CLIENT_ID
valueFrom:
secretKeyRef:
name: google-credentials
key: google_client_id
- name: OAUTH2_PROXY_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: google-credentials
key: google_client_secret
image: quay.io/oauth2-proxy/oauth2-proxy:v7.2.1
imagePullPolicy: IfNotPresent
name: oauth2-proxy
ports:
- containerPort: 4180
protocol: TCP
resources:
limits:
memory: 400Mi
cpu: "200m"
requests:
memory: 200Mi
cpu: 100m
---
apiVersion: v1
kind: Service
metadata:
labels:
k8s-app: oauth2-proxy
name: oauth2-proxy
spec:
ports:
- name: http
port: 4180
protocol: TCP
targetPort: 4180
selector:
k8s-app: oauth2-proxy
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: oauth2-proxy
annotations:
cert-manager.io/cluster-issuer: tls-ca-issuer # https://cert-manager.io/docs/usage/ingress/
spec:
tls:
- hosts:
- auth.kubemaster.me
secretName: oauth2-proxy-tls-secret
ingressClassName: nginx
rules:
- host: auth.kubemaster.me
http:
paths:
- path: /oauth2
pathType: Prefix
backend:
service:
name: oauth2-proxy
port:
number: 4180