Skip to content

Commit c2c8d1d

Browse files
committed
Update K8s files
1 parent b3cddd3 commit c2c8d1d

35 files changed

+747
-15
lines changed

k8s-at-the-edge-example/k8s/render.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
# Array of node names
4-
NODE_NAMES=("0197b36304082e89295467ae00000000" "0195936439b66240d0040fa600000000")
4+
NODE_NAMES=("0198832759f82e89295467ae00000000")
55

66
# Create rendered directory if it doesn't exist
77
mkdir -p rendered
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: dummy-device-app-01986c6d1bb04e66114a542b00200000
5+
spec:
6+
automountServiceAccountToken: false
7+
hostname: dummy-device-app
8+
nodeName: 01986c6d1bb04e66114a542b00200000
9+
containers:
10+
- name: dummy-device-app
11+
image: ghcr.io/izumanetworks/kaas-example/dummy-device-app:1.0.0
12+
imagePullPolicy: Always
13+
ports:
14+
- containerPort: 3000
15+
env:
16+
- name: DATABASE_URL
17+
value: "postgres://postgres:password@postgres:5432/device_db"
18+
- name: PORT
19+
value: "3000"
20+
resources:
21+
requests:
22+
memory: "128Mi"
23+
cpu: "100m"
24+
limits:
25+
memory: "256Mi"
26+
cpu: "200m"
27+
livenessProbe:
28+
httpGet:
29+
path: /health
30+
port: 3000
31+
initialDelaySeconds: 30
32+
periodSeconds: 10
33+
readinessProbe:
34+
httpGet:
35+
path: /health
36+
port: 3000
37+
initialDelaySeconds: 5
38+
periodSeconds: 5
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: storage.k8s.io/v1
2+
kind: StorageClass
3+
metadata:
4+
name: edge-pv
5+
provisioner: kubernetes.io/edge-pv
6+
parameters: {}
7+
reclaimPolicy: Delete
8+
allowVolumeExpansion: false
9+
mountOptions: []
10+
volumeBindingMode: Immediate
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: nginx-config
5+
data:
6+
nginx.conf: |
7+
server {
8+
listen 80;
9+
server_name localhost;
10+
11+
# Health check endpoint
12+
location /health {
13+
access_log off;
14+
return 200 "healthy\n";
15+
add_header Content-Type text/plain;
16+
}
17+
18+
# Proxy API requests to the Rust backend
19+
location /api/ {
20+
proxy_pass http://dummy-device-app:3000/;
21+
proxy_set_header Host $host;
22+
proxy_set_header X-Real-IP $remote_addr;
23+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
24+
proxy_set_header X-Forwarded-Proto $scheme;
25+
}
26+
27+
# Serve the web portal
28+
location / {
29+
proxy_pass http://web-portal:80/;
30+
proxy_set_header Host $host;
31+
proxy_set_header X-Real-IP $remote_addr;
32+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
33+
proxy_set_header X-Forwarded-Proto $scheme;
34+
}
35+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: nginx-01986c6d1bb04e66114a542b00200000
5+
spec:
6+
automountServiceAccountToken: false
7+
hostname: nginx
8+
nodeName: 01986c6d1bb04e66114a542b00200000
9+
volumes:
10+
- name: nginx-config
11+
configMap:
12+
name: nginx-config
13+
containers:
14+
- name: nginx
15+
image: nginx:alpine
16+
ports:
17+
- containerPort: 80
18+
volumeMounts:
19+
- name: nginx-config
20+
mountPath: /etc/nginx/conf.d/default.conf
21+
subPath: nginx.conf
22+
resources:
23+
requests:
24+
memory: "64Mi"
25+
cpu: "50m"
26+
limits:
27+
memory: "128Mi"
28+
cpu: "100m"
29+
livenessProbe:
30+
httpGet:
31+
path: /health
32+
port: 80
33+
initialDelaySeconds: 30
34+
periodSeconds: 10
35+
readinessProbe:
36+
httpGet:
37+
path: /health
38+
port: 80
39+
initialDelaySeconds: 5
40+
periodSeconds: 5
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: postgres-config
5+
namespace: default
6+
data:
7+
POSTGRES_DB: device_db
8+
POSTGRES_USER: postgres
9+
POSTGRES_PASSWORD: password
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: postgres-01986c6d1bb04e66114a542b00200000
5+
spec:
6+
automountServiceAccountToken: false
7+
hostname: postgres
8+
nodeName: 01986c6d1bb04e66114a542b00200000
9+
containers:
10+
- name: postgres
11+
image: postgres:15-alpine
12+
ports:
13+
- containerPort: 5432
14+
env:
15+
- name: POSTGRES_DB
16+
valueFrom:
17+
configMapKeyRef:
18+
name: postgres-config
19+
key: POSTGRES_DB
20+
- name: POSTGRES_USER
21+
valueFrom:
22+
configMapKeyRef:
23+
name: postgres-config
24+
key: POSTGRES_USER
25+
- name: POSTGRES_PASSWORD
26+
valueFrom:
27+
configMapKeyRef:
28+
name: postgres-config
29+
key: POSTGRES_PASSWORD
30+
volumeMounts:
31+
- name: postgres-storage
32+
mountPath: /var/lib/postgresql/data
33+
resources:
34+
requests:
35+
memory: "256Mi"
36+
cpu: "250m"
37+
limits:
38+
memory: "512Mi"
39+
cpu: "500m"
40+
volumes:
41+
- name: postgres-storage
42+
persistentVolumeClaim:
43+
claimName: postgres-pv-claim
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: PersistentVolumeClaim
3+
metadata:
4+
name: postgres-pv-claim
5+
annotations:
6+
volume.kubernetes.io/gateway: 01986c6d1bb04e66114a542b00200000
7+
spec:
8+
accessModes:
9+
- ReadWriteOnce
10+
storageClassName: edge-pv
11+
resources:
12+
requests:
13+
storage: 1Gi
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: web-portal-01986c6d1bb04e66114a542b00200000
5+
spec:
6+
automountServiceAccountToken: false
7+
hostname: web-portal
8+
nodeName: 01986c6d1bb04e66114a542b00200000
9+
containers:
10+
- name: web-portal
11+
image: ghcr.io/izumanetworks/kaas-example/web-portal:1.0.0
12+
imagePullPolicy: Always
13+
ports:
14+
- containerPort: 80
15+
env:
16+
- name: REACT_APP_API_URL
17+
value: "http://dummy-device-app:3000"
18+
resources:
19+
requests:
20+
memory: "64Mi"
21+
cpu: "50m"
22+
limits:
23+
memory: "128Mi"
24+
cpu: "100m"
25+
livenessProbe:
26+
httpGet:
27+
path: /health
28+
port: 80
29+
initialDelaySeconds: 30
30+
periodSeconds: 10
31+
readinessProbe:
32+
httpGet:
33+
path: /health
34+
port: 80
35+
initialDelaySeconds: 5
36+
periodSeconds: 5
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: dummy-device-app-01987b4c1f1d4e66114a542b00200000
5+
spec:
6+
automountServiceAccountToken: false
7+
hostname: dummy-device-app
8+
nodeName: 01987b4c1f1d4e66114a542b00200000
9+
containers:
10+
- name: dummy-device-app
11+
image: ghcr.io/izumanetworks/kaas-example/dummy-device-app:1.0.1
12+
imagePullPolicy: IfNotPresent
13+
ports:
14+
- containerPort: 3000
15+
env:
16+
- name: DATABASE_URL
17+
value: "postgres://postgres:password@postgres:5432/device_db"
18+
- name: PORT
19+
value: "3000"
20+
resources:
21+
requests:
22+
memory: "128Mi"
23+
cpu: "100m"
24+
limits:
25+
memory: "256Mi"
26+
cpu: "200m"
27+
livenessProbe:
28+
httpGet:
29+
path: /health
30+
port: 3000
31+
initialDelaySeconds: 30
32+
periodSeconds: 10
33+
readinessProbe:
34+
httpGet:
35+
path: /health
36+
port: 3000
37+
initialDelaySeconds: 5
38+
periodSeconds: 5

0 commit comments

Comments
 (0)