From 68be13b2e6749b6e9b022499c50458f9b689bf46 Mon Sep 17 00:00:00 2001 From: GalicIvan Date: Thu, 25 Jun 2026 02:27:52 +0200 Subject: [PATCH] init k2 app --- .DS_Store | Bin 0 -> 6148 bytes .dockerignore | 6 ++++++ Dockerfile | 6 ++++++ app/main.py | 14 ++++++++++++++ k8s/deployment.yaml | 35 +++++++++++++++++++++++++++++++++++ k8s/ingress.yaml | 23 +++++++++++++++++++++++ k8s/service.yaml | 17 +++++++++++++++++ requirements.txt | 2 ++ 8 files changed, 103 insertions(+) create mode 100644 .DS_Store create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 app/main.py create mode 100644 k8s/deployment.yaml create mode 100644 k8s/ingress.yaml create mode 100644 k8s/service.yaml create mode 100644 requirements.txt diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5ffe56854a315eafbaf4bf1430055ca6fb0002db GIT binary patch literal 6148 zcmeHKF>V4u4739UQX0yX`-OBVSBShI9|(aiNFbr~SLI!KT4rnuflgOY(4eto&z{$_ ztDE9{HZx!S>|V{5X10J6?U!L}+^3K1sWL?88QcBW;jqWjW~1VX1i3TY*wK!=(9*r;KP=R`#*AO)nrSpj|@8l2b*hs5}FAjAj&oFg5E zb<7gL#sshz4vEOXJgLB>dW{&KbmUvr^}-=B>E>}W&Z(QdCKQj`k#A9M-V+t2fE2h^ zpoa7%`~N$9V*bA-=}8JmfrnDS=j)I43a?bXb@X!VwGI9WXU!j+hILR7q8$UH9pi!R e_$7+6u5pe1UN|HM9r>UG^)o k2-svc:80 + +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: k2-ingress + namespace: kolokvij2-ivan-galic +spec: + ingressClassName: traefik + rules: + - host: galicivan.argocd.fpmoz.sum.ba + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: k2-svc # mora odgovarati service.yaml + port: + number: 80 # port Servicea (ne containera!) \ No newline at end of file diff --git a/k8s/service.yaml b/k8s/service.yaml new file mode 100644 index 0000000..5d2f0c5 --- /dev/null +++ b/k8s/service.yaml @@ -0,0 +1,17 @@ +# TODO: napiši Service +# Ime: k2-svc | Namespace: kolokvij2-IME-PREZIME +# Tip: ClusterIP | port: 80 -> targetPort: 8000 + +apiVersion: v1 +kind: Service +metadata: + name: k2-svc + namespace: kolokvij2-ivan-galic +spec: + selector: + app: k2-app # spaja Service s Podovima koji imaju ovaj label + ports: + - port: 80 # port koji Service eksponira (Ingress ce slati ovdje) + targetPort: 8000 # port containera (uvicorn slusa na 8000) + protocol: TCP + type: ClusterIP # samo unutar K8s clustera — Ingress rjesava vanjski pristup \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..c83aa69 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +fastapi==0.111.0 +uvicorn[standard]==0.29.0