Skip to content
Snippets Groups Projects
Commit df3587f2 authored by Leah Tacke genannt Unterberg's avatar Leah Tacke genannt Unterberg
Browse files

worked on app deployment

parent 3641beaf
No related branches found
No related tags found
No related merge requests found
kubectl apply -f .\backend-deployment.yaml -f .\frontend-deployment.yaml -f .\config-maps.yaml -f .\services.yaml -n mdata
\ No newline at end of file
apiVersion: apps/v1
kind: Deployment
metadata:
name: maed-exporter-app
name: maed-exporter-backend
namespace: mdata
labels:
app.kubernetes.io/name: maed-exporter-app
app.kubernetes.io/name: maed-exporter-backend
app.kubernetes.io/version: "0.1.0"
spec:
selector:
matchLabels:
app.kubernetes.io/name: maed-exporter-app
app.kubernetes.io/name: maed-exporter-backend
replicas: 1
revisionHistoryLimit: 5
strategy:
type: Recreate
template:
metadata:
labels:
app.kubernetes.io/name: maed-exporter-app
app.kubernetes.io/name: maed-exporter-backend
spec:
containers:
- name: maed-exporter-backend
image: registry.git-ce.rwth-aachen.de/machine-data/maed-exporter/maed-exporter-backend#release
imagePullPolicy: IfNotPresent
image: registry.git-ce.rwth-aachen.de/machine-data/maed-exporter/maed-exporter-backend:release
imagePullPolicy: Always
ports:
- containerPort: 8080
protocol: TCP
envFrom:
- configMapKeyRef:
name: maed-exporter-configmap
- configMapRef:
name: maed-exporter-env
volumeMounts:
- mountPath: /exports
name: exports
......@@ -39,24 +35,26 @@ spec:
requests:
memory: "512Mi"
cpu: "500m"
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 30
periodSeconds: 15
timeoutSeconds: 2
failureThreshold: 3
readinessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 2
failureThreshold: 3
volumes:
- emptyDir:
- name: exports
emptyDir:
sizeLimit: "2Gi"
name: exports
- name: maed-exporter-frontend
image: registry.git-ce.rwth-aachen.de/machine-data/maed-exporter/maed-exporter-frontend#release
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8090
protocol: TCP
envFrom:
- configMapKeyRef:
name: maed-exporter-configmap
resources:
limits:
memory: "1Gi"
cpu: "1000m"
requests:
memory: "1Gi"
cpu: "500m"
apiVersion: v1
kind: ConfigMap
metadata:
name: maed-exporter-configmap
data:
FRONTEND_PORT: "8090"
EXPORT_DIR: "/exports/"
API_PORT: "8080"
API_BASE: "http://localhost"
API_PREFIX: "/api"
API_URL: "$(API_BASE):$(API_PORT)"
VITE_API_URL: "$(API_URL)"
CORS_ORIGIN: "http://localhost:8090"
\ No newline at end of file
apiVersion: v1
kind: ConfigMap
metadata:
name: maed-exporter-env
labels:
app.kubernetes.io/name: maed-exporter-app
data:
FRONTEND_PORT: "8090"
API_BASE: "backend-service.mdata.svc.cluster.local"
API_PORT: "8080"
API_PREFIX: "/api"
EXPORT_DIR: "/exports/"
CORS_ORIGIN: "frontend-service.mdata.svc.cluster.local:8090"
---
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-cfg
labels:
app.kubernetes.io/name: maed-exporter-app
data:
# hash $cookie_simple_session consistent;
default.conf.template: |
upstream api {
server ${API_BASE}:${API_PORT} max_fails=3 fail_timeout=30s;
}
server {
listen ${FRONTEND_PORT};
location / {
index index.html;
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html =404;
}
location /health {
access_log off;
add_header 'Content-Type' 'application/json';
return 200 '{"status":"healthy"}';
}
location ${API_PREFIX} {
proxy_pass http://api;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
default.conf: |
upstream api {
hash $cookie_simple_session consistent;
server backend-service.mdata.svc.cluster.local:8080 max_fails=3 fail_timeout=30s;
}
server {
listen ${FRONTEND_PORT};
location / {
index index.html;
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html =404;
}
location /health {
access_log off;
add_header 'Content-Type' 'application/json';
return 200 '{"status":"healthy"}';
}
location /api {
proxy_pass http://api;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
\ No newline at end of file
apiVersion: apps/v1
kind: Deployment
metadata:
name: maed-exporter-frontend
namespace: mdata
labels:
app.kubernetes.io/name: maed-exporter-frontend
app.kubernetes.io/version: "0.1.0"
spec:
selector:
matchLabels:
app.kubernetes.io/name: maed-exporter-frontend
replicas: 1
revisionHistoryLimit: 5
strategy:
type: Recreate
template:
metadata:
labels:
app.kubernetes.io/name: maed-exporter-frontend
spec:
containers:
- name: maed-exporter-frontend
image: registry.git-ce.rwth-aachen.de/machine-data/maed-exporter/maed-exporter-frontend:release
imagePullPolicy: Always
ports:
- containerPort: 8090
protocol: TCP
envFrom:
- configMapRef:
name: maed-exporter-env
volumeMounts:
- name: nginx-cfg
mountPath: /etc/nginx/templates/default.conf.template #/etc/nginx/conf.d/default.conf
subPath: default.conf.template
resources:
limits:
memory: "1Gi"
cpu: "1000m"
requests:
memory: "1Gi"
cpu: "500m"
livenessProbe:
httpGet:
path: /health
port: 8090
initialDelaySeconds: 10
periodSeconds: 15
timeoutSeconds: 2
failureThreshold: 3
readinessProbe:
httpGet:
path: /health
port: 8090
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 2
failureThreshold: 3
volumes:
- name: nginx-cfg
configMap:
name: nginx-cfg
apiVersion: v1
kind: Service
metadata:
name: maed-exporter-service
name: backend-service
namespace: mdata
labels:
app.kubernetes.io/name: maed-exporter-app
spec:
externalTrafficPolicy: Cluster
ports:
- port: 80
protocol: TCP
targetPort: 8090
selector:
app.kubernetes.io/name: maed-exporter-backend
ports:
- protocol: TCP
port: 8080 # Cluster IP port
targetPort: 8080 # Port on the backend container
type: ClusterIP # Exposes the service only within the cluster
---
apiVersion: v1
kind: Service
metadata:
name: frontend-service
namespace: mdata
labels:
app.kubernetes.io/name: maed-exporter-app
spec:
selector:
app.kubernetes.io/name: maed-exporter-frontend
ports:
- protocol: TCP
port: 8090
targetPort: 8090 # Port on the frontend container
type: NodePort
externalTrafficPolicy: Cluster
sessionAffinity: ClientIP
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment