2020-10-10 15:46:27 +00:00
|
|
|
apiVersion: v1
|
2021-10-23 16:57:14 +00:00
|
|
|
kind: Namespace
|
|
|
|
metadata:
|
|
|
|
name: auth-proxy
|
|
|
|
---
|
|
|
|
apiVersion: v1
|
2020-10-10 15:46:27 +00:00
|
|
|
kind: Secret
|
|
|
|
metadata:
|
|
|
|
name: auth-proxy
|
2021-10-23 16:57:14 +00:00
|
|
|
namespace: auth-proxy
|
2020-10-10 15:46:27 +00:00
|
|
|
annotations:
|
|
|
|
kube-1password: mr6spkkx7n3memkbute6ojaarm
|
|
|
|
kube-1password/vault: Kubernetes
|
|
|
|
type: Opaque
|
|
|
|
---
|
2021-10-23 16:57:14 +00:00
|
|
|
apiVersion: v1
|
|
|
|
kind: Secret
|
|
|
|
metadata:
|
|
|
|
name: tailscale-auth
|
|
|
|
namespace: auth-proxy
|
|
|
|
annotations:
|
|
|
|
kube-1password: 2cqycmsgv5r7vcyvjpblcl2l4y
|
|
|
|
kube-1password/vault: Kubernetes
|
|
|
|
type: Opaque
|
|
|
|
---
|
2020-10-10 15:46:27 +00:00
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: Deployment
|
|
|
|
metadata:
|
|
|
|
name: auth-proxy
|
2021-10-23 16:57:14 +00:00
|
|
|
namespace: auth-proxy
|
2020-10-10 15:46:27 +00:00
|
|
|
labels:
|
|
|
|
app: auth-proxy
|
|
|
|
spec:
|
|
|
|
replicas: 1
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
app: auth-proxy
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app: auth-proxy
|
|
|
|
spec:
|
2021-10-23 16:57:14 +00:00
|
|
|
dnsPolicy: None
|
|
|
|
dnsConfig:
|
|
|
|
nameservers:
|
|
|
|
- 100.100.100.100
|
2020-10-10 15:46:27 +00:00
|
|
|
containers:
|
2021-10-23 16:57:14 +00:00
|
|
|
- name: oauth-proxy
|
|
|
|
image: quay.io/oauth2-proxy/oauth2-proxy:v7.2.0
|
|
|
|
args:
|
2020-10-10 15:46:27 +00:00
|
|
|
- --cookie-secure=false
|
|
|
|
- --provider=oidc
|
|
|
|
- --provider-display-name=Auth0
|
2021-10-23 16:57:14 +00:00
|
|
|
- --upstream=http://talos.averagemarcus.github.beta.tailscale.net
|
|
|
|
- --http-address=0.0.0.0:8080
|
2020-10-10 15:46:27 +00:00
|
|
|
- --email-domain=*
|
|
|
|
- --pass-basic-auth=false
|
|
|
|
- --pass-access-token=false
|
|
|
|
- --oidc-issuer-url=https://marcusnoble.eu.auth0.com/
|
|
|
|
- --cookie-secret=KDGD6rrK6cBmryyZ4wcJ9xAUNW9AQNFT
|
|
|
|
- --cookie-expire=336h0m0s
|
|
|
|
env:
|
|
|
|
- name: HOST_IP
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
apiVersion: v1
|
|
|
|
fieldPath: status.podIP
|
|
|
|
- name: OAUTH2_PROXY_CLIENT_ID
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
key: username
|
|
|
|
name: auth-proxy
|
|
|
|
- name: OAUTH2_PROXY_CLIENT_SECRET
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
key: password
|
|
|
|
name: auth-proxy
|
|
|
|
ports:
|
|
|
|
- containerPort: 8080
|
|
|
|
protocol: TCP
|
|
|
|
resources:
|
|
|
|
limits:
|
|
|
|
memory: 50Mi
|
|
|
|
requests:
|
|
|
|
memory: 50Mi
|
2021-10-23 16:57:14 +00:00
|
|
|
- name: tailscale
|
|
|
|
image: ghcr.io/tailscale/tailscale:latest
|
2021-12-23 18:35:57 +00:00
|
|
|
imagePullPolicy: Always
|
2021-10-23 16:57:14 +00:00
|
|
|
env:
|
|
|
|
- name: AUTH_KEY
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
name: tailscale-auth
|
|
|
|
key: password
|
|
|
|
securityContext:
|
|
|
|
capabilities:
|
|
|
|
add:
|
|
|
|
- NET_ADMIN
|
|
|
|
command:
|
|
|
|
- sh
|
|
|
|
- -c
|
|
|
|
- |
|
|
|
|
export PATH=$PATH:/tailscale/bin
|
|
|
|
if [[ ! -d /dev/net ]]; then mkdir -p /dev/net; fi
|
|
|
|
if [[ ! -c /dev/net/tun ]]; then mknod /dev/net/tun c 10 200; fi
|
|
|
|
echo "Starting tailscaled"
|
|
|
|
tailscaled --socket=/tmp/tailscaled.sock &
|
|
|
|
PID=$!
|
|
|
|
echo "Running tailscale up"
|
|
|
|
tailscale --socket=/tmp/tailscaled.sock up \
|
|
|
|
--accept-dns=true \
|
|
|
|
--authkey=${AUTH_KEY} \
|
2021-12-23 18:30:28 +00:00
|
|
|
--hostname=auth-proxy-oauth2
|
2021-10-23 16:57:14 +00:00
|
|
|
echo "Re-enabling incoming traffic from the cluster"
|
|
|
|
wait ${PID}
|
2020-10-10 15:46:27 +00:00
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Service
|
|
|
|
metadata:
|
|
|
|
name: auth-proxy
|
2021-10-23 16:57:14 +00:00
|
|
|
namespace: auth-proxy
|
2020-10-10 15:46:27 +00:00
|
|
|
labels:
|
|
|
|
app: auth-proxy
|
|
|
|
spec:
|
|
|
|
ports:
|
|
|
|
- name: http
|
|
|
|
port: 80
|
|
|
|
protocol: TCP
|
|
|
|
targetPort: 8080
|
|
|
|
selector:
|
|
|
|
app: auth-proxy
|
|
|
|
type: ClusterIP
|