1
0
Fork 0
docker-easy-haproxy/examples/kubernetes/service.yml
Joao Gilberto Magalhaes 71ca8f6a9d Bump version to 5.0.0 across repository for major release
- Updated all references from `4.6.0` to `5.0.0` in Docker, Kubernetes, and Swarm configurations, as well as Helm chart and documentation.
- Updated `RELEASE.md` with new version history and highlights.
- Aligned all deployment examples and documentation with the new version to ensure consistency.
2025-12-04 13:12:12 -05:00

134 lines
3.2 KiB
YAML

# ==============================================================================
# EXAMPLE: Basic Kubernetes Ingress
# ==============================================================================
#
# WHAT THIS DEMONSTRATES:
# - Basic ingress configuration with EasyHAProxy
# - Multiple domains pointing to the same service
# - Complete deployment + service + ingress setup
# - HTTP ingress without TLS
#
# REQUIREMENTS (run these first):
# ```bash
# # 1. Ensure EasyHAProxy is installed in your cluster
# kubectl create namespace easyhaproxy
# kubectl apply -f https://raw.githubusercontent.com/byjg/docker-easy-haproxy/5.0.0/deploy/kubernetes/easyhaproxy-daemonset.yml
#
# # 2. Label the node where EasyHAProxy will run
# kubectl label nodes <node-name> "easyhaproxy/node=master"
#
# # 3. Add to /etc/hosts for local testing (idempotent)
# grep -q "example.org" /etc/hosts || echo "<node-ip> example.org www.example.org" | sudo tee -a /etc/hosts
# ```
#
# HOW TO START:
# ```bash
# kubectl apply -f service.yml
# ```
#
# HOW TO VERIFY IT'S WORKING:
# ```bash
# # Check resources are created
# kubectl get deployment,service,ingress container-example
#
# # Test via node IP
# curl -H "Host: example.org" http://<node-ip>:31080
# # Expected: 200 OK with "My Host Example"
#
# # Or use port-forward for testing
# kubectl port-forward -n easyhaproxy deployment/easyhaproxy 8080:80
# curl -H "Host: example.org" http://localhost:8080
# # Expected: 200 OK with "My Host Example"
#
# # Test second domain
# curl -H "Host: www.example.org" http://<node-ip>:31080
# # Expected: Same response
# ```
#
# CLEAN UP:
# ```bash
# kubectl delete -f service.yml
# ```
#
# ==============================================================================
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: easyhaproxy-ingress
name: container-example
namespace: default
spec:
rules:
- host: example.org
http:
paths:
- backend:
service:
name: container-example
port:
number: 8080
pathType: ImplementationSpecific
- host: www.example.org
http:
paths:
- backend:
service:
name: container-example
port:
number: 8080
pathType: ImplementationSpecific
---
apiVersion: v1
kind: Service
metadata:
name: container-example
namespace: default
spec:
ports:
- name: http
port: 8080
selector:
app: container-example
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: container-example
namespace: default
spec:
replicas: 1
revisionHistoryLimit: 10
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
type: RollingUpdate
selector:
matchLabels:
app: container-example
template:
metadata:
labels:
app: container-example
spec:
containers:
- name: container-example
image: byjg/static-httpserver
ports:
- containerPort: 8080
resources:
limits:
cpu: '0.05'
memory: '20Mi'
requests:
cpu: '0.05'
memory: '20Mi'
env:
- name: TITLE
value: "My Host Example"