149 lines
3.1 KiB
YAML
149 lines
3.1 KiB
YAML
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
name: tailscale-auth
|
|
namespace: proxy-civo
|
|
annotations:
|
|
kube-1password: 2cqycmsgv5r7vcyvjpblcl2l4y
|
|
kube-1password/vault: Kubernetes
|
|
type: Opaque
|
|
---
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: host-mappings
|
|
namespace: proxy-civo
|
|
labels:
|
|
app: proxy
|
|
data:
|
|
mapping.json: |
|
|
{
|
|
"vmcluster.proxy-civo.svc": "vmcluster.cluster.local",
|
|
"loki.proxy-civo.svc": "loki-write.cluster.local",
|
|
"loki.proxy-civo.svc:80": "loki-write.cluster.local"
|
|
}
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: internal-proxy
|
|
namespace: proxy-civo
|
|
labels:
|
|
app: internal-proxy
|
|
annotations:
|
|
configmap.reloader.stakater.com/reload: "host-mappings"
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: internal-proxy
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: internal-proxy
|
|
spec:
|
|
dnsPolicy: None
|
|
dnsConfig:
|
|
nameservers:
|
|
- 100.100.100.100
|
|
containers:
|
|
- name: proxy
|
|
image: rg.fr-par.scw.cloud/averagemarcus/proxy:latest
|
|
imagePullPolicy: Always
|
|
env:
|
|
- name: PROXY_DESTINATION
|
|
value: talos.averagemarcus.github.beta.tailscale.net
|
|
- name: PORT
|
|
value: "8080"
|
|
ports:
|
|
- containerPort: 8080
|
|
protocol: TCP
|
|
volumeMounts:
|
|
- name: host-mappings
|
|
mountPath: /config/
|
|
- name: tailscale
|
|
image: ghcr.io/tailscale/tailscale:v1.22
|
|
imagePullPolicy: Always
|
|
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} \
|
|
--hostname=proxy-civo-internal-proxy
|
|
wait ${PID}
|
|
volumes:
|
|
- name: host-mappings
|
|
configMap:
|
|
name: host-mappings
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: loki
|
|
namespace: proxy-civo
|
|
labels:
|
|
app: internal-proxy
|
|
spec:
|
|
ports:
|
|
- name: http
|
|
port: 80
|
|
protocol: TCP
|
|
targetPort: 8080
|
|
selector:
|
|
app: internal-proxy
|
|
type: ClusterIP
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: prometheus
|
|
namespace: proxy-civo
|
|
labels:
|
|
app: internal-proxy
|
|
spec:
|
|
ports:
|
|
- name: http
|
|
port: 80
|
|
protocol: TCP
|
|
targetPort: 8080
|
|
selector:
|
|
app: internal-proxy
|
|
type: ClusterIP
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: vmcluster
|
|
namespace: proxy-civo
|
|
labels:
|
|
app: internal-proxy
|
|
spec:
|
|
ports:
|
|
- name: http
|
|
port: 80
|
|
protocol: TCP
|
|
targetPort: 8080
|
|
selector:
|
|
app: internal-proxy
|
|
type: ClusterIP
|
|
---
|