Skip to content

Commit

Permalink
IL-421 Kubernetes notes
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixFehseTNG committed Apr 10, 2024
1 parent cfe07c8 commit bbb762b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions src/examples/issue_classification_user_journey.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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": {
Expand Down
Binary file modified src/examples/issue_classification_user_journey/requirements.txt
Binary file not shown.

0 comments on commit bbb762b

Please sign in to comment.