<?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 Kentaro Wakayama on Medium]]></title>
        <description><![CDATA[Stories by Kentaro Wakayama on Medium]]></description>
        <link>https://medium.com/@kentarowakayama?source=rss-4e030f73beb9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*fvuIelxqDouhtvps.</url>
            <title>Stories by Kentaro Wakayama on Medium</title>
            <link>https://medium.com/@kentarowakayama?source=rss-4e030f73beb9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 22:50:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kentarowakayama/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[Node.js Development Workflow for Kubernetes - Debugging (Part 2)]]></title>
            <link>https://medium.com/codersociety/node-js-development-workflow-for-kubernetes-debugging-part-2-6dbe3f8fdecc?source=rss-4e030f73beb9------2</link>
            <guid isPermaLink="false">https://medium.com/p/6dbe3f8fdecc</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[coder-society]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[minikube]]></category>
            <dc:creator><![CDATA[Kentaro Wakayama]]></dc:creator>
            <pubDate>Thu, 24 May 2018 20:23:13 GMT</pubDate>
            <atom:updated>2018-05-24T21:47:57.381Z</atom:updated>
            <content:encoded><![CDATA[<p>Minikube is a single node Kubernetes cluster which runs on your laptop in a virtual machine. It provides the possibility to run applications in a production-like environment and avoids the need to use Docker Compose for local development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lYJ1fKiur0lUu7tbgkuvWw.jpeg" /></figure><p>In this article series we will demonstrate how to run, debug and set up live reload for your containerized Node.js application in Kubernetes.</p><p>You can find the code which we use in this article on GitHub: <a href="https://github.com/coder-society/node-minikube-workflow">https://github.com/coder-society/node-minikube-workflow</a></p><h3>Debugging</h3><p>Clone the <a href="https://github.com/coder-society/node-minikube-workflow">repository</a> and cd into the 2-debugging directory:</p><pre>$ git clone <a href="https://github.com/coder-society/node-minikube-workflow.git">https://github.com/coder-society/node-minikube-workflow.git</a><br>$ cd ../2-debugging</pre><p>You can see in the Dockerfile that we start the Node.js app in debug mode. We specified the host IP0.0.0.0 and debug port 5858 to which we attach the debugger.</p><pre>FROM node:8-alpine</pre><pre>WORKDIR /src</pre><pre>COPY package.json /src/<br>COPY package-lock.json /src/</pre><pre>RUN npm install</pre><pre>ADD . /src</pre><pre>EXPOSE 3000<br>EXPOSE 5858</pre><pre>CMD [&quot;node&quot;, &quot;--inspect=0.0.0.0:5858&quot;, &quot;index.js&quot;]</pre><p>We use Visual Code which provides a great debugging experience for Node.js. In thelaunch.json file, we specified the debug configuration:</p><pre>{<br>    &quot;version&quot;: &quot;0.2.0&quot;,<br>    &quot;configurations&quot;: [<br>        {<br>            &quot;type&quot;: &quot;node&quot;,<br>            &quot;request&quot;: &quot;attach&quot;,<br>            &quot;name&quot;: &quot;Attach to Remote&quot;,<br>            &quot;address&quot;: &quot;192.168.99.100&quot;,<br>            &quot;port&quot;: 30886,<br>            &quot;localRoot&quot;: &quot;${workspaceRoot}&quot;,<br>            &quot;remoteRoot&quot;: &quot;/src&quot;<br>        }<br>    ]<br>}</pre><p>The address value in the configuration is the Minikube IP. You can use minikube ip to retrieve it:</p><pre>$ minikube ip<br>192.168.99.100</pre><p>The remoteRoot value in the configuration is the directory path inside the docker container.</p><p>We specified the nodePort values to prevent Minikube to map the exposed ports randomly.</p><pre>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: node-api<br>spec:<br>  ports:<br>  - name: http<br>    protocol: TCP<br>    port: 80<br>    nodePort: 30001<br>    targetPort: http<br>  - name: debug<br>    protocol: TCP<br>    port: 5858<br>    nodePort: 30002<br>    targetPort: debug<br>  selector:<br>    app: node-api<br>  type: NodePort</pre><p>Run make create to initialize the application in Minikube.</p><pre>$ make create<br>Sending build context to Docker daemon  136.2kB<br>Step 1 : FROM node:8-alpine<br> ---&gt; 016382f39a51<br>Step 2 : WORKDIR /src<br> ---&gt; Using cache<br> ---&gt; 60edc3af49e2<br>Step 3 : COPY package.json /src/<br> ---&gt; Using cache<br> ---&gt; 2f883f662b17<br>Step 4 : COPY package-lock.json /src/<br> ---&gt; Using cache<br> ---&gt; b546a008ec1c<br>Step 5 : RUN npm install<br> ---&gt; Using cache<br> ---&gt; 764610b6a88f<br>Step 6 : ADD . /src<br> ---&gt; fe76275b7e4a<br>Removing intermediate container b5c78d72e01d<br>Step 7 : EXPOSE 3000<br> ---&gt; Running in 132ccdbe05b8<br> ---&gt; ffa44f3adc78<br>Removing intermediate container 132ccdbe05b8<br>Step 8 : EXPOSE 5858<br> ---&gt; Running in 74424a5840f6<br> ---&gt; 10a8dc073af0<br>Removing intermediate container 74424a5840f6<br>Step 9 : CMD node --inspect=0.0.0.0:5858 index.js<br> ---&gt; Running in 152550ff1d38<br> ---&gt; 772501131850<br>Removing intermediate container 152550ff1d38<br>Successfully built 772501131850<br>kubectl apply -f kubernetes/<br>deployment &quot;node-api&quot; created<br>service &quot;node-api&quot; created</pre><p>Press F5 to start the debugger in Visual Code and run minikube service node-api --url to retrieve the exposed URLs of the Kubernetes service:</p><pre>$ minikube service node-api --url<br>http://192.168.99.100:30001<br>http://192.168.99.100:30002</pre><p>Two URLs are returned. One for accessing the API on port 30001 and one with the port 30002 which we use for debugging.</p><p>Make a curl request to verify the API:</p><pre>$ curl http://192.168.99.100:30002<br>Hello World</pre><p>Now make a breakpoint in the route handler and make another request:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L_luNHZTuZUC_FaheggOHA.png" /></figure><p>The app stops at the breakpoint and you can inspect the request options.</p><p>In the next article we will show you how to set up live reload for your Node.js application in Minikube.</p><p><em>Learn more about Coder Society, a network of cutting edge developers, designers and product engineers at </em><a href="https://codersociety.com/"><em>https://codersociety.com</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6dbe3f8fdecc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codersociety/node-js-development-workflow-for-kubernetes-debugging-part-2-6dbe3f8fdecc">Node.js Development Workflow for Kubernetes - Debugging (Part 2)</a> was originally published in <a href="https://medium.com/codersociety">Coder Society</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Node.js Development Workflow for Kubernetes - Basic Setup (Part 1)]]></title>
            <link>https://medium.com/codersociety/node-js-development-workflow-for-kubernetes-part-1-c05e3771d40a?source=rss-4e030f73beb9------2</link>
            <guid isPermaLink="false">https://medium.com/p/c05e3771d40a</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[minikube]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[coder-society]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Kentaro Wakayama]]></dc:creator>
            <pubDate>Wed, 27 Sep 2017 00:43:20 GMT</pubDate>
            <atom:updated>2018-05-24T20:22:28.572Z</atom:updated>
            <content:encoded><![CDATA[<p>Minikube is a single node Kubernetes cluster which runs on your laptop in a virtual machine. It provides the possibility to run applications in a production-like environment and avoids the need to use Docker Compose for local development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lYJ1fKiur0lUu7tbgkuvWw.jpeg" /></figure><p>In this article series we will demonstrate how to run, debug and set up live reload for your containerized Node.js application in Kubernetes.</p><p>You can find the code which we use in this article on GitHub: <a href="https://github.com/coder-society/node-minikube-workflow">https://github.com/coder-society/node-minikube-workflow</a></p><h3>Install Minikube and kubectl</h3><p>On OS X you can install Minikube with Homebrew. You can find installation instructions for other platforms <a href="https://github.com/kubernetes/minikube#installation">here</a>.</p><pre>$ brew cask install minikube</pre><p>We use kubectl to interact with our Kubernetes cluster. It can also be installed with Homebrew. You can find installation instructions for other platforms <a href="https://kubernetes.io/docs/tasks/tools/install-kubectl/">here</a>.</p><pre>$ brew install kubectl</pre><p>You should now be able to start Minikube:</p><pre>$ minikube start<br>Starting local Kubernetes v1.7.0 cluster...<br>Starting VM...<br>Getting VM IP address...<br>Moving files into cluster...<br>Setting up certs...<br>Starting cluster components...<br>Connecting to cluster...<br>Setting up kubeconfig...<br>Kubectl is now configured to use the cluster.</pre><p>Verify the installation by using kubectl to get the running pods and nodes:</p><pre>$ kubectl get pods --all-namespaces<br>NAMESPACE     NAME                          READY     STATUS    RESTARTS   AGE<br>kube-system   heapster-5z549                1/1       Running   0          5m<br>kube-system   influxdb-grafana-f91mq        2/2       Running   0          5m<br>kube-system   kube-addon-manager-minikube   1/1       Running   0          5m<br>kube-system   kube-dns-910330662-8zdn7      3/3       Running   0          5m<br>kube-system   kubernetes-dashboard-645fn    1/1       Running   0          5m</pre><pre>$ kubectl get nodes<br>NAME       STATUS    AGE       VERSION<br>minikube   Ready     6m        v1.7.0</pre><h3>Basic Setup</h3><p>Clone the <a href="https://github.com/coder-society/node-minikube-workflow">repository</a> and cd into the 1-basic-setup directory. Have a look at our Makefile. It provides some convenient commands to interact with Docker and Minikube:</p><pre>$ git clone <a href="https://github.com/coder-society/node-minikube-workflow.git">https://github.com/coder-society/node-minikube-workflow.git</a><br>$ cd 1-basic-setup</pre><h4>$ make create</h4><p>The make create command connects to the docker host running in the Minikube VM. It builds the docker image and applies the Kubernetes manifest files to the Minikube cluster.</p><pre>$ make create<br>Sending build context to Docker daemon   51.7MB<br>Step 1 : FROM node:8-alpine<br> ---&gt; 7a779c246a41<br>Step 2 : WORKDIR /src<br> ---&gt; Using cache<br> ---&gt; bf82d455b228<br>Step 3 : COPY package.json /src/<br> ---&gt; Using cache<br> ---&gt; 971f200e90a2<br>Step 4 : COPY package-lock.json /src/<br> ---&gt; Using cache<br> ---&gt; 47fed9193df0<br>Step 5 : RUN npm install<br> ---&gt; Using cache<br> ---&gt; 142db6f23946<br>Step 6 : ADD . /src<br> ---&gt; b10ee47e048b<br>Removing intermediate container 816dd54c1523<br>Step 7 : EXPOSE 3000<br> ---&gt; Running in 1fa3c746d63d<br> ---&gt; 5bac6c4d188a<br>Removing intermediate container 1fa3c746d63d<br>Step 8 : CMD npm start<br> ---&gt; Running in e7e4fa77cb1a<br> ---&gt; 3063f2d0165e<br>Removing intermediate container e7e4fa77cb1a<br>Successfully built 3063f2d0165e<br>kubectl apply -f kubernetes/<br>deployment &quot;node-api&quot; created<br>service &quot;node-api&quot; created</pre><p>Use can useminikube service node-api --url to retrieve the API URL. Make a curl request to the API:</p><pre>$ curl $(minikube service node-api --url)<br>Hello World</pre><h4>$ make update</h4><p>The make update command builds the image with a timestamp in the tag name (e.g. tmp-1505147929). The Kubernetes deployment image gets updated via the kubectl set image command.</p><p>Open index.js and change the reply value of the route to &#39;Hello Kubernetes&#39;.</p><pre>server.route({<br>  method: &#39;GET&#39;,<br>  path: &#39;/&#39;,<br>  config: {<br>    handler: (res, reply) =&gt; {<br>      reply(&#39;Hello Kubernetes&#39;);<br>    },<br>    description: &#39;Hello World route&#39;,<br>    tags: [&#39;api&#39;],<br>  },<br>});</pre><p>Run make update to update the application in Minikube.</p><pre>$ make update<br>docker build -t codersociety/node-api:tmp-1505148570 .<br>Sending build context to Docker daemon  51.77MB<br>Step 1 : FROM node:8-alpine<br> ---&gt; 016382f39a51<br>Step 2 : WORKDIR /src<br> ---&gt; Using cache<br> ---&gt; deff3e9a115e<br>Step 3 : COPY package.json /src/<br> ---&gt; Using cache<br> ---&gt; e2ab0b9845a9<br>Step 4 : COPY package-lock.json /src/<br> ---&gt; Using cache<br> ---&gt; c815960d9ac8<br>Step 5 : RUN npm install<br> ---&gt; Using cache<br> ---&gt; b86c65ff6454<br>Step 6 : ADD . /src<br> ---&gt; 29c7a32c8d0a<br>Removing intermediate container a12fd5b4f143<br>Step 7 : EXPOSE 3000<br> ---&gt; Running in 782644f6b740<br> ---&gt; d56d725f3f2b<br>Removing intermediate container 782644f6b740<br>Step 8: CMD npm start<br> ---&gt; Running in 16d8f3d2d0dc<br> ---&gt; 6659294b267d<br>Removing intermediate container 16d8f3d2d0dc<br>Successfully built 6659294b267d<br>kubectl set image -f ./kubernetes/deployment.yaml node-api=codersociety/node-api:tmp-1505148570<br>deployment &quot;node-api&quot; image updated</pre><p>Make another request to verify your changes:</p><pre>$ curl $(minikube service node-api --url)<br>Hello Kubernetes</pre><h4>$ make delete</h4><p>The make delete command simply removes the Kubernetes deployment and service which are defined in the kubernetes directory:</p><pre>$ make delete<br>kubectl delete -f kubernetes/<br>deployment &quot;node-api&quot; deleted<br>service &quot;node-api&quot; deleted</pre><p>In the next article we will show you how to debug your Node.js application in Minikube:</p><p><a href="https://blog.codersociety.com/node-js-development-workflow-for-kubernetes-debugging-part-2-6dbe3f8fdecc">https://blog.codersociety.com/node-js-development-workflow-for-kubernetes-debugging-part-2-6dbe3f8fdecc</a></p><p><em>Learn more about Coder Society, a network of cutting edge developers, designers and product engineers at </em><a href="https://codersociety.com/"><em>https://codersociety.com</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c05e3771d40a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codersociety/node-js-development-workflow-for-kubernetes-part-1-c05e3771d40a">Node.js Development Workflow for Kubernetes - Basic Setup (Part 1)</a> was originally published in <a href="https://medium.com/codersociety">Coder Society</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Run a local process in Kubernetes with Telepresence]]></title>
            <link>https://medium.com/codersociety/run-a-local-process-in-kubernetes-with-telepresence-dc16bd593b52?source=rss-4e030f73beb9------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc16bd593b52</guid>
            <category><![CDATA[telepresence]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[coder-society]]></category>
            <dc:creator><![CDATA[Kentaro Wakayama]]></dc:creator>
            <pubDate>Wed, 06 Sep 2017 21:12:47 GMT</pubDate>
            <atom:updated>2017-09-16T17:26:37.979Z</atom:updated>
            <content:encoded><![CDATA[<p>We use <a href="http://www.telepresence.io/">Telepresence</a> in our Kubernetes development stack at <a href="https://codersociety.com/">Coder Society</a>. Telepresence lets you connect a process running locally on your laptop to a Kubernetes cluster. This is useful for development as well as debugging purposes since it gives you access to the running Kubernetes services without having to expose them publicly.</p><p>You can find the code which we use in this article on GitHub: <a href="https://github.com/coder-society/kubernetes-with-telepresence">https://github.com/coder-society/kubernetes-with-telepresence</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JTGRbpFUzfi7K212WCdAVA.jpeg" /></figure><h3>Setup Telepresence</h3><p>We assume that you already have a running Kubernetes cluster and kubectl installed.</p><p>On OS X you can install Telepresence with Homebrew:</p><pre>$ brew cask install osxfuse<br>$ brew install datawire/blackbird/telepresence</pre><p>You can find installation instructions for other platforms <a href="http://www.telepresence.io/reference/install.html">here</a>.</p><p>Verify that your Kubernetes cluster is running:</p><pre>$ kubectl get nodes<br>NAME                                              STATUS    AGE       VERSION<br>ip-172-20-113-130.eu-central-1.compute.internal   Ready     14m       v1.7.0<br>ip-172-20-119-81.eu-central-1.compute.internal    Ready     16m       v1.7.0<br>ip-172-20-46-215.eu-central-1.compute.internal    Ready     14m       v1.7.0<br>ip-172-20-56-176.eu-central-1.compute.internal    Ready     16m       v1.7.0<br>ip-172-20-66-175.eu-central-1.compute.internal    Ready     14m       v1.7.0<br>ip-172-20-76-235.eu-central-1.compute.internal    Ready     16m       v1.7.0</pre><h3>Start a shell with Telepresence</h3><p>Run curl ifconfig.co to get your public IP address:</p><pre>$ curl ifconfig.co<br>37.209.72.147</pre><p>Start a shell that proxies network traffic to Kubernetes and verify that the IP address differs from your public IP address:</p><pre>$ telepresence --run-shell<br>$ curl ifconfig.co<br>52.29.24.213</pre><h3>Access a private Kubernetes service</h3><p>We prepared a simple echo-server which you can deploy to your Kubernetes cluster:</p><pre>$ kubectl apply -f <a href="https://github.com/coder-society/kubernetes-with-telepresence/blob/master/echo-server/echo-server.yaml">./echo-server/echo-server.yaml</a></pre><p>Verify that the pods are running:</p><pre>$ kubectl get pods<br>NAME                           READY     STATUS    RESTARTS   AGE<br>echo-server-1203620631-mk089   1/1       Running   0          6s<br>echo-server-1203620631-pv53n   1/1       Running   0          6s<br>echo-server-1203620631-r035z   1/1       Running   0          6s</pre><p>The echo-server is accessible through a Kubernetes service which is <strong>not</strong> publicly exposed. You can use Telepresence to make a request to the service name. Execute the curl command with the --run option:</p><pre>$ telepresence --run curl http://echo-server<br>{&quot;status&quot;:&quot;ok&quot;,&quot;time&quot;:1502747082460,&quot;hostname&quot;:&quot;echo-server-1203620631-r035z&quot;}</pre><h3>Run a local node process within a private Kubernetes cluster</h3><p>We created a simple task-runner which makes every 3 seconds a request to the echo-server. You can start the local node process with the Telepresence — run option:</p><pre>$ telepresence --run node <a href="https://github.com/coder-society/kubernetes-with-telepresence/blob/master/task-runner/index.js">task-runner/index.js</a><br>{&quot;status&quot;:&quot;ok&quot;,&quot;time&quot;:1502747926293,&quot;hostname&quot;:&quot;echo-server-1203620631-r035z&quot;}<br>{&quot;status&quot;:&quot;ok&quot;,&quot;time&quot;:1502747929273,&quot;hostname&quot;:&quot;echo-server-1203620631-pv53n&quot;}<br>{&quot;status&quot;:&quot;ok&quot;,&quot;time&quot;:1502747932260,&quot;hostname&quot;:&quot;echo-server-1203620631-mk089&quot;}</pre><h3>Swap a Kubernetes deployment with a local process</h3><p>Deploy the echo-server and task-runner to the Kubernetes cluster:</p><pre>$ kubectl apply -f <a href="https://github.com/coder-society/kubernetes-with-telepresence/blob/master/echo-server/echo-server.yaml">./echo-server/echo-server.yaml</a><br>$ kubectl apply -f <a href="https://github.com/coder-society/kubernetes-with-telepresence/blob/master/task-runner/task-runner.yaml">./task-runner/task-runner.yaml</a></pre><p>Verify that the pods are running:</p><pre>$ kubectl get pods<br>NAME                           READY     STATUS    RESTARTS   AGE<br>echo-server-1203620631-mk089   1/1       Running   0          49m<br>echo-server-1203620631-pv53n   1/1       Running   0          49m<br>echo-server-1203620631-r035z   1/1       Running   0          49m<br>task-runner-297154768-1btr3    1/1       Running   0          40m</pre><p>Swap out the echo-server deployment and start the local node server which is exposed on port 3000:</p><pre>$ telepresence --swap-deployment echo-server --expose 3000 --run node <a href="https://github.com/coder-society/kubernetes-with-telepresence/blob/master/echo-server/server.js">echo-server/server.js</a><br>Echo Server listening on <a href="http://localhost:3000/">http://localhost:3000</a><br>Incoming request: 1502666001958<br>Incoming request: 1502666004957<br>Incoming request: 1502666007957</pre><p>The server will now receive the traffic from the task-runner pod which is running inside the Kubernetes cluster.</p><p>Telepresence is an invaluable tool for developing and debugging applications running on Kubernetes. Its functionality to provide secure access to Kubernetes services can also be useful in other situations such as when running integration tests for your private Kubernetes services.</p><p><em>Learn more about Coder Society, a network of cutting edge developers, designers and product engineers at </em><a href="https://codersociety.com/"><em>https://codersociety.com</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc16bd593b52" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codersociety/run-a-local-process-in-kubernetes-with-telepresence-dc16bd593b52">Run a local process in Kubernetes with Telepresence</a> was originally published in <a href="https://medium.com/codersociety">Coder Society</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>