blob: 24f4082b1e0aea48a113780f44c636abd330b32e [file] [log] [blame]
(window.webpackJsonp=window.webpackJsonp||[]).push([[30],{144:function(e,t,n){"use strict";n.d(t,"a",(function(){return b})),n.d(t,"b",(function(){return m}));var o=n(0),r=n.n(o);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=r.a.createContext({}),s=function(e){var t=r.a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):u(u({},t),e)),n},b=function(e){var t=s(e.components);return r.a.createElement(p.Provider,{value:t},e.children)},l={inlineCode:"code",wrapper:function(e){var t=e.children;return r.a.createElement(r.a.Fragment,{},t)}},d=r.a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),b=s(n),d=o,m=b["".concat(c,".").concat(d)]||b[d]||l[d]||a;return n?r.a.createElement(m,u(u({ref:t},p),{},{components:n})):r.a.createElement(m,u({ref:t},p))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,c=new Array(a);c[0]=d;var u={};for(var i in t)hasOwnProperty.call(t,i)&&(u[i]=t[i]);u.originalType=e,u.mdxType="string"==typeof e?e:o,c[1]=u;for(var p=2;p<a;p++)c[p]=n[p];return r.a.createElement.apply(null,c)}return r.a.createElement.apply(null,n)}d.displayName="MDXCreateElement"},213:function(e,t,n){"use strict";n.r(t),t.default=n.p+"assets/files/jupyter-b412bca5cd2199cfea640f5453431d9d.yaml"},97:function(e,t,n){"use strict";n.r(t),n.d(t,"frontMatter",(function(){return c})),n.d(t,"metadata",(function(){return u})),n.d(t,"toc",(function(){return i})),n.d(t,"default",(function(){return s}));var o=n(3),r=n(7),a=(n(0),n(144)),c={},u={unversionedId:"adminDocs/yarn/workbench/notebook/setup-jupyter",id:"adminDocs/yarn/workbench/notebook/setup-jupyter",isDocsHomePage:!1,title:"setup-jupyter",description:"\x3c!--",source:"@site/docs/adminDocs/yarn/workbench/notebook/setup-jupyter.md",slug:"/adminDocs/yarn/workbench/notebook/setup-jupyter",permalink:"/docs/adminDocs/yarn/workbench/notebook/setup-jupyter",editUrl:"https://github.com/apache/submarine/edit/master/website/docs/adminDocs/yarn/workbench/notebook/setup-jupyter.md",version:"current"},i=[{value:"Experiment environment",id:"experiment-environment",children:[{value:"Setup Kubernetes",id:"setup-kubernetes",children:[]},{value:"Deploy Jupyter Notebook",id:"deploy-jupyter-notebook",children:[]}]}],p={toc:i};function s(e){var t=e.components,c=Object(r.a)(e,["components"]);return Object(a.b)("wrapper",Object(o.a)({},p,c,{components:t,mdxType:"MDXLayout"}),Object(a.b)("h1",{id:"deploy-jupyter-notebook-on-kubernetes"},"Deploy Jupyter Notebook on Kubernetes"),Object(a.b)("p",null,"This guide covers the deployment Jupyter Notebook on kubernetes cluster."),Object(a.b)("h2",{id:"experiment-environment"},"Experiment environment"),Object(a.b)("h3",{id:"setup-kubernetes"},"Setup Kubernetes"),Object(a.b)("p",null,"We recommend using ",Object(a.b)("a",{parentName:"p",href:"https://kind.sigs.k8s.io/"},"kind")," to setup a Kubernetes cluster on a local machine."),Object(a.b)("p",null,"You can use Extra mounts to mount your host path to kind node and use Extra port mappings to port\nforward to the kind nodes. Please refer to ",Object(a.b)("a",{parentName:"p",href:"https://kind.sigs.k8s.io/docs/user/configuration/#extra-mounts"},"kind configuration"),"\nfor more details."),Object(a.b)("p",null,"You need to create a kind config file. The following is an example :"),Object(a.b)("pre",null,Object(a.b)("code",{parentName:"pre"},"kind: Cluster\napiVersion: kind.x-k8s.io/v1alpha4\nnodes:\n- role: control-plane\n extraMounts:\n # add a mount from /path/to/my/files on the host to /files on the node\n - hostPath: /tmp/submarine\n containerPath: /tmp/submarine\n extraPortMappings:\n - containerPort: 80\n hostPort: 80\n protocol: TCP\n # exposing additional ports to be used for NodePort services\n - containerPort: 30070\n hostPort: 8888\n protocol: TCP\n")),Object(a.b)("p",null,"Running the following command:"),Object(a.b)("pre",null,Object(a.b)("code",{parentName:"pre"},"kind create cluster --image kindest/node:v1.15.6 --config <path-to-kind-config> --name k8s-submarine\nkubectl create namespace submarine\n")),Object(a.b)("h3",{id:"deploy-jupyter-notebook"},"Deploy Jupyter Notebook"),Object(a.b)("p",null,"Once you have a running Kubernetes cluster, you can write a YAML file to deploy a jupyter notebook.\nIn this ",Object(a.b)("a",{target:"_blank",href:n(213).default},"example yaml"),", we use ",Object(a.b)("a",{parentName:"p",href:"https://hub.docker.com/r/jupyter/minimal-notebook/"},"jupyter/minimal-notebook"),"\nto make a single notebook running on the kind node."),Object(a.b)("pre",null,Object(a.b)("code",{parentName:"pre"},"kubectl apply -f jupyter.yaml --namespace submarine\n")),Object(a.b)("p",null,"Once jupyter notebook is running, you can access the notebook server from the browser using http://localhost:8888 on local machine."),Object(a.b)("p",null,"You can enter and store a password for your notebook server with:"),Object(a.b)("pre",null,Object(a.b)("code",{parentName:"pre"},"kubectl exec -it <jupyter-pod-name> -- jupyter notebook password\n")),Object(a.b)("p",null,"After restarting the notebook server, you can login jupyter notebook with your new password."),Object(a.b)("p",null,"If you want to use JupyterLab :"),Object(a.b)("pre",null,Object(a.b)("code",{parentName:"pre"},"http://localhost:8888/lab\n")))}s.isMDXComponent=!0}}]);