2022-08-03 12:12:49 +00:00
|
|
|
|
2021-11-04 19:01:50 +00:00
|
|
|
apiVersion: v1
|
2022-08-03 12:12:49 +00:00
|
|
|
kind: Secret
|
2021-11-27 13:35:19 +00:00
|
|
|
metadata:
|
2022-08-03 12:12:49 +00:00
|
|
|
name: tailscale-non-auth-proxy
|
2021-11-27 13:35:19 +00:00
|
|
|
namespace: auth-proxy
|
2022-08-03 12:12:49 +00:00
|
|
|
type: Opaque
|
2021-11-27 13:35:19 +00:00
|
|
|
---
|
|
|
|
apiVersion: v1
|
2022-08-03 12:12:49 +00:00
|
|
|
kind: ServiceAccount
|
2022-07-26 14:18:59 +00:00
|
|
|
metadata:
|
2022-08-03 12:12:49 +00:00
|
|
|
name: tailscale-non-auth-proxy
|
2022-07-26 14:18:59 +00:00
|
|
|
labels:
|
2022-08-03 12:12:49 +00:00
|
|
|
app.kubernetes.io/name: tailscale
|
2022-07-26 14:18:59 +00:00
|
|
|
---
|
2022-08-03 12:12:49 +00:00
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
kind: RoleBinding
|
2021-11-27 13:35:19 +00:00
|
|
|
metadata:
|
2022-08-03 12:12:49 +00:00
|
|
|
name: tailscale-non-auth-proxy
|
2021-11-27 13:35:19 +00:00
|
|
|
labels:
|
2022-08-03 12:12:49 +00:00
|
|
|
app.kubernetes.io/name: tailscale
|
|
|
|
subjects:
|
|
|
|
- kind: ServiceAccount
|
|
|
|
name: "tailscale-non-auth-proxy"
|
|
|
|
roleRef:
|
|
|
|
kind: Role
|
|
|
|
name: tailscale-non-auth-proxy
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
2021-11-27 13:35:19 +00:00
|
|
|
---
|
2022-08-03 12:12:49 +00:00
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
kind: Role
|
2022-06-02 20:16:51 +00:00
|
|
|
metadata:
|
2022-08-03 12:12:49 +00:00
|
|
|
name: tailscale-non-auth-proxy
|
2022-06-02 20:16:51 +00:00
|
|
|
labels:
|
2022-08-03 12:12:49 +00:00
|
|
|
app.kubernetes.io/name: tailscale
|
|
|
|
rules:
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources: ["secrets"]
|
|
|
|
verbs: ["create"]
|
|
|
|
- apiGroups: [""]
|
|
|
|
resourceNames: ["tailscale-non-auth-proxy"]
|
|
|
|
resources: ["secrets"]
|
|
|
|
verbs: ["get", "update"]
|
2022-06-02 20:16:51 +00:00
|
|
|
---
|
2021-11-08 06:29:28 +00:00
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: Deployment
|
|
|
|
metadata:
|
|
|
|
name: non-auth-proxy
|
|
|
|
namespace: auth-proxy
|
|
|
|
labels:
|
|
|
|
app: non-auth-proxy
|
2023-07-29 18:55:55 +00:00
|
|
|
annotations:
|
|
|
|
secret.reloader.stakater.com/reload: "tailscale-non-auth-proxy"
|
2021-11-08 06:29:28 +00:00
|
|
|
spec:
|
|
|
|
replicas: 1
|
2022-08-03 12:12:49 +00:00
|
|
|
strategy:
|
|
|
|
type: Recreate
|
2021-11-08 06:29:28 +00:00
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
app: non-auth-proxy
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app: non-auth-proxy
|
|
|
|
spec:
|
2022-08-03 12:12:49 +00:00
|
|
|
serviceAccountName: tailscale-non-auth-proxy
|
|
|
|
dnsPolicy: ClusterFirst
|
2021-11-08 06:29:28 +00:00
|
|
|
dnsConfig:
|
|
|
|
nameservers:
|
|
|
|
- 100.100.100.100
|
|
|
|
containers:
|
|
|
|
- name: oauth-proxy
|
2023-06-10 07:38:21 +00:00
|
|
|
image: quay.io/oauth2-proxy/oauth2-proxy:v7.4.0
|
2021-11-08 06:29:28 +00:00
|
|
|
args:
|
|
|
|
- --cookie-secure=false
|
|
|
|
- --provider=oidc
|
|
|
|
- --provider-display-name=Auth0
|
|
|
|
- --upstream=http://talos.averagemarcus.github.beta.tailscale.net
|
|
|
|
- --http-address=0.0.0.0:8080
|
|
|
|
- --email-domain=*
|
|
|
|
- --pass-basic-auth=false
|
|
|
|
- --pass-access-token=false
|
|
|
|
- --oidc-issuer-url=https://marcusnoble.eu.auth0.com/
|
|
|
|
- --cookie-secret=KDGD6rrK6cBmryyZ4wcJ9xAUNW9AQNFT
|
|
|
|
- --cookie-expire=336h0m0s
|
|
|
|
- --trusted-ip=0.0.0.0/0
|
|
|
|
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
|
|
|
|
- name: tailscale
|
2023-08-23 03:01:38 +00:00
|
|
|
image: ghcr.io/tailscale/tailscale:v1.48
|
2021-12-23 18:35:57 +00:00
|
|
|
imagePullPolicy: Always
|
2022-08-03 12:12:49 +00:00
|
|
|
tty: true
|
2021-11-08 06:29:28 +00:00
|
|
|
env:
|
2022-08-03 12:12:49 +00:00
|
|
|
- name: TS_AUTH_KEY
|
2021-11-08 06:29:28 +00:00
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
name: tailscale-auth
|
|
|
|
key: password
|
2022-08-03 12:12:49 +00:00
|
|
|
- name: TS_KUBE_SECRET
|
|
|
|
value: tailscale-non-auth-proxy
|
|
|
|
- name: TS_ACCEPT_DNS
|
|
|
|
value: "true"
|
|
|
|
- name: TS_EXTRA_ARGS
|
|
|
|
value: "--hostname=non-auth-proxy"
|
2021-11-08 06:29:28 +00:00
|
|
|
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"
|
2022-08-03 12:12:49 +00:00
|
|
|
tailscaled --state=kube:${TS_KUBE_SECRET} --socket=/tmp/tailscaled.sock &
|
2021-11-08 06:29:28 +00:00
|
|
|
PID=$!
|
|
|
|
echo "Running tailscale up"
|
|
|
|
tailscale --socket=/tmp/tailscaled.sock up \
|
2022-08-03 12:12:49 +00:00
|
|
|
--accept-dns=${TS_ACCEPT_DNS} \
|
|
|
|
--authkey=${TS_AUTH_KEY} \
|
|
|
|
${TS_EXTRA_ARGS}
|
2021-11-08 06:29:28 +00:00
|
|
|
echo "Re-enabling incoming traffic from the cluster"
|
|
|
|
wait ${PID}
|
|
|
|
---
|
2021-11-07 05:30:13 +00:00
|
|
|
apiVersion: v1
|
|
|
|
kind: Service
|
|
|
|
metadata:
|
2021-11-08 06:29:28 +00:00
|
|
|
name: non-auth-proxy
|
2021-11-07 05:30:13 +00:00
|
|
|
namespace: auth-proxy
|
|
|
|
labels:
|
2021-11-08 06:29:28 +00:00
|
|
|
app: non-auth-proxy
|
2021-11-07 05:30:13 +00:00
|
|
|
spec:
|
|
|
|
ports:
|
|
|
|
- name: http
|
|
|
|
port: 80
|
|
|
|
protocol: TCP
|
|
|
|
targetPort: 8080
|
|
|
|
selector:
|
2021-11-08 06:29:28 +00:00
|
|
|
app: non-auth-proxy
|
2021-11-07 05:30:13 +00:00
|
|
|
type: ClusterIP
|
|
|
|
---
|
|
|
|
|
|
|
|
apiVersion: networking.k8s.io/v1
|
|
|
|
kind: Ingress
|
|
|
|
metadata:
|
|
|
|
name: non-auth-proxy
|
|
|
|
namespace: auth-proxy
|
|
|
|
annotations:
|
|
|
|
cert-manager.io/cluster-issuer: letsencrypt
|
|
|
|
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
|
|
|
|
spec:
|
|
|
|
ingressClassName: nginx
|
|
|
|
tls:
|
|
|
|
- hosts:
|
|
|
|
- home.cluster.fun
|
2022-01-22 14:26:50 +00:00
|
|
|
- tasks.cluster.fun
|
2022-01-22 14:32:31 +00:00
|
|
|
- api.tasks.cluster.fun
|
2021-11-07 05:30:13 +00:00
|
|
|
secretName: non-auth-proxy-ingress
|
|
|
|
rules:
|
|
|
|
- host: home.cluster.fun
|
|
|
|
http:
|
|
|
|
paths:
|
|
|
|
- path: /
|
|
|
|
pathType: ImplementationSpecific
|
|
|
|
backend:
|
|
|
|
service:
|
2021-11-08 06:29:28 +00:00
|
|
|
name: non-auth-proxy
|
2021-11-07 05:30:13 +00:00
|
|
|
port:
|
|
|
|
name: http
|
2022-01-22 14:26:50 +00:00
|
|
|
- host: tasks.cluster.fun
|
|
|
|
http:
|
|
|
|
paths:
|
|
|
|
- path: /
|
|
|
|
pathType: ImplementationSpecific
|
|
|
|
backend:
|
|
|
|
service:
|
|
|
|
name: non-auth-proxy
|
|
|
|
port:
|
|
|
|
name: http
|
2022-01-22 14:32:31 +00:00
|
|
|
- host: api.tasks.cluster.fun
|
|
|
|
http:
|
|
|
|
paths:
|
|
|
|
- path: /
|
|
|
|
pathType: ImplementationSpecific
|
|
|
|
backend:
|
|
|
|
service:
|
|
|
|
name: non-auth-proxy
|
|
|
|
port:
|
|
|
|
name: http
|