From bbb762ba4e3ef9ede48a1c388310d09ed5448503 Mon Sep 17 00:00:00 2001 From: FelixFehse Date: Wed, 10 Apr 2024 17:27:20 +0200 Subject: [PATCH] IL-421 Kubernetes notes --- .../issue_classification_user_journey.ipynb | 25 +++++++++++++++--- .../requirements.txt | Bin 26862 -> 26517 bytes 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/examples/issue_classification_user_journey.ipynb b/src/examples/issue_classification_user_journey.ipynb index e011c0708..d5abb3bf4 100644 --- a/src/examples/issue_classification_user_journey.ipynb +++ b/src/examples/issue_classification_user_journey.ipynb @@ -743,7 +743,7 @@ "- Setup Pulumi\n", "- Check that it is working\n", "\n", - "### Enviroment variables\n", + "### Environment variables\n", "TODO: Describe how to set environment variables \n", "\n", "### FastAPI service\n", @@ -756,9 +756,11 @@ "\n", "### Docker\n", "\n", + "__Important__: For some reason, git adds a null terminator to the `requirements.txt` file. This crashed the docker build step. You might have to manually delete the null terminator at the end of the file.\n", + "\n", "Write dockerfile that will create a new docker container with the FastAPI program.\n", "We assume, your github token for the Intelligence Layer is exported to the `GITHUB_TOKEN` environmental variable. \n", - "Build the docker container with [`GITHUB_TOKEN=$GITHUB_TOKEN `]\n", + "Build the docker container with\n", "```shell\n", "docker build . -t classification-service:local -f Dockerfile --secret id=GITHUB_TOKEN\n", "```\n", @@ -770,8 +772,25 @@ "poetry export --without-hashes --format=requirements.txt > requirements.txt\n", "\n", "### Kubernetes\n", - "\n" + "\n", + "- Install `minikube`, see e.g. [here](https://minikube.sigs.k8s.io/docs/start/)\n", + "- `minikube start`\n", + "- Setup current shell to use minikube's docker daemon: `eval $(minikube -p minikube docker-env)`\n", + "- build docker container as above\n", + " - check if docker image exists:\n", + " - `minikube ssh`\n", + " - `docker image ls`, you should see it listed.\n", + "- Start Kubernetes : `kubectl apply -f classification_deployment.yaml`\n", + "- list all Kubernetes pods: `kubectl get pods -A`\n", + "- forward port: `kubectl port-forward banana-7f84bb87d9-dk4ww 8000:80` Note: you will have to specify the exact pod name (here: `banana-7f84bb87d9-dk4ww`)\n", + "- Check, if you can access `localhost:8000`.\n", + " - check `curl -X POST localhost:8000/classify --json '{\"chunk\": \"long text\", \"labels\": [\"abc\", \"def\"]}'`\n" ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [] } ], "metadata": { diff --git a/src/examples/issue_classification_user_journey/requirements.txt b/src/examples/issue_classification_user_journey/requirements.txt index 6c27f5a4d34ace0d50f8618352abff806b61aaa2..9fa634db6f80be93e6920a381322bc53b5bc2c5e 100644 GIT binary patch delta 774 zcmXAnT}YEr7{{BL)e@^^)6CYiWm-$EY?aoUS*z^Z)a=8L)+*^jA|kqoh#@bBmzS5* z`&;8>j2J^iVu-XZq6>+Lh!Fa?j0i8Hix3Hk=pv%i;_%~lp7Zd);hg{Md&h&f4yoTa zY-$_^PaKkPL56PyDa3q%t8j|x!ZAfTnFV*LE)rymB*BG}cMEN zsxi3I;`d64=}zGcL8`*Uzgp+%YMYMAhs;%4Xls0A*TiV_ zj40g9cuelBeNEVF@zHB?t;*t0m5p63s9vWtu4wk@yz)t0HExF1XO!dl{bWsw$VL}K z8${mDT0QTv+TpxIb^q(nbum?s|13iU2WG=3h*kUW|sa7^T$ zAImt1o_LDqq|PHn;FQg~Q<6xB#4L@U3no3iab|l3xBCPI{Q{%k!aMMcPXih5T{I|(Bp8ht oG+i=zspyQFe2FHwbNL~aS4MboMd$ccosU;FB7^znmXswId%SNPMfCIa_Ri9Y15|Z(wtK(B8Ey*nH6Y(E;F@{ z5oQu*23}~aAt7O2bTK4Kypo_HLO~=5T}c;3?{nJCkLP^f`#sQkjCVC>KiM5BY>*MK=;X-jFR;D6Rql&^QcNA7k(b)AxyNP3Rgw@2r z-yMU>e8oNDiUI*mvE#&zSOm8!QTa>xoH%|MZt6GglA3?xXQC48QI1)a<-TJf>-De&xVv|q-N7(>_^IoUk#d1KLS3=$YH6%^S1eY^0 zS92EhPSz}O@F=p2_3&}&kyn$Anzd|ba}Hmb1KoS<2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