Add L2 Load Balancer (#16)

Co-authored-by: Fedor Batonogov <f.batonogov@yandex.ru>
This commit is contained in:
github-actions[bot]
2024-07-27 11:35:15 +03:00
committed by GitHub
parent 55deb994c6
commit 52a3d0eb3b
31 changed files with 782 additions and 739 deletions

View File

@@ -0,0 +1,36 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
namespace: development
labels:
app: frontend
spec:
revisionHistoryLimit: 10
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
maxSurge: 1
replicas: 3
selector:
matchLabels:
app: frontend
template:
metadata:
labels:
app: frontend
spec:
containers:
- name: frontend
image: python:3.12.4-alpine
command: ["python3", "-m", "http.server", "80"]
imagePullPolicy: IfNotPresent
resources:
requests:
memory: "16Mi"
cpu: "10m"
limits:
memory: "1Gi"
cpu: "1000m"

View File

@@ -0,0 +1,28 @@
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: frontend
namespace: development
spec:
# В кластере может быть несколько Ingress Controllers, мы используем NGINX
ingressClassName: "traefik"
tls:
- hosts:
- "frontend.example.local"
rules:
# Хост определяет правило направления траффика по доменному имени
- host: "frontend.example.local"
http:
# Для различных путей в URL можно указать различные бэкенд-сервисы
paths:
- path: /
pathType: Prefix
backend:
service:
# Заранее создан сервис типа ClusterIP
# Он выступает в качестве бэкенда нашего Ingress
name: frontend
port:
# У сервиса может быть несколько портов, указываем нужный нам
number: 80

View File

@@ -0,0 +1,7 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: development
labels:
name: development

View File

@@ -0,0 +1,16 @@
---
apiVersion: v1
kind: Service
metadata:
name: frontend
namespace: development
labels:
app: frontend
spec:
type: ClusterIP
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
app: frontend