{ "cells": [ { "cell_type": "markdown", "id": "182bf4c9-6b90-45d2-9c05-05d803ac1699", "metadata": {}, "source": [ "# Deploy a Jupyter Environment on a Kubernetes Cluster" ] }, { "cell_type": "markdown", "id": "f1453fd37d29ca3a", "metadata": {}, "source": [ "In this tutorial we will go through the required steps to deploy a Jupyter environment as a Job on a Kubernetes cluster. We will use the [MAIA/mkg](https://github.com/kthcloud/MAIA/) Helm Chart to deploy the PyTorch Application. For correctly deploying the application from the Helm Chart, we first need to install Helm:\n", "```bash\n", "curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash\n", "```\n", "We will also need to install the [MAIA](https://github.com/kthcloud/MAIA/) Helm Chart Repository:\n", "```bash\n", "helm repo add maia https://github.com/kthcloud/MAIA\n", "helm repo update\n", "```" ] }, { "cell_type": "markdown", "id": "cfd3e94a1cadb447", "metadata": {}, "source": [ "We need also to set the `KUBECONFIG` environment variable to the path of the kubeconfig file of the cluster we want to deploy the application on. " ] }, { "cell_type": "markdown", "id": "837ab1f9c55d7a93", "metadata": {}, "source": [ "## Generate Configuration \n", "\n", "Next, we need to create the configuration dictionary, containing the required information for the deployment of the application.\n", "\n", "We will use the custom Jupyter Image generated in the [previous tutorial](Build_and_Push_Image.ipynb), requesting a deployment for 10 minutes, exposing the Jupyter port 888 to [test-jupyter.app.cloud.cbh.kth.se](https://test-jupyter.app.cloud.cbh.kth.se)" ] }, { "cell_type": "code", "execution_count": null, "id": "45899833d9bd5d3d", "metadata": { "ExecuteTime": { "end_time": "2024-02-21T14:42:32.330787072Z", "start_time": "2024-02-21T14:42:32.269843628Z" }, "collapsed": false, "jupyter": { "outputs_hidden": false } }, "outputs": [], "source": [ "%%writefile jupyter.json\n", "{\n", " \"namespace\": \"\", \n", " \"chart_name\": \"demo-jupyter-v1\", \n", " \"docker_image\": \"registry.cloud.cbh.kth.se/maia/jupyter-demo\",\n", " \"tag\": \"1.2\", \n", " \"allocationTime\": \"10m\", \n", " \"env_variables\": {\n", " \"PW\": \"MAIA\"\n", " },\n", " \"ports\": {\n", " \"jupyter\": [\n", " 8888\n", " ]\n", " },\n", " \"ingress\": {\n", " \"host\": \"test-jupyter.app.cloud.cbh.kth.se\",\n", " \"port\": \"8888\",\n", " \"path\": \"\",\n", " \"nginx_issuer\": \"\"\n", " },\n", " \"image_pull_secret\": \"\"\n", "}\n" ] }, { "cell_type": "code", "execution_count": null, "id": "8f7fa46d-78aa-4d6d-a96d-3571e5989261", "metadata": {}, "outputs": [], "source": [ "%%bash\n", "export KUBECONFIG=\n", "MAIA_deploy_helm_chart --config-file jupyter.json\n" ] }, { "cell_type": "markdown", "id": "22bf541cdd0e7028", "metadata": {}, "source": [ "## Check Application\n", "\n", "After completing the Chart deployment, the app should be available at: [test-jupyter.app.cloud.cbh.kth.se](https://test-jupyter.app.cloud.cbh.kth.se).\n", "\n", "Use the password set on the configuration (`PW`) to authenticate.\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.14" } }, "nbformat": 4, "nbformat_minor": 5 }