Files
2026-01-12 12:29:48 +11:00

81 lines
2.3 KiB
YAML

# Template for Exposing External Services (Outside K8s)
#
# Use this template when you have services running on your local network
# (e.g., http://192.168.1.4:3031) and want to expose them with:
# - A custom domain (e.g., myapp.junv.cc)
# - Automatic HTTPS certificate from Let's Encrypt
# - Through your existing NGINX Ingress Controller
#
# HOW TO USE:
# 1. Copy this template
# 2. Replace ALL_CAPS placeholders with your values
# 3. Save as home-apps/chill.yaml
# 4. Apply: kubectl apply -f home-apps/chill.yaml
#
# EXAMPLE:
# Service: http://192.168.1.4:3031 → https://myapp.junv.cc
#
---
# Service without selector (no pods, points to external endpoint)
apiVersion: v1
kind: Service
metadata:
name: chill # e.g., home-assistant, grafana-external
namespace: home-apps
spec:
ports:
- name: http
port: 80 # Port exposed within cluster
targetPort: 3031 # e.g., 3031, 8080, 9090
protocol: TCP
---
# Manual EndpointSlice pointing to external IP
apiVersion: discovery.k8s.io/v1
kind: EndpointSlice
metadata:
name: chill # MUST match Service name exactly
namespace: home-apps
labels:
kubernetes.io/service-name: chill # Required: links EndpointSlice to Service
addressType: IPv4
endpoints:
- addresses:
- 192.168.1.4 # e.g., 192.168.1.4
ports:
- name: http # Should match Service port name
port: 8084 # e.g., 3031
protocol: TCP
---
# Ingress for all other paths (requires authentication)
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: chill-ingress
namespace: home-apps
annotations:
cert-manager.io/cluster-issuer: "letsencrypt-prod"
nginx.ingress.kubernetes.io/auth-url: "https://pass.junv.cc/oauth2/auth"
nginx.ingress.kubernetes.io/auth-signin: "https://pass.junv.cc/oauth2/start?rd=https://$host$escaped_request_uri"
# Optional: Proxy settings for specific backends
nginx.ingress.kubernetes.io/proxy-body-size: "1000m"
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
spec:
ingressClassName: nginx
tls:
- hosts:
- chill.junv.cc
secretName: chill-tls
rules:
- host: chill.junv.cc
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: chill
port:
number: 80