Created
February 22, 2024 11:45
-
-
Save juffaz/43bf3434f06544db89e3fa76c894d8dd to your computer and use it in GitHub Desktop.
kubernetes-front.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: v1 | |
kind: Namespace | |
metadata: | |
name: k3s-test | |
--- | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: front-deploy | |
namespace: k3s-test | |
labels: | |
app: front | |
spec: | |
replicas: 3 | |
selector: | |
matchLabels: | |
app: front | |
template: | |
metadata: | |
labels: | |
app: front | |
spec: | |
imagePullSecrets: | |
- name: gitlab-registry-secret | |
containers: | |
- name: front | |
image: registry.gitlab.com/front/main:latest | |
ports: | |
- name: front | |
containerPort: 8080 | |
env: | |
- name: DATABASE_HOST | |
value: "64.1.1.220" | |
livenessProbe: | |
httpGet: | |
path: /api/healthcheck # Adjust the path based on your application | |
port: 8080 | |
initialDelaySeconds: 3 | |
periodSeconds: 5 | |
strategy: | |
type: RollingUpdate | |
rollingUpdate: | |
maxSurge: 1 | |
maxUnavailable: 0 | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: front-svc | |
namespace: k3s-test | |
labels: | |
service: front-svc | |
spec: | |
type: ClusterIP | |
ports: | |
- name: http | |
port: 8080 | |
protocol: TCP | |
selector: | |
app: front | |
--- | |
apiVersion: traefik.containo.us/v1alpha1 | |
kind: Middleware | |
metadata: | |
name: traefik-http-cache | |
namespace: k3s-test | |
spec: | |
plugin: | |
httpCache: | |
maxTtl: 300 | |
--- | |
apiVersion: networking.k8s.io/v1 | |
kind: Ingress | |
metadata: | |
name: ingress-front | |
namespace: k3s-test | |
annotations: | |
traefik.ingress.kubernetes.io/router.entrypoints: web | |
traefik.ingress.kubernetes.io/middleware: k3s-test/traefik-http-cache | |
spec: | |
rules: | |
- http: | |
paths: | |
- path: / | |
pathType: Prefix | |
backend: | |
service: | |
name: front-svc | |
port: | |
number: 8080 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment