2. 2023-09-22
-
Jedes Projektmitglied muss beim Code Review seine User Stories und Tasks präsentieren, seine Implementierung und die Verbindung zwischen Commits und Tasks
3. 2023-10-06
3.1. Rel.DB vs noSQL
-
Was ist eine Datenbank?
-
Warum normalisieren?
-
Wie normalisiert man?
-
Ergebnis der Normalisierung?
3.2. k8s
3.2.2. yaml-File
-
ConfigMaps können als Files gemounted werden (zB für Konfiguration des nginx-Servers)
minikube start minikube addons enable dashboard minikube addons enable metrics-server kubectl apply -f nginx.yaml kubectl port-forward [podname] 4200:80
nginx.yaml
# nginx Web Server
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:stable
ports:
- containerPort: 80
volumeMounts:
- name: default-conf
mountPath: /etc/nginx/conf.d/default.conf
subPath: default.conf
readOnly: true
- name: www
mountPath: /usr/share/nginx/html
readOnly: false
volumes:
- name: default-conf
configMap:
name: nginx-config
items:
- key: default.conf
path: default.conf
- name: www
persistentVolumeClaim:
claimName: nginx-www
---
apiVersion: v1
kind: Service
metadata:
name: nginx
spec:
ports:
- port: 80
targetPort: 80
protocol: TCP
selector:
app: nginx
---
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-config
data:
default.conf: |
server {
listen 80;
root /usr/share/nginx/html/demo;
rewrite_log on;
error_log /dev/stdout debug;
}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nginx-www
annotations:
nfs.io/storage-path: "nginx-www"
spec:
accessModes:
- ReadWriteMany
storageClassName: standard
resources:
requests:
storage: 100Mi
---
3.2.3. BusyBox in k8s
-
ein
kind: Job
wird nur einmal ausgeführt
# busybox-job.yaml
# this is our swiss army knife.
# here we use it to copy our web-content to the persistent volume that is mounted by busybox.
# after deployment busybox sleeps a while and we can use kubectl cp to copy files to the storage.
# after some time the job stops
apiVersion: batch/v1
kind: Job
metadata:
name: knife
spec:
backoffLimit: 1
activeDeadlineSeconds: 1800
template:
spec:
containers:
- name: busybox
image: busybox:latest
command: ["/bin/sh", "-c"]
args:
- mkdir -p /srv/demo;
echo "<html><head></head><body>Copy your web app to this location on this persistent volume.<br/>To the api ==> <a href="./api/user">./api/user</a></body></html>" > /srv/demo/index.html;
sleep 900;
echo done;
volumeMounts:
- name: html
mountPath: /srv
readOnly: false
volumes:
- name: html
persistentVolumeClaim:
claimName: nginx-www
restartPolicy: Never
-
Files zB von der Angular Anwendung werden gezippt und von der BusyBox entpackt und zur Verfügung gestellt