<?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[Rita Zhang - Medium]]></title>
        <description><![CDATA[Software Engineer @ Microsoft - Medium]]></description>
        <link>https://medium.com/rita-zhang?source=rss----5dea5876ae38---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Rita Zhang - Medium</title>
            <link>https://medium.com/rita-zhang?source=rss----5dea5876ae38---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 22:18:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/rita-zhang" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Lego Card Dealing Machine]]></title>
            <link>https://medium.com/rita-zhang/lego-card-dealing-machine-a8ff25a26e38?source=rss----5dea5876ae38---4</link>
            <guid isPermaLink="false">https://medium.com/p/a8ff25a26e38</guid>
            <category><![CDATA[card-game]]></category>
            <category><![CDATA[lego]]></category>
            <category><![CDATA[robotics]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Rita Zhang]]></dc:creator>
            <pubDate>Mon, 17 Feb 2025 18:01:07 GMT</pubDate>
            <atom:updated>2025-02-17T18:25:18.749Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>I enjoy playing cards with friends, but one thing I don’t like is dealing and drawing cards — it takes too much time. So, I decided to build an automatic card dealing machine. Since I love LEGO, I figured it would be more fun to build it using LEGO components.</p><p>I found a few solutions online that seemed promising (<a href="https://youtu.be/MCrWmc_0Hm0?si=qt9DWJe-kAZrD_MB">1</a>, <a href="https://youtu.be/q9IUM4MHVDQ?si=cOa2cs-MYwE8mUqf">2</a>). However, most of these designs did not reliably dispense one card at a time with the cards I had (<a href="https://amzn.to/3Qk7Sfd">3</a>, <a href="https://amzn.to/4i4aGct">4</a>, <a href="https://amzn.to/3CPdhIh">5</a>). So, I designed my own solution that reliably deals one card at a time and is compatible with most cards!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fed9pLQLkCEM&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Ded9pLQLkCEM&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2Fed9pLQLkCEM%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/73f9a71b62bb15968ab6199891ea7207/href">https://medium.com/media/73f9a71b62bb15968ab6199891ea7207/href</a></iframe><h3>Key Improvement</h3><p>The key improvement that differentiates my solution is <strong>an axle added to the front of the card feeder</strong>. The trick is to maintain a small gap between the axle and the wheels — just big enough for one card. This small tweak dramatically improves accuracy, ensuring reliable card dispensing for all kinds of cards.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r9KTpjvFqJML0dHmaRXaaA.png" /></figure><h3>Materials &amp; Components</h3><ul><li><a href="https://amzn.to/4i1lE2d"><strong>LEGO Spike Prime set</strong></a></li><li>(Alternatively, the <a href="https://amzn.to/3CX7ccJ"><strong>LEGO Spike Essential set</strong></a><strong> </strong>might work too)</li></ul><h3>Hardware Setup</h3><p>Follow the pictures below to assembly all the LEGO parts. NOTE: Both motors are connected to the LEGO Spike hub (I used ports B and F, but any port will work as long as you reference it correctly in your program).</p><ul><li><strong>Motor B</strong>: Controls and rotates the direction of dispensing, pointing the card to different positions.</li><li><strong>Motor F</strong>: Dispenses the card.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FWjzsZ3sarEnXvt8qQDYeg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eAJvE4QZNPMvc_xbk2-7bQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TEPtNpqUnIm7biz5EoIvDA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lGRMkbASgSNurXb6r38sbQ.png" /></figure><h3>Programming</h3><p>Follow <a href="https://education.lego.com/en-us/downloads/spike-app/software/">https://education.lego.com/en-us/downloads/spike-app/software/</a> to download the Lego Spike app, get started, and create a new project.</p><h4>Initialization</h4><p>When the program starts, after you start the LEGO Spike hub:</p><ol><li><strong>Motor B </strong>always gets back to the <strong>Start Position: </strong>moves to position degree 0, then position degree 275.</li><li>This two-step approach ensures the motor always moves in the same direction to prevent cables from getting tangled. Moving directly to degree 275 from an unknown position could cause the motor to rotate in the wrong direction and get the cable tangled or stuck.</li><li>By first resetting to 0, we establish a <strong>known reference point</strong> before rotating to 275 degrees.</li></ol><h4>Card Dealing Loop</h4><p>Each iteration:</p><ol><li>The <strong>Deal function</strong> is called to dispense a card.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*r5R3oIePIET9Q_hhoozrIQ.png" /></figure><ol><li>A <strong>broadcast message “turn”</strong> is sent to rotate to the next dispense position.</li><li>This repeats multiple times before broadcasting <strong>“turnback”</strong> to reset back to the <strong>Start position</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*rTXCyOoBWgecRZhawaywfw.png" /></figure><h4>Deal Function</h4><ul><li>Controls <strong>Motor F</strong>, which is responsible for dispensing the card.</li><li><strong>Sequence:</strong></li></ul><ol><li>Set <strong>Motor F’s speed to 40%</strong>.</li><li>Run <strong>Motor F backward for 0.35 seconds</strong>, pulling the card slightly back.</li><li>Set <strong>Motor F’s speed to 100%</strong>.</li><li>Run <strong>Motor F forward for 0.48 rotations</strong>, pushing the card outward.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*_mp0_cEf7xrxrccMUOcf-g.png" /></figure><h4>Why pull the card back first?</h4><p>Pulling the card back before pushing it forward ensures smoother and more reliable dispensing. When the first card is pushed out, the second card may be slightly exposed. This step prevents jamming and increases reliability.</p><h4>Why Use Broadcast Messages?</h4><p>Instead of calling functions directly, I use <strong>broadcast messages (e.g., “turn” or “turnback”)</strong> to enable <strong>asynchronous execution</strong>. This allows:</p><ol><li>Multiple actions to occur in parallel (e.g., dealing a card while adjusting the dispensing direction).</li><li>A <strong>non-blocking execution flow</strong>, making the process faster and more efficient.</li></ol><h3>Conclusion</h3><p>This was a fun LEGO project that solves a real-world problem: automate card dealing to speed up card games so the humans can chat. Hope this inspires you to build your own LEGO-powered projects!</p><p>Let me know in the comments if you build your own version or have any questions! 🚀</p><h3>References</h3><p>[1] <a href="https://youtu.be/MCrWmc_0Hm0?si=qt9DWJe-kAZrD_MB">YouTube Video 1</a><br>[2] <a href="https://youtu.be/q9IUM4MHVDQ?si=cOa2cs-MYwE8mUqf">YouTube Video 2</a><br>[3] <a href="https://amzn.to/3Qk7Sfd">Maverick Playing Cards</a><br>[4] <a href="https://amzn.to/4i4aGct">Bicycle Playing Cards</a><br>[5] <a href="https://amzn.to/3CPdhIh">Bicycle Playing Cards (Alternative)</a><br>[6] <a href="https://amzn.to/41hbmFA">Bicycle Plastic Playing Cards</a><br>[7] <a href="https://amzn.to/4i1lE2d">LEGO Spike Prime Set</a><br>[8] <a href="https://amzn.to/3CX7ccJ">LEGO Spike Essential Set</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8ff25a26e38" width="1" height="1" alt=""><hr><p><a href="https://medium.com/rita-zhang/lego-card-dealing-machine-a8ff25a26e38">Lego Card Dealing Machine</a> was originally published in <a href="https://medium.com/rita-zhang">Rita Zhang</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Azure Key Vault for Kubernetes Data Encryption]]></title>
            <link>https://medium.com/rita-zhang/using-azure-key-vault-for-kubernetes-data-encryption-d5eac8daee71?source=rss----5dea5876ae38---4</link>
            <guid isPermaLink="false">https://medium.com/p/d5eac8daee71</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[encryption]]></category>
            <category><![CDATA[etcd]]></category>
            <dc:creator><![CDATA[Rita Zhang]]></dc:creator>
            <pubDate>Mon, 07 May 2018 23:03:38 GMT</pubDate>
            <atom:updated>2018-05-08T01:15:22.547Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RoYliDQR7SQflZLt." /><figcaption>Photo by <a href="https://unsplash.com/@jamessutton_photography?utm_source=medium&amp;utm_medium=referral">James Sutton</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Kubernetes uses etcd as its persistent storage to store all of its REST API objects. By default, the API server stores secrets as base64 encoded plaintext in etcd. As a result, any user with access to etcd or an attacker gaining access to etcd is able to read all of configurations and data of the cluster. Failing to properly secure your Kubernetes data can result in cloud resources getting hacked and your application secrets getting stolen. The etcd database contains information that may grant an attacker significant visibility into the state of your cluster and keys and secrets to your cloud resources and application data.</p><p>In Kubernetes v1.7, the feature to encrypt resources at rest was introduced. But it only supports encryption using keys in the configuration file (plain text, encoded with base64). To separate the responsibility of key management from operating and managing a Kubernetes cluster, we can use an external trusted Key Management Service (KMS) to manage the keys, such as Microsoft Azure Key Vault and Google Cloud KMS.</p><p>Starting from Kubernetes v1.10, the community added the —-experimental-encryption-provider-config feature flag that controls how API data is encrypted in etcd by KMS providers to secure resources in etcd and to prevent third parties from gaining access to view the content in etcd and etcd backups. In this post, we will demonstrate how to use a KMS provider for encryption at rest and how we designed and implemented the solution.</p><h3>What is it?</h3><p>The KMS provider uses an envelope encryption scheme to encrypt data in etcd. The data is encrypted using a data encryption key (DEK); a new DEK is generated for each encryption. The DEKs are encrypted with a key encryption key (KEK) that is stored and managed in a remote KMS. The KMS provider uses gRPC to communicate with a specific KMS plugin. The KMS plugin, which is implemented as a gRPC server and deployed on the Kubernetes master(s), is responsible for all communication with the remote KMS.</p><h3>How Do I Use This?</h3><p>💡 Make sure you have a Kubernetes cluster v1.10+, which is the minimum version required that supports KMS provider. For more information, refer to Kubernetes doc: <a href="https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/">https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/</a></p><p>There are few ways to create a Kubernetes cluster with Azure Key Vault data encryption. Feel free to select one of the following options and skip the sections that are not relevant for your scenario: acs-engine, AKS, or manual.</p><h4>Demo</h4><p>To see how this works, please checkout this recording by <a href="https://medium.com/u/5d4f384fa574">Lachlan Evenson</a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FyoiNXPrfMKw%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DyoiNXPrfMKw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FyoiNXPrfMKw%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b35076c38b8c93285e4625c8f3324b2c/href">https://medium.com/media/b35076c38b8c93285e4625c8f3324b2c/href</a></iframe><h4>🎁 acs-engine</h4><p>We have added this feature to <a href="https://github.com/Azure/acs-engine">acs-engine</a> so that you do not have to worry about any of the manual steps to set this up. Follow this <a href="https://github.com/Azure/acs-engine/blob/master/docs/kubernetes/features.md#azure-key-vault-data-encryption">doc</a> and this <a href="https://github.com/Azure/acs-engine/blob/master/examples/kubernetes-config/kubernetes-keyvault-encryption.json">api model json </a>to create your own Kubernetes cluster with Azure Key Vault data encryption. Once the cluster is created, you will see an Azure Key Vault and a key in the same resource group as your cluster.</p><h4>🔜 Azure Kubernetes Service (AKS)</h4><p>This feature is coming soon to <a href="https://docs.microsoft.com/en-us/azure/aks/kubernetes-walkthrough">Azure managed Kubernetes Service</a> (AKS).</p><h4>🛠 Manual Configurations</h4><p>To see how to set this up yourself in your own Kubernetes cluaster, you can follow the detailed steps listed <a href="https://github.com/Azure/kubernetes-kms/blob/master/manual-install.md">here</a>.</p><h3>Verifying that Data is Encrypted</h3><p>Now that your cluster has --experimental-encryption-provider-config turned on, it will use the information provided to encrypt and decrypt the data in etcd. From the master nodes, we can verify if data encryption is now using the KMS provider.</p><ol><li>Create a new secret</li></ol><pre>kubectl create secret generic secret1 -n default --from-literal=mykey=mydata</pre><p>2. Using etcdctl, read the secret out of the etcd:</p><pre>$ sudo ETCDCTL_API=3 etcdctl --cacert=/etc/kubernetes/certs/ca.crt --cert=/etc/kubernetes/certs/etcdclient.crt --key=/etc/kubernetes/certs/etcdclient.key get /registry/secrets/default/secret1</pre><pre>/registry/secrets/default/secret1</pre><pre>k8s:enc:kms:v1:azurekmsprovider:VNIsmN5OBwQeqO4-knTQK8ksLJB ...</pre><p>3. Verify the stored secret is prefixed with k8s:enc:kms:v1:azurekmsprovider which indicates the azure kms provider has encrypted the resulting data.</p><p>4. Verify the secret is correctly decrypted when retrieved via the API:</p><pre>kubectl get secrets secret1 -o yaml</pre><p>The output should match mykey: bXlkYXRh, which is the encoded data of mydata.</p><h3>High Level Design</h3><p>To decouple the API server from the out-of-tree KMS providers while retaining the ability of the API server to delegate encrypting secrets to an external trusted KMS service, a gRPC-based implementation of the envelop.Service interface was added to Kubernetes. (See <a href="https://github.com/kubernetes/kubernetes/pull/55684">PR</a>). This KMS plugin service then communicates with the out-of-tree KMS provider through gRPC, as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/983/1*C1lwZhOXi15E3Ee-OsO0BA.png" /></figure><p>To add a new KMS provider, we need to implement the gRPC server, which is completely unknown to the API server. We only need to configure the API server with the KMS provider (gRPC server) endpoint, a unix domain socket connection, for example azure key vault provider’s endpoint: unix:///opt/azurekms.sock so that the API server (gRPC client) can communicate with the new KMS provider as the gRPC server will be handling all details related to the external KMS. The gRPC server needs to know how to connect to the KMS, how to pass the authentication information, and which key(s) to use for encryption and decryption.</p><h3>Implementation</h3><p>The entire solution is in this <a href="https://github.com/Azure/kubernetes-kms">GitHub repo</a>. The follow section assumes you understand the <a href="https://grpc.io/docs/guides/">basics of gRPC</a>.</p><h4><strong>Components:</strong></h4><ul><li>Public APIs for the the gRPC service: <a href="https://github.com/Azure/kubernetes-kms/blob/master/v1beta1/service.proto">service.proto</a></li><li>gRPC service generated from the service protocol buffer: <a href="https://github.com/Azure/kubernetes-kms/blob/master/v1beta1/service.pb.go#L243-L250">service.pb.go</a></li><li>Implementation of the gRPC server for the Azure Key Vault provider : <a href="https://github.com/Azure/kubernetes-kms/blob/master/server.go">server.go</a></li></ul><h4><strong>The Contract</strong></h4><p>To create a gRPC-based service, we need to first define a service contract that specifies the methods that can be called remotely with their parameters and return types as defined in <a href="https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/v1beta1/service.proto">service.proto</a> in the Kubernetes repo. This proto file describes both the service interface and the structure of the payload messages. This is the same service contract used by both the gRPC client in Kubernetes and the gRPC server that talks to the external KMS provider.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fccc45de5a09003bd3108c58c5d85231/href">https://medium.com/media/fccc45de5a09003bd3108c58c5d85231/href</a></iframe><p>With the service definition in service.proto, we use the protoc compiler to generate client-side API and server-side API code.</p><p>Client API for KeyManagementService service</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/817fc1f8eab102d57d8e12d24d2aa3d2/href">https://medium.com/media/817fc1f8eab102d57d8e12d24d2aa3d2/href</a></iframe><p>Server API for KeyManagementService service</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/88e82b1f9ffaaf9c80dedd200948d434/href">https://medium.com/media/88e82b1f9ffaaf9c80dedd200948d434/href</a></iframe><p>Kubernetes API server calls the APIs on the client side while the server side implements the methods declared by the service and runs a gRPC server to handle client calls. The gRPC infrastructure decodes incoming requests, executes service methods, and encodes service responses.</p><h4>The Server</h4><p>To implement the server side of the gRPC service, we need to first create an instance of a gRPC server server:=grpc.NewServer(), register our KeyManagementServiceServer service and its implementation to the gRPC server k8spb.RegisterKeyManagementServiceServer(server, s), and register for signal handling to close socket gracefully on SIGTERM when process exits.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b791dd310f79827bff245bce8dda713d/href">https://medium.com/media/b791dd310f79827bff245bce8dda713d/href</a></iframe><p>To register the KeyManagementServiceServer service with the new gRPC server, we need to create a new instance of the KeyManagementServiceServer service first. Here is where we pass information to the gRPC service about where the service should run pathToUnixSocket, how the service should authenticate against Azure Key Vault via azConfig , and how to retrieve keys from Key Vault for encryption and decryption.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/35330d3d8517b9dcde5bb46bad3679b9/href">https://medium.com/media/35330d3d8517b9dcde5bb46bad3679b9/href</a></iframe><p><strong>Encrypt</strong></p><p>The implementation of Encrypt method calls doEncrypt which calls the Azure Key Vault go SDK kvClient.Encrypt(vaultBaseUrl,keyName,keyVersion, parameter) with the base64 encoded value of the request data and the key from your Azure Key Vault instance to encrypt the data and returns the encrypted data as part of the service response.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d2121e26a190753ecd90bd0de366b744/href">https://medium.com/media/d2121e26a190753ecd90bd0de366b744/href</a></iframe><p><strong>getKey</strong></p><p>The getKey method uses configurations stored in configureFilePath=&quot;/etc/kubernetes/azure.json” to authenticate against your Azure Key Vault instance kvClient using the token returned from GetKeyvaultToken.</p><p>Here is an example of azure.json:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/635d85b4a81e258b16790351a4c58ec6/href">https://medium.com/media/635d85b4a81e258b16790351a4c58ec6/href</a></iframe><p>Then kvClient.GetKey gets the encryption key as specified in the configureFilePath. If the key is not found, we will go ahead and create the key for this service createKey in your Azure Key Vault instance.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/69fe60e887176e5641485491854cef6b/href">https://medium.com/media/69fe60e887176e5641485491854cef6b/href</a></iframe><p><strong>Decrypt</strong></p><p>The implementation of Decrypt method calls doDecrypt which calls the Azure Key Vault go SDK kvClient.Decrypt(vaultBaseUrl,keyName,keyVersion, parameter) with the request data and the key from your Azure Key Vault instance to decrypt the data and returns the base64 decoded value of the decrypted data as part of the service response.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2451b6a1fd73e8e1fa8d6c712e2d138a/href">https://medium.com/media/2451b6a1fd73e8e1fa8d6c712e2d138a/href</a></iframe><h3>Summary</h3><p>Kubernetes is a powerful platform with many ways to extend it. This post provides an example of how API data can be encrypted in etcd by a KMS provider through our own implementation of the KMS plugin gRPC service.</p><h3>References</h3><ul><li>Kubernetes doc: Using a KMS provider for data encryption: <a href="https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/">https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/</a></li><li>acs-engine doc: Enabling Azure Key Vault Encryption: <a href="https://github.com/Azure/acs-engine/blob/master/docs/kubernetes/features.md#azure-key-vault-data-encryption">https://github.com/Azure/acs-engine/blob/master/docs/kubernetes/features.md#azure-key-vault-data-encryption</a></li><li>Azure Kubernetes KMS provider doc: Manual configuration steps: <a href="https://github.com/Azure/kubernetes-kms/blob/master/manual-install.md">https://github.com/Azure/kubernetes-kms/blob/master/manual-install.md</a></li><li>KMS plugin service PR: <a href="https://github.com/kubernetes/kubernetes/pull/55684">https://github.com/kubernetes/kubernetes/pull/55684</a></li><li>Kubernetes KMS Plugin for Azure Key Vault repo: <a href="https://github.com/Azure/kubernetes-kms">https://github.com/Azure/kubernetes-kms</a></li><li>Kubernetes KMS Plugin for Google CloudKMS repo: <a href="https://github.com/GoogleCloudPlatform/k8s-cloudkms-plugin/">https://github.com/GoogleCloudPlatform/k8s-cloudkms-plugin/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5eac8daee71" width="1" height="1" alt=""><hr><p><a href="https://medium.com/rita-zhang/using-azure-key-vault-for-kubernetes-data-encryption-d5eac8daee71">Using Azure Key Vault for Kubernetes Data Encryption</a> was originally published in <a href="https://medium.com/rita-zhang">Rita Zhang</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Whitelist Egress Traffic from Kubernetes]]></title>
            <link>https://medium.com/rita-zhang/whitelist-egress-traffic-from-kubernetes-8a3adefd94b2?source=rss----5dea5876ae38---4</link>
            <guid isPermaLink="false">https://medium.com/p/8a3adefd94b2</guid>
            <category><![CDATA[ingress]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Rita Zhang]]></dc:creator>
            <pubDate>Fri, 23 Mar 2018 00:29:42 GMT</pubDate>
            <atom:updated>2018-03-23T00:29:18.863Z</atom:updated>
            <content:encoded><![CDATA[<p>Ever need to grant particular services from your Kubernetes cluster to have access to an external database that requires you to whitelist the IPs? In this post, I will explain how to do this on Azure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*NW3lY4-VN9UxelgGnjcMMA.png" /></figure><p>TL;DR: To whitelist the egress traffic from your Kubernetes cluster on Azure, you can:</p><ol><li>Create static public IPs for each public facing service (e.g. nginx ingress, wordpress)</li><li>Whitelist all the static public IPs in your load balancer as it will use one of the public IPs for all outbound traffic</li><li>Consider using an ingress-controller to minimize the number of static IPs you need to whitelist. Create ClusterIP type services and route your ingress traffic to the ingress controller by creating ingress resources.</li></ol><h3>But why?</h3><p>For more detailed explanation, you can take a look <a href="https://docs.microsoft.com/en-us/azure/load-balancer/load-balancer-outbound-connections">here</a>. Currently there are few different ways to achieve outbound connectivity in Azure.</p><p>If you have created loadbalancer services in your Kubernetes cluster, then the frontend public ip created by the service has been added to the Azure load balancer. Then Azure Load Balancer will associate the nodes in the load balancer pool with the first frontend ip configured on the load balancer. Once the service with that ip is removed, the source address is updated to be the next frontend ip configured on the load balancer.</p><blockquote>When the load-balanced VM creates an outbound flow, Azure translates the private source IP address of the outbound flow to the public IP address of the public Load Balancer frontend.</blockquote><p>But if you do not have any services created in your Kubernetes cluster, then that means the node is not part of an Azure Load Balancer pool and by default the node does not have an Instance Level Public IP address assigned to it. In that case,</p><blockquote>When the VM creates an outbound flow, Azure translates the private source IP address of the outbound flow to a public source IP address. The public IP address used for this outbound flow is not configurable and does not count against the subscription’s public IP resource limit.</blockquote><p>In other words, it will be random.</p><h3>We don’t like random, how do I do this?</h3><p>If you are like most companies, you want static IPs and you want to make sure the load balancer is using those static IPs for your ingress and egress traffic.</p><h4>Create a Static Public IP</h4><p>To create a static public ip on Azure, use the az cli to create the public ip in the same resource group as your Kubernetes cluster. In this sample, I am using a resource group for my AKS cluster.</p><pre>$ az network public-ip create --resource-group ritaaks_eastus --name myAKSPublicIP --allocation-method static</pre><h4>Create a Sample App for Validation</h4><p>To understand the IP the egress traffic is using, let’s use the below application to test. Thanks to <a href="https://medium.com/u/f252f1a6b4cd">Thomas Stringer</a> for providing this awesome image tstringer/mypublicip. This is the code for the test app.</p><pre>#!/bin/bash</pre><pre>SLEEP_TIME_SECONDS=120</pre><pre>echo &quot;$(date) - retrieving current public ip address every $SLEEP_TIME_SECONDS seconds&quot;</pre><pre>while true; do<br>    echo &quot;$(date) - public ip: $(curl -s checkip.dyndns.org | sed -e &#39;s/.*Current IP Address: //&#39; -e &#39;s/&lt;.*$//&#39;)&quot;<br>    sleep &quot;$SLEEP_TIME_SECONDS&quot;<br>done</pre><p>Let’s deploy this app to our cluster.</p><pre>apiVersion: extensions/v1beta1<br>kind: Deployment<br>metadata:<br>  name: http-svc<br>spec:<br>  replicas: 2<br>  selector:<br>    matchLabels:<br>      app: http-svc<br>  template:<br>    metadata:<br>      labels:<br>        app: http-svc<br>    spec:<br>      containers:<br>      - name: http-svc<br>        image: trstringer/mypublicip<br>        ports:<br>        - containerPort: 8080</pre><pre>---</pre><pre>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: http-svc<br>  labels:<br>    app: http-svc<br>spec:<br>  ports:<br>  - port: 80<br>    targetPort: 8080<br>    protocol: TCP<br>    name: http<br>  selector:<br>    app: http-svc</pre><h4>Update the Service with the Static IP</h4><p>Update the following in your service spec:</p><pre>spec:   <br>  loadBalancerIP: &lt;YOUR STATIC PUBLIC IP&gt;  <br>  type: LoadBalancer</pre><p>Once this service is created, run kubectl logs &lt;http-svc-pod&gt;</p><p>Creating this service will configure a new frontend ip on the Azure Load Balancer in front of your agent nodes. If you do not have any other IPs configured on that load balancer, then all egress traffic from all the pods should now use the public ip you created earlier. If you have previously had other IPs configured on the Azure Load Balancer, then the egress will use the first IP on that load balancer.</p><p>This works…but if you have to create a new loadbalancer type service for every application, then you will end up with lots of different public IPs to maintain. You should consider using an ingress-controller to route all ingress traffic of your services to the ingress-controller. Ingress-controllers provide benefits such as load balancing, SSL/TLS termination, support for URI rewrites, and upstream SSL/TLS encryption.</p><h4>Create an Ingress Controller with this IP</h4><p>For this example, I am using the nginx-ingress controller, which can be easily installed using the following command:</p><pre>helm install stable/nginx-ingress --set controller.service.loadBalancerIP=&lt;YOUR STATIC PUBLIC IP&gt;</pre><p>Route your application traffic to this Ingress Controller by creating a new ingress resource. In this ingress resource, all traffic going to the http-svc service will now to go through the ingress-controller.</p><pre>apiVersion: extensions/v1beta1<br>kind: Ingress<br>metadata:<br>  annotations:<br>    kubernetes.io/ingress.class: nginx<br>  labels:<br>    app: http-svc<br>  name: http-svc<br>  namespace: default<br>spec:<br>  rules:<br>  - http:<br>      paths:<br>      - backend:<br>          serviceName: http-svc<br>          servicePort: 80<br>        path: /</pre><p>Now depending on how many loadbalancer services you have created in your cluster and the order in which you have created them, your egress traffic should be using the first public ip configured on the Azure Load Balancer. But to be safe, you should whitelist all the static IPs configured on the Azure Load Balancer in case one of them gets deleted.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a3adefd94b2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/rita-zhang/whitelist-egress-traffic-from-kubernetes-8a3adefd94b2">Whitelist Egress Traffic from Kubernetes</a> was originally published in <a href="https://medium.com/rita-zhang">Rita Zhang</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding kubectl logs with Virtual Kubelet]]></title>
            <link>https://medium.com/rita-zhang/understanding-kubectl-logs-with-virtual-kubelet-a135e83ae0ee?source=rss----5dea5876ae38---4</link>
            <guid isPermaLink="false">https://medium.com/p/a135e83ae0ee</guid>
            <category><![CDATA[virtual-kubelet]]></category>
            <category><![CDATA[kubectl]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Rita Zhang]]></dc:creator>
            <pubDate>Thu, 04 Jan 2018 21:33:46 GMT</pubDate>
            <atom:updated>2018-01-09T02:14:06.530Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*7zB3cmxgYiu1J-KqLC5gPw.png" /></figure><p>At <a href="https://events.linuxfoundation.org/events/kubecon-and-cloudnativecon-north-america">Kubecon</a> in December, Microsoft <a href="https://azure.microsoft.com/en-us/blog/azure-brings-new-serverless-and-devops-capabilities-to-the-kubernetes-community/">announced</a> a new open source project called <a href="https://github.com/virtual-kubelet/virtual-kubelet">Virtual Kubelet</a>, which I got to work on with a team of awesome Microsoft engineers. Virtual Kubelet enables developers to manage serverless containers on Kubernetes targeting supported serverless container runtimes such as <a href="https://docs.microsoft.com/en-us/azure/container-instances/">Azure Container Instances</a> and <a href="https://hyper.sh/">Hyper.sh</a>. For the purpose of this post, I will show you how I implemented the kubectl logs feature, which allowed me to have a deeper understanding of how kubelet and kubectl logs work.</p><h4>What is Virtual Kubelet?</h4><p>Before we get into kubectl logs, let’s take a look at how Virtual Kubelet works. <a href="https://kubernetes.io/docs/concepts/overview/components/#kubelet">Kubelet</a> is one of the Kubernetes node components. It is the local agent that runs on every node in the cluster that watches for pod specs changes to pods that have been assigned to its node via the Kubernetes API server. It reconciles the pod specs changes by creating, updating, and deleting pods while updating the pod resource and reporting the pod status back to rest of the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*P5zNpHnOSrnmngymAmcAaA.png" /><figcaption>Virtual Kubelet</figcaption></figure><p>Virtual Kubelet is an application that runs within an existing Kubernetes cluster acting as a real node in the cluster. Just like a real Kubelet, when Virtual Kubelet launches, it creates a node resource via the Kubernetes API. Then it continues to watch for changes in scheduled pods assigned to its node. But instead of running on an actual server host, the Virtual Kubelet communicates with its provider to handle changes in its pods that are running on the provider’s serverless container runtime. For more detailed explanation of how Virtual Kubelet works, checkout this <a href="https://erikstmartin.com/post/virtual-kubelet/">great post by Erik Martin</a>.</p><p>Here is a demo I made if you want to see the Virtual Kubelet in action:</p><p><a href="https://asciinema.org/a/WKXAEsqK8leS6QytAdThFVNYZ">untitled</a></p><h4>Benefits of using Virtual Kubelet</h4><p>By running your applications on the provider’s container runtime, you don’t need to pay for running additional VMs in your cluster to support short-lived workloads. Instead of paying for idle VMs to support capacity spikes, you can autoscale with the provider’s container runtime while you pay per second.</p><h4>How kubectl logs work?</h4><p>We all use kubectl logs to help us debug and monitor our applications. But how does it actually work? When a containerized application writes to stdout and stderr, the container engine handles and redirects these streams to a logging driver, which by default in Kubernetes is written to a file in json format. When a user runs the kubectl logs command, the API server makes a request against the Kubelet on the node that is running the pod on the <a href="https://kubernetes.io/docs/reference/generated/kubelet/">default port</a> 10250. The Kubelet then reads the content directly from the log file, then returns it to the response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*5eeRtNSgc8N9SDdseI2a5w.png" /><figcaption>Node level logging</figcaption></figure><p>Here are the actual requests made by the kubectl CLI:</p><ul><li>kubectl logs &lt;pod&gt; : GET /containerLogs/{namespace}/{pod}/{container}</li><li>kubectl logs &lt;pod&gt; --tails=2 : GET /containerLogs/{namespace}/{pod}/{container}?tailLines=2</li><li>kubectl logs &lt;pod&gt; -f : GET /containerLogs/{namespace}/{pod}/{container}?follow=true</li><li>kubectl logs &lt;pod&gt; --since=1m : GET /containerLogs/{namespace}/{pod}/{container}?sinceSeconds=60</li><li>kubectl logs &lt;pod&gt; -p=true : GET /containerLogs/{namespace}/{pod}/{container}?previous=true</li><li>kubectl logs &lt;pod&gt; --limit-bytes=1 : GET /containerLogs/{namespace}/{pod}/{container}?limitBytes=1</li><li>kubectl logs &lt;pod&gt; --timestamps=true : GET /containerLogs/{namespace}/{pod}/{container}?timestamps=true</li></ul><p>To implement this functionality in Virtual Kubelet, we need to:</p><ul><li>Assign Virtual Kubelet’s podIP as the InternalIP of the node so that node-level logging requests will be handled by the Virtual Kubelet. To do so, in <a href="https://github.com/virtual-kubelet/virtual-kubelet/blob/e050fea88939fe828295d7191d149c50355dd0b6/charts/virtual-kubelet/templates/deployment.yaml#L29-L32">deployment.yaml</a>, we get the value of Virtual Kubelet’s podIP with status.podIP, then <a href="https://github.com/virtual-kubelet/virtual-kubelet/blob/e050fea88939fe828295d7191d149c50355dd0b6/providers/azure/aci.go#L323-L333">pass the value as the node’s </a><a href="https://github.com/virtual-kubelet/virtual-kubelet/blob/e050fea88939fe828295d7191d149c50355dd0b6/providers/azure/aci.go#L323-L333">InternalIP</a> as part of <a href="https://godoc.org/k8s.io/api/core/v1#NodeStatus">node’s status</a> corev1.NodeStatus (see code <a href="https://github.com/virtual-kubelet/virtual-kubelet/blob/e050fea88939fe828295d7191d149c50355dd0b6/vkubelet/vkubelet.go#L140-L149">here</a>)</li></ul><pre>- name: VKUBELET_POD_IP          <br>  valueFrom:            <br>    fieldRef:              <br>      fieldPath: status.podIP</pre><ul><li>Enable Virtual Kubelet to <a href="https://github.com/virtual-kubelet/virtual-kubelet/blob/e050fea88939fe828295d7191d149c50355dd0b6/vkubelet/apiserver.go#L29">serve as an HTTPS server</a> to handle HTTPS GET requests with the pattern /containerLogs/{namespace}/{pod}/{container} Since our implementation is in Go, we are using http.ListenAndServeTLS to handle HTTPS requests.</li></ul><pre> r := mux.NewRouter()<br> r.HandleFunc(&quot;/containerLogs/{namespace}/{pod}/{container}&quot;, ApiServerHandler).Methods(&quot;GET&quot;)</pre><pre> err := http.ListenAndServeTLS(addr, certFilePath, keyFilePath, r)</pre><ul><li>Enable Virtual Kubelet to communicate with its provider to <a href="https://github.com/virtual-kubelet/virtual-kubelet/blob/e050fea88939fe828295d7191d149c50355dd0b6/vkubelet/apiserver.go#L56">get container logs from the provider</a>’s serverless container runtime, then return the logs to the response.</li></ul><pre>podsLogs, err := p.GetContainerLogs(namespace, pod, container, tail)</pre><p>That’s it folks! This feature really allowed me to understand how kubelet and logs work. For more details on the actual code, take a look at this <a href="https://github.com/virtual-kubelet/virtual-kubelet/pull/21">commit</a>.</p><p>Contributions to Virtual Kubelet are always welcome! The project can be found on GitHub: <a href="https://github.com/virtual-kubelet/virtual-kubelet">https://github.com/virtual-kubelet/virtual-kubelet</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a135e83ae0ee" width="1" height="1" alt=""><hr><p><a href="https://medium.com/rita-zhang/understanding-kubectl-logs-with-virtual-kubelet-a135e83ae0ee">Understanding kubectl logs with Virtual Kubelet</a> was originally published in <a href="https://medium.com/rita-zhang">Rita Zhang</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Running your Own L2TP/IPsec VPN Server with Raspberry Pi and Docker]]></title>
            <link>https://medium.com/rita-zhang/running-your-own-l2tp-ipsec-vpn-server-with-raspberry-pi-and-docker-7342e19498bd?source=rss----5dea5876ae38---4</link>
            <guid isPermaLink="false">https://medium.com/p/7342e19498bd</guid>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[l2tp]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[ipsec]]></category>
            <category><![CDATA[vpn]]></category>
            <dc:creator><![CDATA[Rita Zhang]]></dc:creator>
            <pubDate>Mon, 01 Jan 2018 23:36:27 GMT</pubDate>
            <atom:updated>2018-01-01T23:45:53.664Z</atom:updated>
            <content:encoded><![CDATA[<p>A year ago, I wrote a post on how to <a href="https://ritazh.com/setup-your-own-l2tp-vpn-server-with-raspberry-pi-170d3d4df04c">Setup your Own L2TP/IPsec VPN Server with Raspberry Pi</a>. I have created a script and a docker image to automate the entire process to make it easy to run your own L2TP/IPsec VPN Server with Raspberry Pi and Docker.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*G3xAnUVV5aE6nIhJlBiMlQ.jpeg" /></figure><h4>Prerequisites</h4><p>Follow the <a href="https://ritazh.com/setup-your-own-l2tp-vpn-server-with-raspberry-pi-170d3d4df04c">previous post</a>, complete step 1 through 6 to setup operating system on the Raspberry Pi and forward UDP port 500 and UDP port 4500 to your Raspberry Pi device.</p><h4>Setup</h4><p>7. To type commands on the Raspberry Pi, you have one of two options:</p><ul><li>ssh into the Raspberry Pi to configure the device</li><li>or if you have a monitor connected to the Raspberry Pi, you can open the terminal on the Raspberry Pi to type the commands</li></ul><p>To ssh, enable ssh on the Raspberry Pi as the latest Raspbian OS has ssh disabled by default. Here are the instructions to enable ssh: <a href="https://www.raspberrypi.org/documentation/remote-access/ssh/">https://www.raspberrypi.org/documentation/remote-access/ssh/</a></p><pre>$ ssh pi@192.168.1.231  # use your own Raspberry Pi IP address here</pre><p>8. Get the following scripts from GitHub. To file issues or questions, feel free to navigate to the <a href="https://github.com/ritazh/l2tpvpn-docker-pi/">l2tpvpn-docker-pi GitHub repo</a>.</p><pre>$ curl -LOk https://github.com/ritazh/l2tpvpn-docker-pi/archive/master.zip &amp;&amp; unzip master.zip &amp;&amp; cd l2tpvpn-docker-pi-master</pre><p>9. Set the following env variables. Then run the scripts to install Docker and run a Docker container for the VPN server.</p><pre>$ export MYGATEWAY=&lt;REDACTED&gt;<br>$ export MYUSERNAME=&lt;REDACTED&gt;<br>$ export MYPASSWORD=&lt;REDACTED&gt;<br>$ export MYSECRET=&lt;REDACTED&gt;<br>$ sudo chmod 755 setupDocker.sh &amp;&amp; sudo chmod 755 setupl2tpvpn.sh<br>$ ./setupDocker.sh<br>$ cd l2tpvpn-docker-pi-master<br>$ ./setupl2tpvpn.sh</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/160a72229d5b839b6886d2f403d1bf84/href">https://medium.com/media/160a72229d5b839b6886d2f403d1bf84/href</a></iframe><p>10. To verify, connect your phone to the VPN server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*yueXyPkkUe9cYMr9fHzNqg.png" /></figure><p>Voila! Now you have your own VPN server at home no matter where you are in the world.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7342e19498bd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/rita-zhang/running-your-own-l2tp-ipsec-vpn-server-with-raspberry-pi-and-docker-7342e19498bd">Running your Own L2TP/IPsec VPN Server with Raspberry Pi and Docker</a> was originally published in <a href="https://medium.com/rita-zhang">Rita Zhang</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Running Jupyter Notebook and Tensorboard on GPU on Azure using Kubernetes]]></title>
            <link>https://medium.com/rita-zhang/running-jupyter-notebook-and-tensorboard-on-gpu-on-azure-using-kubernetes-e4c43948e9a8?source=rss----5dea5876ae38---4</link>
            <guid isPermaLink="false">https://medium.com/p/e4c43948e9a8</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[tensorboard]]></category>
            <category><![CDATA[tensorflow]]></category>
            <dc:creator><![CDATA[Rita Zhang]]></dc:creator>
            <pubDate>Wed, 10 May 2017 23:49:16 GMT</pubDate>
            <atom:updated>2017-08-22T15:42:29.184Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*38RGawBLGIE6t5ZLnBs4QA.png" /></figure><p>In this post, we will walk through how to run Jupyter Notebook and Tensorboard on Azure GPU instances using Kubernetes.</p><h4>First let’s run Tensorflow locally using Docker</h4><p>Using Docker to run Jupyter notebook locally. We will use the official tensorflow docker image as it comes with Jupyter notebook. To verify, browse to the url in the log: e.g. <a href="http://localhost:8888/?token=a3ea3cd914c5b68149e2b4a6d0220eca186fec41563c0413">http://localhost:8888/?token=a3ea3cd914c5b68149e2b4a6d0220eca186fec41563c0413</a></p><pre>docker run -it -p 8888:8888 tensorflow/tensorflow</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yA6-KDkvF33zPGX6LpfYGQ.png" /></figure><p>Using Docker to run Tensorboard locally. To verify, browse to <a href="http://localhost/">http://localhost:</a>6006</p><pre>docker run -it -p 6006:6006 tensorflow/tensorflow tensorboard --logdir /logs</pre><h4>Using an orchestrator like Kubernetes to run Jupyter notebook</h4><p>Prerequisites: If you do not already have a Kubernetes cluster with GPU enabled running, you can follow this documentation to get it done on Azure Container Service engine: <a href="https://github.com/Azure/acs-engine/blob/master/docs/kubernetes/gpu.md">https://github.com/Azure/acs-engine/blob/master/docs/kubernetes/gpu.md</a></p><ol><li>Using the following yaml file, create a pod running tensorflow:</li></ol><ul><li>create a pod using tensorflow image</li><li>expose port 8888 to run jupyter notebook</li><li>mount nvidia libraries from the host VM to a custom directory in the container</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7b7d63efc32d95c33e68e2d576387ae0/href">https://medium.com/media/7b7d63efc32d95c33e68e2d576387ae0/href</a></iframe><p>To verify that the new pod is running on a GPU enabled agent, run <em>kubectl describe pod &lt;pod-name&gt;</em>, you should get the following:</p><pre>Successfully assigned gpu-test to k8s-agentpool1-10960440-1</pre><p>2. Create a Service to run Jupyter Notebook</p><p>Using the pod created in previous step, run</p><pre>kubectl expose pod gpu-test --type=LoadBalancer --name=gpu-service</pre><p>to acquire a new external ip to run Jupyter Notebook on port 8888. This may take few minutes.</p><p>Run <em>kubectl log gpu-test</em> to view log to get the URL for the Jupyter notebook with token. It should look something like:</p><pre><a href="http://localhost:8888/?token=a3ea3cd914c5b68149e2b4a6d0220eca186fec41563c0413">http://localhost:8888/?token=a3ea3cd914c5b68149e2b4a6d0220eca186fec41563c0413</a></pre><p>Next use the URL with token above, replace <em>localhost</em> with the external ip you got from</p><pre>kubectl get svc gpu-service \<br>-o=jsonpath={.status.loadBalancer.ingress[0].ip}</pre><p>to navigate to the Jupyter notebook.</p><h4>Using an orchestrator like Kubernetes to run Tensorboard</h4><ol><li>Using the following yaml file,</li></ol><ul><li>create a pod using tensorflow image</li><li>expose port 6006 to run tensorboard</li><li>create a service running tensorboard</li><li>mount nvidia libraries from the host VM to a custom directory in the container</li><li>then when running the container, include the custom path in LD_LIBRARY_PATH so that the nvidia libraries can be found</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b48e685c6176b41d9601ac3d8519c24e/href">https://medium.com/media/b48e685c6176b41d9601ac3d8519c24e/href</a></iframe><p>2. Once the deployment is done, run <em>kubectl get svc</em> to get the external IP for the tensorboard service. From a browser, navigate to the http://&lt;external IP&gt;:6006 to view the tensorboard.</p><p>Reference: We ran into this <a href="http://stackoverflow.com/questions/42013316/after-building-tensorflow-from-source-seeing-libcudart-so-and-libcudnn-errors">issue</a> and <a href="https://github.com/wbuchwalter/blog-posts/issues/1">here</a>:</p><p>ImportError: libcudnn.5: cannot open shared object file: No such file or directory</p><p>or</p><p>ImportError: libcudnn.so.5: cannot open shared object file: No such file or directory</p><p>It turns out that the mounted volume for the libraries were overriding the ones inside of the container already. <a href="https://github.com/wbuchwalter/">William</a> figured out that we had to mount the libraries to another directory and add it to LD_LIBRARY_PATH. So make sure you add the path as part of the <em>args</em> or the <em>command</em> field in your yaml file.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4c43948e9a8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/rita-zhang/running-jupyter-notebook-and-tensorboard-on-gpu-on-azure-using-kubernetes-e4c43948e9a8">Running Jupyter Notebook and Tensorboard on GPU on Azure using Kubernetes</a> was originally published in <a href="https://medium.com/rita-zhang">Rita Zhang</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Here’s to you 2016! ]]></title>
            <link>https://medium.com/rita-zhang/heres-to-you-2016-73c2dc7932d3?source=rss----5dea5876ae38---4</link>
            <guid isPermaLink="false">https://medium.com/p/73c2dc7932d3</guid>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[2016]]></category>
            <category><![CDATA[startup]]></category>
            <dc:creator><![CDATA[Rita Zhang]]></dc:creator>
            <pubDate>Sat, 31 Dec 2016 21:45:54 GMT</pubDate>
            <atom:updated>2016-12-31T21:45:29.334Z</atom:updated>
            <content:encoded><![CDATA[<p>I don’t normally write end of the year posts. But with so many firsts this year, thought I would write them down for the future Rita to reminisce.</p><h4><strong>January</strong></h4><p>First time presenting in Hong Kong. I was part of the panel discussion for <a href="http://launch.brinc.io/session/manufacturing-in-iot/">Pitfalls of launching an IoT business</a> at the LAUNCH Consumer IoT Summit Hong Kong.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*aKj2m7mfPwfacLJGQ1m1uA.png" /></figure><h4>March</h4><p><a href="http://garagedoorbuddy.com/">GarageDoorBuddy</a> was selected to be 1 of the top 10 startups in Home Automation at the <a href="https://www.crunchbase.com/event/launch-festival-2016-201632">LAUNCH Festival 2016</a> at Fort Mason in SF.</p><h3>GarageDoorBuddy on Twitter</h3><p>Day 2 in the demo pit. More units sold! Happy customers are why we work hard. #launch2016 #LaunchFestival</p><p>Then in late March, I got to be part of the keynote presentation at the <a href="https://build.microsoft.com/">Microsoft Build Conference</a> 2016 along with <a href="https://twitter.com/johnshew">John Shewchuk</a> and <a href="https://twitter.com/StevenGuggs">Steve Guggenheimer</a>. To view the recording, click <a href="https://channel9.msdn.com/Events/Build/2016/KEY02#time=2h35m55s">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*1fhIz0t_ZlZ4uZ66GL0rwg.png" /></figure><h4>April</h4><p>My first time visiting Japan. Got to work with GitHub on <a href="http://electron.atom.io/">Electron</a>. Also got to visit the <a href="http://www.ghibli-museum.jp/en/">Ghibli museum</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q-NiKa-rspUDXY9d9U1WDA.png" /></figure><h4>May</h4><p>First time visiting Dublin Ireland. Got to present about OSS DevOps tools and practices to developers in Ireland.</p><h3>Ju Stroh on Twitter</h3><p>Let&#39;s #Talkdevops at #DECODEDconf for a #DevOps Workshop with #OpenSource technologies with @ritazzhang</p><p>This was also the month I finally got a dog!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*lffCrbm0bGn1LZ--mCdK9A.png" /></figure><h4>July</h4><p>Got to meet Linus Torvalds in person at LinuxCon in Tokyo.</p><h3>Rita Zhang on Twitter</h3><p>Hanging with @Linus__Torvalds at @linuxfoundation #linuxcon @irjudson @StevenGuggs</p><h4>August</h4><p>First time being a part of a filming crew. Got to work behind the scene with <a href="https://twitter.com/johnshew">John Shewchuk</a> and <a href="https://twitter.com/gabrtv">Gabriel Monroy</a> from Deis in Boulder Colorado on <a href="https://youtu.be/a9Yi05GjR-I">Episode 3 of the Decoded show</a> where we discussed DevOps best practices.</p><h3>Dave Mendlen on Twitter</h3><p>@DecodedShow episode 3 is almost ready.... with @gabrtv, @johnshew, @ritazzhang and @MiaVyzis</p><h4>October</h4><p>First time visiting Cuba for vacation. Click <a href="https://www.tripadvisor.com/ShowUserReviews-g147275-d4009804-r441428821-Cuban_Connection_Tour-Varadero_Matanzas_Province_Cuba.html#">here</a> to read more about my trip in Cuba.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BVghbIFrA2QhmPq0iTTceQ.png" /></figure><p>Then, I got to visit Berlin for the first time and presented at Linux Embedded Conference. Click <a href="https://twitter.com/ritazzhang/status/786522094460768257">here</a> to see my talk on <a href="https://twitter.com/ritazzhang/status/786522094460768257">OSS Development for the ESP8266 &amp; Azure</a>. AND…I got to see <a href="https://en.wikipedia.org/wiki/Checkpoint_Charlie">Checkpoint Charlie</a> and the Berlin wall for the first time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QTa6Q2jP5pcIm0kessVkFw.png" /></figure><h4>November</h4><p>First time visiting Singapore. Worked with the Singaporean Government to build some pretty interesting bots for its citizens.</p><h3>GovTech (Singapore) on Twitter</h3><p>There&#39;s lots to talk about when #Singapore Gov agencies #tech teams innovate chatbots the Hackathon way. #GovTechSG. https://t.co/HCMl7m4inz</p><h4>December</h4><p>First time giving a presentation completely in Chinese.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*OJiLSMQzhMsN2lwWIK0zOQ.png" /></figure><p>That was quite a year 2016! Here’s hoping next year will be a even better one! 🍻</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/64/0*4iznkGTvJ19wpJ6q.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=73c2dc7932d3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/rita-zhang/heres-to-you-2016-73c2dc7932d3">Here’s to you 2016! 🍷</a> was originally published in <a href="https://medium.com/rita-zhang">Rita Zhang</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setup your Own L2TP/IPsec VPN Server with Raspberry Pi]]></title>
            <link>https://medium.com/rita-zhang/setup-your-own-l2tp-vpn-server-with-raspberry-pi-170d3d4df04c?source=rss----5dea5876ae38---4</link>
            <guid isPermaLink="false">https://medium.com/p/170d3d4df04c</guid>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[vpn]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Rita Zhang]]></dc:creator>
            <pubDate>Wed, 28 Dec 2016 03:40:22 GMT</pubDate>
            <atom:updated>2018-01-01T23:39:23.763Z</atom:updated>
            <content:encoded><![CDATA[<p>I have been traveling quite a bit this year and I have always relied on connecting to my home VPN to access stuff from home, which was using my <a href="https://www.amazon.com/gp/product/B00FB45SI4/ref=as_li_tl?ie=UTF8&amp;tag=ritazh-20&amp;camp=1789&amp;creative=9325&amp;linkCode=as2&amp;creativeASIN=B00FB45SI4&amp;linkId=77e82fa0c00ea0e2cb84a881434d169b">ASUS RT-AC68U router</a> that supports PPTP VPN. I recently upgraded to iOS 10, which <a href="https://support.apple.com/en-us/HT206844">no longer supports PPTP VPN</a>. Desperately needing a new VPN solution, I shopped around for few paid options, but decided to setup my own L2TP/IPsec VPN with Raspberry Pi. In this tutorial, I will show you how you can do this yourself.</p><h4>Why do you Need a Home VPN Server</h4><p>VPN is a secure way for you to access your home network from anywhere in the world. It provides convenience and peace of mind when accessing your home server and your smart home devices.</p><h4>Why use Raspberry Pi</h4><p><a href="https://www.amazon.com/gp/product/B01CD5VC92/ref=as_li_tl?ie=UTF8&amp;tag=ritazh-20&amp;camp=1789&amp;creative=9325&amp;linkCode=as2&amp;creativeASIN=B01CD5VC92&amp;linkId=5cb2f4eb48237fea9ddcf4172fbdd3bb">Raspberry Pi</a> is tiny computer about the size of a credit card. It has low power consumption and low cost compare to a regular computer.</p><h4>Let’s Get Started</h4><ol><li>Get the following before you start:</li></ol><ul><li><a href="https://www.amazon.com/gp/product/B01CD5VC92/ref=as_li_tl?ie=UTF8&amp;tag=ritazh-20&amp;camp=1789&amp;creative=9325&amp;linkCode=as2&amp;creativeASIN=B01CD5VC92&amp;linkId=5cb2f4eb48237fea9ddcf4172fbdd3bb">Raspberry Pi</a> (Get it <a href="https://www.amazon.com/gp/product/B01CD5VC92/ref=as_li_tl?ie=UTF8&amp;tag=ritazh-20&amp;camp=1789&amp;creative=9325&amp;linkCode=as2&amp;creativeASIN=B01CD5VC92&amp;linkId=5cb2f4eb48237fea9ddcf4172fbdd3bb">here</a>)</li><li><a href="https://www.amazon.com/gp/product/B000WH6H1M/ref=as_li_tl?ie=UTF8&amp;tag=ritazh-20&amp;camp=1789&amp;creative=9325&amp;linkCode=as2&amp;creativeASIN=B000WH6H1M&amp;linkId=d1607e895d180f538921014811c92961">SD card</a> for Raspberry Pi (Get it <a href="https://www.amazon.com/gp/product/B000WH6H1M/ref=as_li_tl?ie=UTF8&amp;tag=ritazh-20&amp;camp=1789&amp;creative=9325&amp;linkCode=as2&amp;creativeASIN=B000WH6H1M&amp;linkId=d1607e895d180f538921014811c92961">here</a>)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/445/1*lvqRKVza_iH4Iw5yPw_NrA.png" /></figure><p>2. Follow <a href="http://lifehacker.com/the-always-up-to-date-guide-to-setting-up-your-raspberr-1781419054">these steps</a> to install an operating system on the Raspberry Pi. Make sure to format the SD card as FAT format. exFAT might not work.</p><p>3. Once the operating system setup is done, you can start to configure a VPN server. (Reference: <a href="https://www.raspberrypi.org/forums/viewtopic.php?t=31541">https://www.raspberrypi.org/forums/viewtopic.php?t=31541</a>)</p><p>4. Find your home router’s gateway address. Usually it is <strong><em>192.168.1.1</em></strong>.</p><p>5. Find your Raspberry Pi’s IP address with one of two options:</p><ul><li>If your Raspberry Pi is connected to a monitor, open the terminal and type <strong><em>ifconfig</em></strong>.</li><li>Or view all the connected devices on your router to find the Raspberry Pi.</li></ul><p>For the following steps, we will assume the gateway address is <strong><em>192.168.1.1</em></strong> and the Raspberry Pi’s address is <strong><em>192.168.1.231</em></strong>. Adjust this tutorial base on your own values.</p><p>6. From your router, setup port forwarding on your router. Forward UDP port 500 and UDP port 4500 to your Raspberry Pi device.</p><p><strong><em>[UPDATE]</em></strong> I have created a Docker image and some scripts to automate the following steps. Head over to this <a href="https://ritazh.com/running-your-own-l2tp-ipsec-vpn-server-with-raspberry-pi-and-docker-7342e19498bd">follow-up post</a> to run your own L2TP/IPsec VPN Server with Raspberry Pi and Docker.</p><p>7. To type commands on the Raspberry Pi, you have one of two options:</p><ul><li>ssh into the Raspberry Pi to configure the device</li><li>or if you have a monitor connected to the Raspberry Pi, you can open the terminal on the Raspberry Pi to type the commands</li></ul><p>To ssh, enable ssh on the Raspberry Pi as the latest Raspbian OS has ssh disabled by default. Here are the instructions to enable ssh: <a href="https://www.raspberrypi.org/documentation/remote-access/ssh/">https://www.raspberrypi.org/documentation/remote-access/ssh/</a></p><pre>$ ssh pi@192.168.1.231  # use your own Raspberry Pi IP address here</pre><p>8. Let’s use your favorite Raspberry Pi editor to edit the following file. For example, I’m using vi, but you can use nano or something else.</p><pre>$ sudo vi /etc/dhcpcd.conf</pre><p>Add the following lines to the end of the file. Make sure you change the IP address and name server to your own.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/359b40f714419436e378924f9f7f8a62/href">https://medium.com/media/359b40f714419436e378924f9f7f8a62/href</a></iframe><p>The above lines set your Raspberry Pi to use static IP address instead of DHCP. On your router, you might want to reserve a range just for static IP addresses so there’s no conflict for static assigned addresses. Now let’s restart the Raspberry Pi to reflect the changes.</p><pre>$ sudo reboot</pre><p>8. Change root password and install packages.</p><pre>$ sudo passwd # this will change the ssh login password<br>$ su # changing to the root user<br>$ apt-get update<br>$ apt-get install openswan xl2tpd ppp lsof</pre><p>When prompted ‘Use an X.509 certificate for this host?’, answer ‘No’. If you want to add it, use ‘dpkg-reconfigure openswan’ to come back.</p><p>9. Type the following commands:</p><pre>iptables —-table nat —-append POSTROUTING —-jump MASQUERADE</pre><pre>echo &quot;net.ipv4.ip_forward = 1&quot; | tee -a /etc/sysctl.conf</pre><pre>echo &quot;net.ipv4.conf.all.accept_redirects = 0&quot; | tee -a /etc/sysctl.conf</pre><pre>echo &quot;net.ipv4.conf.all.send_redirects = 0&quot; | tee -a /etc/sysctl.conf</pre><pre>for vpn in /proc/sys/net/ipv4/conf/*; do echo 0 &gt; $vpn/accept_redirects; echo 0 &gt; $vpn/send_redirects; done</pre><pre>sysctl -p</pre><p>10. Use an editor to edit the following file:</p><pre>$ vi /etc/rc.local</pre><p>Add the following code to the file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e0fac79801975af00676e01dcb754bc6/href">https://medium.com/media/e0fac79801975af00676e01dcb754bc6/href</a></iframe><p>11. Use an editor to edit the following file:</p><pre>$ vi /etc/ipsec.conf</pre><p>Replace the content with the following. Make sure to replace <strong><em>192.168.1.231</em></strong> with your Raspberry Pi’s IP address and <strong><em>192.168.1.1</em></strong> with your gateway’s IP address.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f20dbaebf65e63a01a98fa8e85abb155/href">https://medium.com/media/f20dbaebf65e63a01a98fa8e85abb155/href</a></iframe><p>12. Edit the following file to setup secrets.</p><pre>$ vi /etc/ipsec.secrets</pre><p>Add this line to the end of the file:</p><pre>192.168.1.231 %any: PSK &quot;XXXXXXX&quot;</pre><p>The IP address is your Raspberry Pi’s address. “XXXXXXX” is your own L2TP secret. The client will need this secret and their username and password to connect to the VPN server.</p><p>13. Edit the following file:</p><pre>$ vi /etc/xl2tpd/xl2tpd.conf</pre><p>Replace the content with the following and replace <strong><em>192.168.1.231</em></strong> with your Raspberry’s IP address.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/77cf7f060d245bec611f5e683095a85b/href">https://medium.com/media/77cf7f060d245bec611f5e683095a85b/href</a></iframe><p>14. Edit the following file:</p><pre>$ vi /etc/ppp/options.xl2tpd</pre><p>Replace the content with the following and replace <strong><em>192.168.1.1</em></strong> with your gateway address.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0d89c93a345f85246a75a2812b4e353e/href">https://medium.com/media/0d89c93a345f85246a75a2812b4e353e/href</a></iframe><p>15. Edit the following file:</p><pre>$ vi /etc/ppp/chap-secrets</pre><p>Update the following section with your own username and password. This is the username and password used by client when they connect to the VPN server.</p><pre># Secrets for authentication using CHAP<br># client server secret IP addresses<br> username * PASSWORD *</pre><p>16. Configure VPN server to auto start when the Raspberry Pi boots. From the terminal:</p><pre>$ update-rc.d -f ipsec remove<br>$ update-rc.d ipsec defaults</pre><p>17. Restart the service now. From the terminal:</p><pre>$ /etc/init.d/xl2tpd restart<br>$ /etc/init.d/ipsec restart</pre><p>18. Now use your iphone to connect to the VPN Server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/373/1*KSPUtFZzk0XZW3R6bGXUZw.png" /></figure><p>Voila! Now you have your own VPN server at home no matter where you are in the world.</p><h3>Troubleshooting</h3><ul><li>When you use your iphone to connect to the VPN server, you might get the following error message:</li></ul><blockquote>The L2TP-VPN server did not respond. Try reconnecting. If the problem continues, verify your settings and contact your Administrator.</blockquote><p>and in the /var/log/auth.log, you might see something like this.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fa4e1575770bd5cc4e9e56f7d7c559de/href">https://medium.com/media/fa4e1575770bd5cc4e9e56f7d7c559de/href</a></iframe><p>These errors might be caused by openswan, which is broken on the latest release on the Raspberry Pi. <br><a href="https://www.raspberrypi.org/forums/viewtopic.php?f=36&amp;t=73962">https://www.raspberrypi.org/forums/viewtopic.php?f=36&amp;t=73962</a><br>You will need to use an older version of openswan.</p><p>To install an older version of openswan, from terminal:</p><pre>$ wget <a href="http://snapshot.raspbian.org/201403301125/raspbian/pool/main/o/openswan/openswan_2.6.37-3_armhf.deb">http://snapshot.raspbian.org/201403301125/raspbian/pool/main/o/openswan/openswan_2.6.37-3_armhf.deb</a></pre><pre>$ sudo dpkg -i openswan_2.6.37–3_armhf.deb</pre><p>After installation is complete, restart the VPN server and try again with your iphone. From the terminal:</p><pre>$ /etc/init.d/xl2tpd restart<br>$ /etc/init.d/ipsec restart</pre><p>If VPN still doesn’t work, run the following to get more information:</p><pre>$ sudo ipsec verify</pre><p>Your output should look similar to the following:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/692f9351916c240a1ebd3f5a818da8b3/href">https://medium.com/media/692f9351916c240a1ebd3f5a818da8b3/href</a></iframe><ul><li>If you are seeing the following errors in /var/log/auth.log:</li></ul><blockquote>Can’t authenticate: no preshared key found for ‘192.168.1.231’ and ‘%any’. Attribute OAKLEY_AUTHENTICATION_METHOD</blockquote><p>This usually means either the shared secret entered does not match the source in this file /etc/ipsec.secrets.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=170d3d4df04c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/rita-zhang/setup-your-own-l2tp-vpn-server-with-raspberry-pi-170d3d4df04c">Setup your Own L2TP/IPsec VPN Server with Raspberry Pi</a> was originally published in <a href="https://medium.com/rita-zhang">Rita Zhang</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tom Occhino: Running Open Source at Facebook]]></title>
            <link>https://medium.com/rita-zhang/tom-occhino-running-open-source-at-facebook-58db8a790ab0?source=rss----5dea5876ae38---4</link>
            <guid isPermaLink="false">https://medium.com/p/58db8a790ab0</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[facebook]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Rita Zhang]]></dc:creator>
            <pubDate>Mon, 24 Oct 2016 05:54:45 GMT</pubDate>
            <atom:updated>2016-10-24T05:54:45.167Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*eDZxlXe25BGl-q8I1LOtPQ.png" /></figure><p>Few days ago I went to a React <a href="https://www.eventbrite.com/e/real-world-react-meetup-hosted-by-eventbrite-tickets-27261035491">meetup</a> at Eventbrite in SF with my friend Jack from Pinterest. In addition to learning about the latest in React, I was surprised to hear <a href="https://twitter.com/tomocchino">Tom Occhino</a> talk about what it’s like to run open source projects at Facebook. Here are few things I personally found interesting.</p><h3>What is React</h3><p><a href="https://facebook.github.io/react/">React</a> is an open source JavaScript library for creating interactive user interfaces. It has a huge community and has been widely adopted by companies world wide, most notably used on websites like Facebook, Instagram, Netflix, Airbnb, etc. It was first developed and deployed on Facebook in 2011, then open sourced in 2013. Since then, the Facebook maintained project has grown in popularity. It is now the 6th most starred project of all time on GitHub.</p><h3>Running Open Source at Facebook</h3><p><a href="https://twitter.com/tomocchino">Tom Occhino</a> is an Engineering Manager at Facebook and one of the creators of React Native. He talked about his experience running React and React Native as open source projects at Facebook.</p><p>He mentioned what made React a successful open source project was actually keeping the community small in the beginning. It was first open-sourced at JSConf US in May 2013 when most people did not take the first open source project from Facebook seriously. Instead, the project attracted people who really understood the mission and became not only advocates, but also long time contributors. Another interesting point he mentioned was that the core team of React at Facebook is actually really small — 4 or 5 people. This is only possible by not getting distracted by supporting everyone and focusing hard on the features that really matter.</p><p>Another thing that I thought made the project a success was knowing Facebook is behind the project, not just as one of the main contributors, but also as a production validation for the latest releases. Developers everywhere trust the stability of the library as it gets built, tested, and deployed to Facebook continuously.</p><p>When asked how does one go about to create a successful open source project in a company, Tom responded with “You don’t start off thinking you will create the world’s best framework used by millions of people. Instead you should find a problem that every developer has and try to solve that problem really well.”</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58db8a790ab0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/rita-zhang/tom-occhino-running-open-source-at-facebook-58db8a790ab0">Tom Occhino: Running Open Source at Facebook</a> was originally published in <a href="https://medium.com/rita-zhang">Rita Zhang</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Get Started with ESP32]]></title>
            <link>https://medium.com/rita-zhang/get-started-with-esp32-785a111476f2?source=rss----5dea5876ae38---4</link>
            <guid isPermaLink="false">https://medium.com/p/785a111476f2</guid>
            <category><![CDATA[esp32]]></category>
            <category><![CDATA[internet-of-things]]></category>
            <category><![CDATA[esp8266]]></category>
            <category><![CDATA[iot]]></category>
            <dc:creator><![CDATA[Rita Zhang]]></dc:creator>
            <pubDate>Fri, 30 Sep 2016 03:07:59 GMT</pubDate>
            <atom:updated>2017-02-05T17:34:16.253Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/337/1*HhX5yowdk5ZmusvxGFLzqA.png" /></figure><p>In late 2014, the maker community discovered a nice little WiFi module called ESP8266. Since then, it has been widely adopted from hobbyists to Fortune 500s. Developers everywhere rejoiced at this miracle device that puts the “Internet” in the Internet of Things. <a href="https://www.amazon.com/gp/product/B01MG9BNEN/ref=as_li_tl?ie=UTF8&amp;tag=ritazh-20&amp;camp=1789&amp;creative=9325&amp;linkCode=as2&amp;creativeASIN=B01MG9BNEN&amp;linkId=c0dc6f65fbf18b271bfae904c5befb6a">ESP32</a> is a highly-anticipated successor to ESP8266. In early September, it was officially released. I was fortunate to get my hands on a <a href="https://www.amazon.com/gp/product/B01MG9BNEN/ref=as_li_tl?ie=UTF8&amp;tag=ritazh-20&amp;camp=1789&amp;creative=9325&amp;linkCode=as2&amp;creativeASIN=B01MG9BNEN&amp;linkId=c0dc6f65fbf18b271bfae904c5befb6a">ESP32</a> board. So of course I had to try it. If you are like me, running a Linux VM on a Mac, you might run into the same <a href="https://github.com/espressif/esp-idf/issues/26">issues</a> I had. In this post, I will walk you through the setup process to get a sample up and running on ESP32 using a Linux VM hosted on Mac.</p><h3>What is ESP32?</h3><p><a href="https://www.amazon.com/gp/product/B01MG9BNEN/ref=as_li_tl?ie=UTF8&amp;tag=ritazh-20&amp;camp=1789&amp;creative=9325&amp;linkCode=as2&amp;creativeASIN=B01MG9BNEN&amp;linkId=c0dc6f65fbf18b271bfae904c5befb6a">ESP32</a> is loaded with lots of new features, most notably it combines WiFi and Bluetooth (classic and BLE) wireless capabilities with two CPU cores and it’s got 520KB SRAM. With this chip, developers and makers can now write WiFi and Bluetooth applications for their own IoT devices. For more information about the hardware, checkout this <a href="https://espressif.com/en/products/hardware/esp32/overview">link</a> to read more about this tiny but powerful device.</p><h3>Get Started</h3><p>Assume you already have a ESP32, let’s get started by following one of the instructions in the official ESP32 <a href="https://github.com/espressif/esp-idf/blob/master/docs/">github repo</a>. If you do not have one, you can purchase one <a href="https://www.amazon.com/gp/product/B01MG9BNEN/ref=as_li_tl?ie=UTF8&amp;tag=ritazh-20&amp;camp=1789&amp;creative=9325&amp;linkCode=as2&amp;creativeASIN=B01MG9BNEN&amp;linkId=c0dc6f65fbf18b271bfae904c5befb6a">here</a>. Choose a guide for your specific build environment. This is the same environment you will be building the binaries to flash onto the ESP32 chip. For this post, I chose <a href="https://github.com/espressif/esp-idf/blob/master/docs/linux-setup.rst">the Linux Setup guide</a> for the Linux VM running on my Mac.</p><h3>Map Ports from Host to VM</h3><p>Since I am using a Linux VM running on Mac, first I need to map the serial port from the host machine to the Linux VM. First plug in your ESP32 using a USB cable. Then power it on. From Mac, you can get the name of the serial port by running the following command. In my case, the serial port was mapped to /dev/cu.SLAB_USBtoUART</p><pre>$ ls -l /dev/cu.*</pre><p>Now let’s look at the Linux VM. Assume you already created a Linux VM, first shutdown the VM. Then from the virtualization solution (I’m using Parallels), click <strong>Hardware</strong>, then select <strong>Serial Port 1</strong> from the left panel. From the dropdown, select the port you have identified in the previous step as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*6rY9TLPd_mUUYJ3WVBJIHQ.png" /></figure><p>Then select <strong>USB &amp; Bluetooth</strong> option from the left, click <strong>USB Connection Preferences…</strong>, make sure <strong>Ask me what to do</strong> is selected. Now let’s turn on the Linux VM.</p><p>Once the Linux VM is started, unplug and replug the USB cable connected to ESP32 to the Mac. This will trigger Parallels to show the following prompt after detecting the USB device. Make sure to select the Linux VM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*X4Zx3W7gPZMcWSXv-slv9w.png" /></figure><p>Now comes the tricky part, from the Linux VM, the host USB port is mapped to /dev/ttyUSB0 and the host serial port is mapped to /dev/ttyS0. For the purpose of building and flashing binaries to ESP32, we need to use the /dev/ttyUSB0 port.</p><p>Now follow steps outlined in the <a href="https://github.com/espressif/esp-idf/blob/master/docs/linux-setup.rst">Linux Setup guide</a>, for <a href="https://github.com/espressif/esp-idf/blob/master/docs/linux-setup.rst#step-4-building-and-flashing-the-application">step 4</a>, when running <strong>make menuconfig</strong>, make sure to select the following parameters:</p><ul><li>default serial port: /dev/ttyUSB</li><li>baud rate value: 74880</li><li>SPI mode: DIO</li><li>SPI speed: 40 MHz</li><li>Python 2 interpret: python2</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*dks_xDiaQrRA07MAqTyNAg.png" /></figure><p>Now before we run <strong>make flash, </strong>make sure ESP32 is in <em>Download mode. </em>To enable Download mode, press the <em>Boot</em> button, then the <em>EN</em> button on ESP32 (see below).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/337/1*HhX5yowdk5ZmusvxGFLzqA.png" /></figure><p>Now to run the sample code, make sure ESP32 is in B<em>oot mode</em> by pressing the <em>EN</em> button.</p><p>That’s it folks! Now go create some awesome bots and gadgets! Let me know what you have created!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=785a111476f2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/rita-zhang/get-started-with-esp32-785a111476f2">Get Started with ESP32</a> was originally published in <a href="https://medium.com/rita-zhang">Rita Zhang</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>