Add Kubernetes deployment, service, ingress, and namespace configurations

This commit is contained in:
2025-10-02 14:20:05 +08:00
parent cf8ebd01d3
commit a258431020
5 changed files with 381 additions and 0 deletions

45
script/k8s/ingress.yaml Normal file
View File

@@ -0,0 +1,45 @@
# Kubernetes Ingress Configuration for Traefik
# Ingress exposes HTTP routes from outside the cluster to services within
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
# Name of the ingress
name: ${CONTAINER_IMAGE_NAME}
# Namespace where ingress will be created
namespace: ${KUBERNETES_NAMESPACE}
# Annotations specific to Traefik ingress controller
annotations:
# Specify Traefik as the ingress controller
kubernetes.io/ingress.class: "traefik"
# Traefik router configuration
# Entry point for HTTP traffic (not using HTTPS as per requirements)
traefik.ingress.kubernetes.io/router.entrypoints: web
# Optional: Add middleware for common headers
# traefik.ingress.kubernetes.io/router.middlewares: default-headers@kubernetescrd
labels:
app: ${CONTAINER_IMAGE_NAME}
spec:
# Define routing rules
rules:
# Host-based routing
- host: ${KUBERNETES_INGRESS_HOST}
http:
paths:
# Route all paths to the service
- path: /
# PathType defines how path matching is done
# Prefix matches any path starting with /
pathType: Prefix
backend:
service:
# Name of the service to route traffic to
name: ${CONTAINER_IMAGE_NAME}
port:
# Service port to route to
number: 80