<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jérémy Lamy on Medium]]></title>
        <description><![CDATA[Stories by Jérémy Lamy on Medium]]></description>
        <link>https://medium.com/@jerlam06?source=rss-ecf82fcc25a1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*jB-9XWMSj6xbwW8AU9plRQ.jpeg</url>
            <title>Stories by Jérémy Lamy on Medium</title>
            <link>https://medium.com/@jerlam06?source=rss-ecf82fcc25a1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 20:42:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jerlam06/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Deploy an Express.js Server to Kubernetes]]></title>
            <link>https://medium.com/@jerlam06/deploy-an-express-js-server-to-kubernetes-9e9f09c13a85?source=rss-ecf82fcc25a1------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e9f09c13a85</guid>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Jérémy Lamy]]></dc:creator>
            <pubDate>Wed, 23 Oct 2019 13:56:23 GMT</pubDate>
            <atom:updated>2019-10-23T13:56:23.935Z</atom:updated>
            <content:encoded><![CDATA[<p>The easiest way to containerize and deploy a Node.js Express server to Kubernetes using DevSpace.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/0*FaQAnlqQ95RfLFDu.png" /></figure><h3>Introduction</h3><p>In this tutorial, we are going to see how to easily deploy an Express.js server to Kubernetes using DevSpace. Here are the steps to do this:</p><ol><li>Create a simple Express.js app (take your own if you already have one)</li><li>Add nodemon for hot reloading</li><li>Containerize the server (Dockerfile &amp; Helm Chart)</li><li>Deploy our application to Kubernetes</li><li>Stream the logs of your deployment</li></ol><h3>Prerequisites</h3><p>Make sure that you have the following installed:</p><ul><li><a href="https://nodejs.org/en/download/">Node</a></li><li>npm</li></ul><p>We will use <a href="https://github.com/devspace-cloud/devspace">DevSpace </a>which is a development tool for Kubernetes. Run this command to install DevSpace:</p><pre>npm install -g devspace</pre><h3>1. Create an Express.js Server</h3><blockquote><em>You can skip this step if you want to deploy your own Express.js server.</em></blockquote><p>In case you want to start from scratch, let’s create a basic Express.js server. We start by creating a minimal project structure and then installing Express:</p><pre>mkdir express-server <br>cd express-server </pre><pre><em># Create a package.json, -y flag to answer yes to all questions</em><br>npm init -y </pre><pre><em># Install and save express as dependency<br></em>npm install --save express</pre><p>Let’s finish the creation of our basic Express.js server by creating a file called index.js in the express-server directory:</p><pre>const express = require(&#39;express&#39;); <br>const app = express(); </pre><pre>app.get(&#39;/&#39;, function (req, res) { <br>  res.send(&#39;Hello World!&#39;); <br>}) </pre><pre>app.listen(3000, function () { <br>  console.log(&#39;App listening on port 3000!&#39;); <br>})</pre><p>As you can see, this simple Express.js server will be listening on port 3000. Now, we just need to tell npm how it should start this express application when running npm start. That&#39;s why we add start to the scripts section of our package.json file which should look like this afterward:</p><pre>{ <br>  &quot;name&quot;: &quot;express-server&quot;, <br>  &quot;version&quot;: &quot;1.0.0&quot;, <br>  &quot;main&quot;: &quot;index.js&quot;, <br>  &quot;scripts&quot;: { <br>    &quot;start&quot;: &quot;node index.js&quot;, <br>    &quot;test&quot;: &quot;echo \&quot;Error: no test specified\&quot; &amp;&amp; exit 1&quot; <br>  },<br>  &quot;keywords&quot;: [], <br>  &quot;author&quot;: &quot;&quot;, <br>  &quot;license&quot;: &quot;ISC&quot;, <br>  &quot;description&quot;: &quot;&quot;, <br>  &quot;dependencies&quot;: { <br>    &quot;express&quot;: &quot;^4.17.1&quot; <br>  } <br>}</pre><h3>2. Containerize the Express.js Server</h3><p>Our application requires a Dockerfile and some Kubernetes manifests in order to run on Kubernetes. This is when DevSpace comes into play: it will autogenerate these files for us, thanks to a simple command:</p><pre>devspace init</pre><h4>Create a Dockerfile</h4><p>DevSpace automatically detects that there is no Dockerfile in our project root directory and shows several options to continue with. Select the first option Create a Dockerfile for me by hitting Enter and DevSpace will create a Dockerfile in your project directory.</p><pre>? This project does not have a Dockerfile. What do you want to do? [Use arrows to move, space to select, type to filter] <br>&gt; Create a Dockerfile for me <br>  Enter path to your Dockerfile <br>  Enter path to your Kubernetes manifests <br>  Enter path to your Helm chart <br>  Use existing image (e.g. from Docker Hub)</pre><blockquote><em>If there already is a Dockerfile in the project folder, DevSpace will detect it and suggest to use it instead of creating a new one.</em></blockquote><h4>Select The Programming Language</h4><p>Our programming language will also be detected by DevSpace, so we can confirm that we are using javascript by hitting Enter.</p><pre>? Select the programming language of this project <br>[Use arrows to move, space to select, type to filter] <br>  csharp<br>  go <br>  java <br>&gt; javascript <br>  none <br>  php <br>  python</pre><h4>Choose an Image Registry</h4><p>DevSpace is going to build a Docker image from our newly created Dockerfile. This image needs to be pushed somewhere. We get the following options:</p><pre>? Which registry do you want to use for storing your Docker images? [Use arrows to move, space to select, type to filter] <br>  Use hub.docker.com <br>&gt; Use dscr.io (free, private Docker registry) <br>  Use other registry</pre><blockquote><em>If you have no clue which registry to use, you can just use dscr.io. It is free and allows you to push the images to a private registry. DevSpace will then open a login page and allow you to sign up for dscr.io.</em></blockquote><h4>Define The Application Port</h4><p>Enter the port of the Express.js server (remember, we specified it via app.listen() in index.js). So in our case, we need to enter 3000:</p><pre>? Which port is your application listening on? (Enter to skip) 3000</pre><h4>Project Successfully Initialized</h4><p>Once the init command has terminated, you will find the following new files in your project folder:</p><pre>express-server/ <br>| <br>|--devspace.yaml <br>|--Dockerfile <br>|--.dockerignore <br>|--.gitignore</pre><p>Besides the configuration for DevSpace in devspace.yaml, there is a Dockerfile for building a Docker image for our Express.js server before deploying the app to Kubernetes.</p><h4>Dockerfile</h4><p>The autogenerated Dockerfile will look like this:</p><pre><strong>FROM </strong>node:8.11.4</pre><pre><em># Create project directory (workdir)</em> <br><strong>RUN </strong>mkdir /app <br><strong>WORKDIR </strong>/app </pre><pre><em># Add package.json to WORKDIR and install dependencies</em> <br><strong>COPY </strong>package.json . <br><strong>RUN</strong> npm install </pre><pre><em># Add the remaining source code files to WORKDIR</em> <br><strong>COPY </strong>. . </pre><pre><em># Start the application</em> <br><strong>CMD</strong> [&quot;npm&quot;, &quot;start&quot;]</pre><p>This Dockerfile:</p><ul><li>defines node as base image</li><li>creates the working directory /app</li><li>copies the package.json into the image and installs the dependencies</li><li>copies the rest of our application into the working directory</li><li>defines npm start as the start command for the container</li></ul><p>Adding the package.json separately and installing dependencies before adding the rest of the application allows Docker to use layer-caching and saves a lot of time when building the image because the dependencies will only have to be re-installed when the package.json has changed and not every time we change any other source code file. Not having to install the dependencies every time we re-build and re-deploy our application saves a lot of time.</p><blockquote><em>Note that this Dockerfile starts our Express.js server in development mode. For production, it is recommended to also set the environment variable </em><em>NODE_ENV=production which would be possible using a separate Dockerfile just for production.</em></blockquote><h4>Component Helm Chart</h4><p>By default, DevSpace deploys your application as a so-called component that uses a highly configurable Helm chart. To customize the deployment of your app, you can edit the values section of the deployments section within the devspace.yaml configuration file:</p><pre>... <br>deployments: <br>- name: express-server <br>  helm: <br>    chart: <br>      name: component-chart <br>      version: v0.0.6 <a href="https://devspace.cloud/blog/2019/10/15/deploy-express.js-server-to-kubernetes?fbclid=IwAR0RfmLshGJh6dfegbcR1XR5v44uSnGePsobp3X-8Oaa8uYAFt0evIx03F0#block-11-line-8">8</a>      <br>      repo: https://charts.devspace.cloud <br>    values: <br>      containers:<br>      - image: dscr.io/${DEVSPACE_USERNAME}/devspace <br>      service: <br>        ports:<br>        - port: 3000 <br>...</pre><p>For more information on how to customize this component, take a look at <a href="https://devspace.cloud/docs/cli/deployment/components/configuration/overview-specification">customizing DevSpace components</a>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fdn9m8f%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2Fcloud-native&amp;image=http%3A%2F%2Fapi.screenshotlayer.com%2Fapi%2Fcapture%3Faccess_key%3Dfe59908dad3baab69ffab249a2224b03%26viewport%3D1024x612%26width%3D1000%26url%3Dhttps%253A%252F%252Fupscri.be%252Fdn9m8f%253Fscreenshot&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/a772ba454b90009ec506488fd10fbeca/href">https://medium.com/media/a772ba454b90009ec506488fd10fbeca/href</a></iframe><h3>3. Deploy The Express.js Server</h3><p>Now that our Express server is containerized, we are ready to deploy it to Kubernetes.</p><h4>Option A: Create a Namespace</h4><p>If you already have a Kubernetes cluster set up and the kube-context configured on your local machine, you can simply run this command:</p><pre>devspace use namespace my-express-server</pre><blockquote><em>DevSpace will automatically create this namespace during the deployment process later on.</em></blockquote><h4>Option B: Create a Space</h4><p>If you don’t have a Kubernetes cluster yet, it is much easier to create a ready-to-go Kubernetes namespace using DevSpace:</p><pre>devspace create space my-express-server</pre><p>This command will create a Kubernetes namespace on DevSpace Cloud. One space with up to 1GB is free in DevSpace Cloud.</p><h4>Build &amp; Deploy Your App</h4><p>DevSpace automates the entire deployment process (image building, pushing images to the registry, creating resources in Kubernetes etc.), so you can just run one single command to deploy the Express.js server:</p><pre>devspace deploy</pre><blockquote><em>This command takes a little while when you run it for the very first time. If you run it later again, it will be much quicker.</em></blockquote><p>Now, it’s time to take a look at the deployment in the browser:</p><pre>devspace open</pre><p>When DevSpace asks you how to open your application, choose the first option: <strong>via localhost</strong></p><pre>? How do you want to open your application? <br>[Use arrows to move, space to select, type to filter] <br>&gt; via localhost (provides private access only on your computer via   port-forwarding) <br>  via domain (makes your application publicly available via ingress)</pre><blockquote><em>If you are using DevSpace Cloud (i.e. you used </em><em>devspace create space before), you can also use the option </em><strong><em>via domain</em></strong><em> to make your application publicly available on an auto-generated domain.</em></blockquote><h3>4. Start Development</h3><p>If we want to develop this application instead of just running it, we can add nodemon as hot reloading tool and use the file-synchronization of DevSpace to update the deployment within seconds.</p><h4>Add nodemon for Hot Reloading</h4><p>Our server is running nicely; nevertheless, if you tried to mess around and modify anything to the index.js, you might have noticed that the changes are not applied, unless we run devspace deploy again. This is a very tedious task that has a negative impact on our development workflow and efficiency, hence it needs to be fixed.</p><p>Luckily, there is a nice package that was created to overcome this problem: <a href="https://www.npmjs.com/package/nodemon">nodemon</a>. Once installed, it will automatically restart our Node.js application when file changes are detected in the directory. So, let’s install it:</p><pre>npm install --save-dev nodemon</pre><p>Instead of running node index.js, we can now run:</p><pre>nodemon index.js</pre><h4>Change The Start Command</h4><p>Let’s assume that you are in a small team, not everyone is supposed to know the specific command to use in order to start the app correctly. The best practice in this case is to add our nodemon index.js command in the scripts of the package.json:</p><pre>&quot;scripts&quot;: { <br>  &quot;start&quot;: &quot;nodemon index.js&quot; <br>},</pre><blockquote><em>This is only suitable for development. For production, you should add another script, e.g. </em><em>&quot;start-prod&quot;: &quot;node index.js&quot;.</em></blockquote><h4>Start Development Mode</h4><p>You can now just run this command to develop directly inside the Kubernetes cluster:</p><pre>devspace dev -b</pre><p>Let’s change something in our app to check if the hot reloading is working. For instance, replace Hello World! with Bye World! and then save the file. If it&#39;s working, a message similar to the one below should be displayed in the console:</p><pre>[nodemon] restarting due to changes... <br>[nodemon] starting `node index.js` <br>App listening on port 3000!</pre><p>Refresh your web page at <a href="http://localhost:3000/">http://localhost:3000/</a> and you should see your changes without having to restart the app manually!</p><p><strong>Happy Coding!</strong></p><p>I hope you liked this tutorial and were able to deploy your first Express.js app to Kubernetes. Leave a comment, clap for this post on Medium or share the link with your colleagues, if this article was helpful for you.</p><p><em>Originally published at </em><a href="https://devspace.cloud/blog/2019/10/15/deploy-express.js-server-to-kubernetes?fbclid=IwAR0RfmLshGJh6dfegbcR1XR5v44uSnGePsobp3X-8Oaa8uYAFt0evIx03F0"><em>https://devspace.cloud</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e9f09c13a85" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying Vue.js Apps to Kubernetes · DevSpace Blog]]></title>
            <link>https://medium.com/@jerlam06/deploying-vue-js-apps-to-kubernetes-devspace-blog-c1ab8b164985?source=rss-ecf82fcc25a1------2</link>
            <guid isPermaLink="false">https://medium.com/p/c1ab8b164985</guid>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Jérémy Lamy]]></dc:creator>
            <pubDate>Wed, 02 Oct 2019 15:05:06 GMT</pubDate>
            <atom:updated>2019-10-02T15:35:43.895Z</atom:updated>
            <content:encoded><![CDATA[<h3>Deploying Vue.js Apps to Kubernetes</h3><p>Deploy Vue.js applications to Kubernetes in a few steps using DevSpace.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/0*Cm0-wL1WeJSEjGL1.png" /></figure><h3><strong>TL;DR</strong></h3><p>In this tutorial, we are going to see how to deploy a Vue.js application to <strong>Kubernetes</strong> using <strong>DevSpace</strong>. Here are the commands we are going to use:</p><pre>npm install -g vue-cli devspace<br>vue init webpack-simple my-vuejs-app &amp;&amp; cd my-vuejs-app <br>devspace init <br>devspace create space my-vuejs-app <br>devspace deploy <br>devspace open</pre><p>This is basically what these commands are doing:</p><ol><li><strong>Create</strong> a Vue.js app (or just use your own project)</li><li><strong>Containerize</strong> our Vue.js app (Dockerfile &amp; Helm Chart)</li><li><strong>Deploy</strong> it to Kubernetes (to the namespace my-vuejs-app)</li><li><strong>Stream the logs</strong> of the deployment</li></ol><h3>Prerequisites</h3><p>We will use <a href="https://github.com/devspace-cloud/devspace">DevSpace</a>, an open-source development tool for Kubernetes. Run this command to install DevSpace:</p><pre>npm install -g devspace</pre><h3>1. Create a Vue.js Application (skip if you have one)</h3><p>First, let’s install the Vue CLI globally:</p><pre>npm install -g vue-cli</pre><blockquote><em>You might need to install it with </em><strong><em>sudo</em></strong><em> if you get </em><em>permission denied on Linux or Mac. Or better but more work: follow </em><a href="https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally"><em>this guide to change your global NPM directory</em></a><em>.</em></blockquote><p>Let’s now ask Vue to setup a webpack template for us:</p><pre>vue init webpack-simple my-vuejs-app <br>cd my-vuejs-app</pre><p><strong>The application is now ready and we can deploy it to Kubernetes.</strong></p><h3>2. Containerize our Vue.js Application</h3><p>To run our Vue.js app on Kubernetes, we need a Dockerfile and some Kubernetes manifests. Instead of creating these files manually, we can let DevSpace automatically create them for us with the following command:</p><pre>devspace init</pre><p><strong>DevSpace will ask a couple of questions during the init command.</strong> Take a look at the following sections for more information.</p><blockquote><em>DevSpace just creates some files (e.g. Dockerfile) for us, so we can customize everything later on.</em></blockquote><h4>Creating the Dockerfile for Vue.js</h4><p>If you have <strong>no</strong> Dockerfile in your project, DevSpace will automatically detect that and suggest to create one for you.</p><blockquote><em>If there is already a Dockerfile in your project, DevSpace will offer to use the existing Dockerfile instead of creating a new one.</em></blockquote><pre>? This project does not have a Dockerfile. What do you want to do? [Use arrows to move, space to select, type to filter] <br><strong>&gt; Create a Dockerfile for me <br></strong>  Enter path to your Dockerfile <br>  Enter path to your Kubernetes manifests <br>  Enter path to your Helm chart Use existing image</pre><p>Choose the first option Create a Dockerfile for me by hitting Enter and DevSpace will create a Dockerfile in your project directory.</p><h4>Select Your Programming Language</h4><p>Again, DevSpace will automatically detect your programming language (i.e. javascript), you just need to confirm by hitting Enter.</p><pre>? Select the programming language of this project [Use arrows to move, space to select, type to filter] <br>  java <br><strong>&gt; javascript <br></strong>  none <br>  php <br>  python <br>  ruby <br>  typescript</pre><h4>Choose an Image Registry</h4><p>DevSpace will build a Docker image from your Dockerfile. This image needs to be pushed to a Docker registry like Docker Hub.</p><pre>? Which registry do you want to use for storing your Docker images? [Use arrows to move, space to select, type to filter] <br>  Use hub.docker.com <br><strong>&gt; Use dscr.io (free, private Docker registry) </strong><br>  Use other registry</pre><p>If you already have a Docker Hub account, just select Docker Hub.</p><blockquote><em>In case you don’t have a Docker Hub account or if you don’t know know which option to choose, you can just use dscr.io — it is fast, private and completely free. Once you selected dscr.io, DevSpace will open the login page. You can sign up with GitHub and it will take less than a minute.</em></blockquote><h4>Define The Application Port</h4><p>Vue.js runs on port 8080 in dev mode. Type 8080 and hit Enter.</p><pre>? Which port is your application listening on? (Enter to skip) <strong>8080</strong></pre><blockquote><em>It is important you type in the correct port. Otherwise, it will be a problem to open the app in the browser later on.</em></blockquote><h4>What just happened?</h4><p>After the init command has terminated, you will find the following new files in your project:</p><pre>my-vuejs-app/ <br> | <br> |--devspace.yaml <br> |--Dockerfile <br> |--.dockerignore</pre><p>Besides the configuration for DevSpace in devspace.yaml, there is a new Dockerfile for building a Docker image for our Vue.js app which is needed to deploy the app to Kubernetes.</p><h4>Dockerfile for Vue.js (for Development)</h4><p>The Dockerfile will look like this:</p><pre><strong>FROM</strong> node:8.11.4  </pre><pre><strong>RUN</strong> mkdir /app <br><strong>WORKDIR</strong> /app  </pre><pre><strong>COPY</strong> package.json . <br><strong>RUN</strong> npm install  </pre><pre><strong>COPY</strong> . .  </pre><pre><strong>CMD</strong> [&quot;npm&quot;, &quot;start&quot;] <strong><em># &lt;&lt;&lt;&lt;&lt;&lt;&lt; We need to change this</em></strong></pre><p><strong>Note that this Dockerfile starts our Vue.js app in development mode.</strong> <br>For hosting the Vue.js app in production, it is recommended to use multi-stage Docker builds for creating static assets and then serve them with a web server such as nginx. I will publish a post about this very soon.</p><blockquote><em>Subscribe to get an email about new articles if you are interested in reading my next post. But first, let’s continue with this tutorial…</em></blockquote><p>The autogenerated Dockerfile is almost good to go. We just need to change the command used to start our app. If you open your package.json, you will see that there is no start command in the scripts. Instead, we want to run npm run dev. So, let&#39;s change that in the Dockerfile like this:</p><pre><strong>FROM</strong> node:8.11.4 </pre><pre><strong>RUN</strong> mkdir /app <br><strong>WORKDIR</strong> /app </pre><pre><strong>COPY</strong> package.json . <br><strong>RUN</strong> npm install </pre><pre><strong>COPY</strong> . . </pre><pre><strong>CMD</strong> [&quot;npm&quot;, &quot;run&quot;, &quot;dev&quot;]</pre><p>This Dockerfile:</p><ul><li>defines node as base image</li><li>creates the working directory /app</li><li>copies the package.json into the image and installs the dependencies</li><li>copies the rest of our application into the working directory</li><li>defines npm run dev as the start command for the container</li></ul><p>Adding the package.json separately and installing dependencies before adding the rest of the application allows Docker to use layer-caching and saves a lot of time when building the image because the dependencies will only have to be re-installed when the package.json has changed and not every time we change any other source code file.</p><h4>Helm Chart For Vue.js</h4><p>To start containers in Kubernetes, we need to define so-called <em>Kubernetes manifests</em>. Instead of using plain Kubernetes manifests, it is recommended to bundle them into a so-called Helm chart. <a href="http://helm.sh/">Helm</a> is the package manager for Kubernetes and a Helm chart is a package that can be installed into a Kubernetes cluster using the open-source CLI tool Helm.</p><p>By default, DevSpace deploys your application using the so-called component chart which is a standardized and highly configurable Helm chart. To customize the deployment of your app, you can edit the deployments section of the devspace.yaml config file which looks similar to this one:</p><pre>... <br>deployments: <br>- name: <strong>my-vuejs-app </strong><br>  helm: <br>    chart: <br>      name: <strong>component-chart </strong><br>      version: <strong>v0.0.6 </strong><br>      repo: https://charts.devspace.cloud <br>    values: <br>      containers: <br>      - image: <strong>dscr.io/${DEVSPACE_USERNAME}/devspace </strong><br>      service: <br>        ports: <br>        - port: 8080 <br>...</pre><p>For more information on how to customize this component deployment, take a look <a href="https://devspace.cloud/docs/cli/deployment/components/configuration/overview-specification">customizing components in the DevSpace docs</a>.</p><blockquote><em>Besides components, DevSpace also lets you deploy any other Helm charts and even plain Kubernetes manifests. Take a look at the </em><a href="https://devspace.cloud/docs/cli/deployment/configuration"><em>official DevSpace documentation</em></a><em> to learn more.</em></blockquote><h3>3. Deploy Your Vue.js App</h3><p>Now that our Vue.js app is containerized, we are ready to deploy it to Kubernetes. We just need to tell DevSpace which Kubernetes cluster to use.</p><h4>Option A: Create a Free, Hosted Kubernetes Namespace</h4><p>At this point, I could tell you to create a Kubernetes cluster on Google Cloud or AWS, but do we really need to create an entire Kubernetes cluster just for deploying our small Vue.js app?</p><p>If you don’t have a Kubernetes cluster yet, it is much easier to create a ready-to-go Kubernetes namespace using DevSpace:</p><pre>devspace create space my-vuejs-app</pre><p>This command will create a <strong>free Kubernetes namespace</strong> on DevSpace Cloud which is hosted on Google Cloud.</p><h4>Option B: Use Your Own Kubernetes Cluster (e.g. minikube)</h4><p>DevSpace would not be called swiss army knife for Kubernetes if it didn’t work with any Kubernetes cluster. So, if you already have a Kubernetes cluster and want to use this one instead, you can also use a namespace within your own cluster using the following command:</p><pre>devspace use namespace my-vuejs-app</pre><blockquote><em>DevSpace will create the namespace during the deployment process if it is not existing.</em></blockquote><h4>Build &amp; Deploy Your App</h4><p>Usually, this part of the tutorial would explain how to manually build a Docker image, push it to a registry and mess around with kubectl commands.</p><p>However, DevSpace automates all of this and you will just need to run one single command to deploy your app:</p><pre>devspace deploy</pre><blockquote><em>This command takes a little while when you run it the very first time. If you run it later again, it will be much quicker.</em></blockquote><p>Now it’s time to open your project.</p><pre>devspace open</pre><p>When DevSpace asks you how to open your application, choose the first option: <strong>via localhost</strong></p><pre>? How do you want to open your application? [Use arrows to move, space to select, type to filter] <br><strong>&gt; via localhost (provides private access only on your computer via <br>  port-forwarding) </strong><br>  via domain (makes your application publicly available via ingress)</pre><blockquote><em>If you are using DevSpace Cloud (i.e. you used </em><em>devspace create space before), you can also use the option </em><strong><em>via domain</em></strong><em> to make your application publicly available on an auto-generated domain. For details on how to connect your domain, see </em><a href="https://devspace.cloud/docs/cloud/spaces/domains"><em>adding domains to spaces documentation</em></a><em>.</em></blockquote><figure><img alt="Vue.js template screenshot" src="https://cdn-images-1.medium.com/max/1024/0*cUYKPUZroFDpn5Vf.png" /><figcaption>You should see the Vue.js template. Your app is now deployed!</figcaption></figure><h3>4. Start Development</h3><p>If you want to edit your files and see how you app automatically reloads, simply run:</p><pre>devspace dev</pre><p>DevSpace will deploy the Vue.js app in dev mode, open the app in the browser and start streaming the logs of your application.</p><blockquote><em>Wait until your app has started, change a file and see hot reloading in action. Happy coding!</em></blockquote><h3>Final Thoughts</h3><p>This tutorial gives a quick overview of how to deploy a Vue.js app to Kubernetes using DevSpace. Vue.js as a frontend application might be quite easy to deploy using platforms such as Netlify etc., but using Kubernetes provides a great level of control and portability and is also suitable for backend applications. DevSpace works with every Kubernetes cluster and every programming language, which lets you unify the way you deploy applications across different projects.</p><p>As mentioned above, <strong>this tutorial does not provide an exhaustive guide for creating a fully production-ready deployment of a Vue.js app</strong> (e.g. because it uses a simple Dockerfile to start the Vue.js app in dev mode). However, this article can serve as a starting point for everyone that is interested in using Kubernetes.</p><p>If you have any questions regarding any of the steps I have shown above or regarding Vue.js deployments on Kubernetes in general, feel free to leave a comment. I am happy to help whenever I can.</p><p>For further details on DevSpace, take a look at:</p><ul><li><a href="https://github.com/devspace-cloud/devspace">The DevSpace project on GitHub</a></li><li><a href="https://devspace.cloud/docs">DevSpace Doumentation</a></li></ul><p><em>Originally published at </em><a href="https://devspace.cloud/blog/2019/09/30/deploy-vue-js-to-kubernetes"><em>https://devspace.cloud</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c1ab8b164985" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>