<?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 Gerk Elznik on Medium]]></title>
        <description><![CDATA[Stories by Gerk Elznik on Medium]]></description>
        <link>https://medium.com/@gerkElznik?source=rss-34f85a19d2ed------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xeJz5NWdEphbOAuPXZICzQ.jpeg</url>
            <title>Stories by Gerk Elznik on Medium</title>
            <link>https://medium.com/@gerkElznik?source=rss-34f85a19d2ed------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 16:13:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gerkElznik/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Deploy Redis Stack using Bitnami’s Helm chart]]></title>
            <link>https://medium.com/@gerkElznik/deploy-redis-stack-using-bitnamis-helm-chart-d8339453352c?source=rss-34f85a19d2ed------2</link>
            <guid isPermaLink="false">https://medium.com/p/d8339453352c</guid>
            <category><![CDATA[redistimeseries]]></category>
            <category><![CDATA[redisbloom]]></category>
            <category><![CDATA[redis-json]]></category>
            <category><![CDATA[redisearch]]></category>
            <category><![CDATA[redisgraph]]></category>
            <dc:creator><![CDATA[Gerk Elznik]]></dc:creator>
            <pubDate>Tue, 06 Sep 2022 07:00:32 GMT</pubDate>
            <atom:updated>2022-09-06T07:00:32.478Z</atom:updated>
            <content:encoded><![CDATA[<h4>Leverage the Bitnami Helm chart to deploy a Redis Stack server to a Kubernetes cluster; including RediSearch, RedisJSON, RedisGraph, RedisTimeSeries, and RedisBloom</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RSTMo5Lmg76P8hvQ.png" /></figure><h3>Background</h3><p>A developer friend of mine reached out to me looking for a way to run <a href="https://hub.docker.com/r/redis/redis-stack-server">Redis Stack server</a> in Kubernetes, and he was already using the <a href="https://github.com/bitnami/charts/tree/master/bitnami/redis">Bitnami Helm chart for Redis</a> to deploy and run regular OSS Redis, so I decided to see if the Bitnami Helm chart would be flexible enough to use the Redis Stack server container image rather than the chart’s default <a href="https://hub.docker.com/r/bitnami/redis">Bitnami Redis image</a>.</p><p>Long story short, you can, and thanks to flexible configuration options in the Bitnami Helm chart, everything can be deployed using a single helm command. This article will demonstrate how you can do this and explain how it works.</p><p><strong><em>Disclaimer:</em></strong><em> I’ve only focused on getting this configuration to deploy successfully and verified the extended Redis features work by running some simple tests — I haven’t and wouldn’t run this in production without a lot more testing.</em></p><h3>First, why Redis Stack?</h3><blockquote>Redis Stack is an extension of Redis that adds modern data models and processing engines to provide a complete developer experience.<br>In addition to all of the features of OSS Redis, Redis Stack supports:</blockquote><ul><li>Queryable JSON documents <strong>RedisJSON</strong></li><li>Full-text search <strong>RediSearch</strong></li><li>Time series data (ingestion &amp; querying) <strong>RedisTimeSeries</strong></li><li>Graph data models with the Cypher query language <strong>RedisGraph</strong></li><li>Probabilistic data structures <strong>RedisBloom</strong></li></ul><h3>Deploy to Kubernetes using Helm</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/05145acfe4fa98f346d3597c67a69d25/href">https://medium.com/media/05145acfe4fa98f346d3597c67a69d25/href</a></iframe><p>Let’s breakdown what the above helm command is doing:</p><ol><li>helm upgrade -i is shorthand to do a helm install if a release doesn’t already exist, and helm upgrade if one does.</li><li>redis-stack-server is the name of the helm release.</li><li>redis is the name of the chart we want from the repo.</li><li>--repo https://charts.bitnami.com/bitnami is the endpoint for the webserver Bitnami uses to host their charts.</li><li>--atomic will implicitly wait for the entire release to complete and rollback if any component fails</li><li>--version 17.1.4 is Bitnami’s latest redis chart version at the time of this writing.</li><li>--values - allows using a heredoc to specify the values to pass to the helm chart inline.</li><li>global.redis.password: &quot;weak&quot; sets a password for all Redis nodes (master and replicas). Note: This is hard coded for demonstration only, not acceptable in most scenarios.</li><li>image.repository and image.tag allows us to use a custom image, in this case, we want to use the redis-stack-server image and the latest tag at the time of writing from Docker Hub.</li><li>master.args and replica.args are needed to execute custom bash startup scripts (more on that below).</li><li>master.extraVolumes, replica.extraVolumes, master.extraVolumeMounts, and replica.extraVolumeMounts needed to mount the custom ConfigMap below as executable script files for above.</li><li>extraDeploy is a way to have this helm chart create a custom ConfigMap named bitnami-redis-stack-server-merged used by the above extra volumes/mounts. The ConfigMap combines the baked-in entrypoint.sh from the redis-stack-server container image and the startup scripts from the Bitnami helm chart for both the master and replicas. Requiring this “merge” of entrypoint/startup scripts in order to keep what’s needed from each won’t maintain well over time and is error-prone, hopefully, there is a better way.</li></ol><h3>Review what we deployed</h3><p>You should now have a single master (read/write) Pod and three replica (read-only) Pods, and associated Services in your Kubernetes cluster:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*547S9eNWSi00leB4.png" /></figure><p>We can create a port forward to the redis-stack-server-master Service:</p><pre>$ kubectl port-forward -n default svc/redis-stack-server-master 6379:6379</pre><p>Then connect using any client tool for Redis — I’ll use one called <a href="https://getmedis.com/">Medis</a>.</p><p>Connection info:</p><p>- Host: localhost</p><p>- Port: 6379</p><p>- Password: weak</p><p>Now we can run the first three commands shown below that OSS Redis would be capable of running to ensure the basics are working, and then the last three commands that use the extended full-text search capabilities added by the RedisSearch module:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5ocrrJzJNoXZuBgB.png" /></figure><h3>Conclusion</h3><p>The Bitnami Helm chart for Redis has a lot of other configuration options that we didn’t cover in this article that could be used to create a more reliable production-grade deployment of Redis Stack — this article demonstrates how you could get started if you want to proceed down this path.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d8339453352c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reduce CVEs in your containerized Node.js app using a Distroless base image]]></title>
            <link>https://medium.com/@gerkElznik/reduce-cves-in-your-containerized-node-js-app-using-a-distroless-base-image-6caca3505a1b?source=rss-34f85a19d2ed------2</link>
            <guid isPermaLink="false">https://medium.com/p/6caca3505a1b</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[cve]]></category>
            <category><![CDATA[docker-container]]></category>
            <category><![CDATA[distroless]]></category>
            <category><![CDATA[trivy]]></category>
            <dc:creator><![CDATA[Gerk Elznik]]></dc:creator>
            <pubDate>Mon, 16 May 2022 18:49:30 GMT</pubDate>
            <atom:updated>2022-05-16T18:49:30.415Z</atom:updated>
            <content:encoded><![CDATA[<h4>Compare the number of CVEs found in the official Node.js base image versus Google’s distroless Node.js base image</h4><p>When creating a production-ready container image for a Node.js application, you have many options and considerations, the first of which might be the base image to use. You’ll want the runtime to have everything it needs to be stable, but at the same time, you’ll want to remove any unnecessary bloat that will make your app less secure as well as a bigger burden to transport around.</p><figure><img alt="Remove package managers, shells, and other unnecessary programs" src="https://cdn-images-1.medium.com/max/1024/0*Ctue0ZVFfwm0uHpM.png" /><figcaption><a href="https://learnk8s.io/blog/smaller-docker-images">Photo credit: learnk8s.io</a></figcaption></figure><h3>Get the base images</h3><p>Understandably, the first place you might look to is Docker Hub’s <a href="https://hub.docker.com/_/node">official Node.js image</a> where you’ll peruse its supported tags and make decisions on things like:</p><ul><li>What Node version to use?</li><li>Which linux distro (OS) to use, alpine or debian?</li><li>What version of the linux distro (OS) to use?</li><li>Will “slim” images work?</li></ul><p>The purpose of this article is to compare the “official Node.js image” with Google’s distroless image for Node.js, so let us assume for the sake of comparison that for the official Node.js image we decided:</p><ul><li>Use Node <strong><em>16.15.0</em></strong>. We should always choose even numbers with Node because those are the long-term support (LTS) versions, and at the time of this writing Node 18 is still a few months away from being promoted to LTS. Also, pinning all the way to the patch level of the version ensures consistent, reproducible builds and tests.</li><li>Use <strong><em>Debian</em></strong>. When it comes to Node (again, at the time of this writing), Alpine isn’t considered as stable as Debian and is not supported by the Node.js team.</li><li>Use <strong><em>Bullseye</em></strong>. Bullseye is the code word for Debian 11, which is the latest release for the Debian distro at the time of writing and will have the most up-to-date package manager and least CVEs.</li><li>Use <strong><em>Slim</em></strong>. The slim versions are generally just a good way to reduce the bloat.</li></ul><p>The above decisions dictate that we will use:</p><pre>docker pull node:16.15.0-bullseye-slim</pre><p>When it comes to <a href="https://github.com/GoogleContainerTools/distroless">Google’s distroless</a> Node.js image, unfortunately, they don’t provide deterministic tags down to the patch level of Node, so we’ll have to pin to the latest sha256 hash of the image for Node 16 and Debian 11 for our comparison, at the time of writing, for <a href="https://console.cloud.google.com/gcr/images/distroless/global/nodejs-debian11">nodejs-debian11</a>, that is:</p><pre>docker pull gcr.io/distroless/nodejs-debian11@sha256:2b0fe69900014a74bc85fd4588e86b90139777a8fa7e2feea1f14447ea82e651</pre><h3>Compare the two</h3><p>Now that we’ve pulled the images we want to compare, we can use <a href="https://github.com/aquasecurity/trivy">Trivy</a> to scan the images for CVEs. You can install trivy as a CLI tool for your operating system and check the version using trivy --version. Here is the version I’m using for this article:</p><pre><strong>$</strong> trivy --version<br>Version: 0.27.1<br>Vulnerability DB:<br>  Version: 2<br>  UpdatedAt: 2022-05-13 12:07:05.183041398 +0000 UTC<br>  NextUpdate: 2022-05-13 18:07:05.183041198 +0000 UTC<br>  DownloadedAt: 2022-05-13 16:25:10.388442 +0000 UTC</pre><p>Now we can scan the official Node.js image, taking note of the summarized count of CVEs discovered:</p><pre><strong>$</strong> trivy image node:16.15.0-bullseye-slim<br>2022-05-13T10:25:58.045-0600	INFO	Detected OS: debian<br>2022-05-13T10:25:58.045-0600	INFO	Detecting Debian vulnerabilities...<br>2022-05-13T10:25:58.065-0600	INFO	Number of language-specific files: 1<br>2022-05-13T10:25:58.065-0600	INFO	Detecting node-pkg vulnerabilities...<br>node:16.15.0-bullseye-slim (debian 11.3)<br>========================================<br>Total: 77 (UNKNOWN: 0, LOW: 61, MEDIUM: 3, HIGH: 12, CRITICAL: 1)<br>...output redacted for brevity</pre><p>So as we can see, even our latest/greatest supported tag option from the Node.js official image has one <em>Critical</em> CVE (CVE-2022–1292) and 12 <em>High</em> CVEs.</p><p>Now let’s compare this to the latest distroless Node.js image:</p><pre><strong>$</strong> trivy image gcr.io/distroless/nodejs-debian11<br>2022-05-13T11:53:20.702-0600	INFO	Detected OS: debian<br>2022-05-13T11:53:20.702-0600	INFO	Detecting Debian vulnerabilities...<br>2022-05-13T11:53:20.710-0600	INFO	Number of language-specific files: 0<br>gcr.io/distroless/nodejs-debian11 (debian 11.3)<br>===============================================<br>Total: 14 (UNKNOWN: 0, LOW: 11, MEDIUM: 0, HIGH: 1, CRITICAL: 2)<br>...output redacted for brevity</pre><p>I was a little surprised by the result here. We see that distroless has 2 <em>Critical</em> CVEs, but upon inspection, it was actually the same CVE-2022–1292, it just exists in two different libraries, openssl and libssl1.1, so is counted twice — whereas the official Node.js image only has the vulnerability in the libssl1.1 library and it doesn’t contain openssl. Otherwise, as I expected the distroless image has fewer CVEs at 14 compared to 77. Also, the official Node.js image came in at 187MB, whereas the distroless image was a lighter 109MB.</p><h3>In Conclusion</h3><p>Upon comparing the official Node.js base image to Google’s distroless Node.js base image, we can see the distroless image is lighter weight and more secure. You should still test and verify that the given image would provide a stable runtime for your particular Node.js application though. Also, given the nature of the distroless image it will not be as useful for development and testing scenarios:</p><blockquote>“Distroless” images contain only your application and its runtime dependencies. They do not contain package managers, shells or any other programs you would expect to find in a standard Linux distribution.</blockquote><p>This means you will likely need to make your Dockerfile a little more complex and difficult to maintain and add additional <em>stages</em> that will satisfy your development and testing needs — these dev/test stages will still use the official Node.js base image, you will just use the distroless base image for your final production stage (see Docker’s <a href="https://docs.docker.com/develop/develop-images/multistage-build/">multi-stage builds</a>). Also, be sure that between the two base images, the versions of Debian and Node are as in-sync as possible between the stages used for dev/test and the final production stage. If you’re concerned that the additional maintenance required to keep these multiple stages in sync will get overlooked and the risk from inconsistencies outweighs the security benefits of <em>distroless</em> then this option may not be for you.</p><p><em>Originally published at </em><a href="https://gerkelznik.github.io/reduce-cves-nodejs-container"><em>https://gerkelznik.github.io/reduce-cves-nodejs-container</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6caca3505a1b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GraphQL Certified — How I earned my ‘Apollo Graph Developer Associate’ certification in 2 days…]]></title>
            <link>https://medium.com/@gerkElznik/graphql-certified-how-i-earned-my-apollo-graph-developer-associate-certification-in-2-days-605899314734?source=rss-34f85a19d2ed------2</link>
            <guid isPermaLink="false">https://medium.com/p/605899314734</guid>
            <category><![CDATA[odyssey]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[apollo]]></category>
            <category><![CDATA[apollo-server]]></category>
            <category><![CDATA[certification]]></category>
            <dc:creator><![CDATA[Gerk Elznik]]></dc:creator>
            <pubDate>Tue, 19 Apr 2022 21:40:45 GMT</pubDate>
            <atom:updated>2022-04-21T20:14:18.952Z</atom:updated>
            <content:encoded><![CDATA[<h3>GraphQL Certified — How I earned my ‘Apollo Graph Developer Associate’ certification in 2 days for free</h3><h4>Learn about using the Apollo Odyssey learning platform’s hands-on tutorials to start your GraphQL journey, reinforce your knowledge, and become a certified Graph Developer</h4><p>If you’ve heard about GraphQL but haven’t had a chance to get hands-on with it yet, or if GraphQL is already being used at your workplace but your responsibilities don’t allow digging into the details by building with it and you’ve been curious how the pieces all come together, then look no further — <a href="https://www.apollographql.com/tutorials/">Apollo Odyssey</a> is your answer!</p><h3>Apollo Odyssey: Free Learning Platform</h3><p>The learning platform is comprised of several different learning paths, put together as video tutorials and accompanying step-by-step written guides that include in-line quizzes and code challenges to test your understanding as you go. To earn your <a href="https://www.apollographql.com/tutorials/certifications/apollo-graph-associate"><strong><em>Apollo Graph Developer — Associate</em></strong></a> certification, you will need to complete the first five learning paths.</p><blockquote>Developers who obtain this certification possess a solid foundational knowledge of GraphQL and the Apollo tool suite to design a schema, run an Apollo Server, and perform queries with Apollo Client on the frontend.</blockquote><h3>Apollo Graph Developer — Associate</h3><p>As you progress through the five required tutorials, you are building a real-world application called <strong>Catstronauts</strong> which is comprised of a frontend client using JavaScript and <a href="https://reactjs.org/">React</a>, and a backend server using <a href="https://nodejs.org/en/">Node.js</a> as a runtime as well as <a href="https://www.apollographql.com/docs/apollo-server">Apollo Server</a> as a stand-alone spec-compliant GraphQL server.</p><p>Along the way you’re even instructed to leverage <a href="https://www.heroku.com/">Heroku</a> to host the application (free of charge), practicing real-world production deployments and monitoring — here is a link to the <a href="https://gerk-lift-off-client.herokuapp.com/">Catstronauts application</a> I built and deployed.</p><p>I took my time as I was working through the courses — I compared the concepts and <em>best practices</em> I was learning with the codebases of some of the development/product teams I work with so that my learning would apply to my day-to-day job too — it ended up taking me about two days to work through the five learning paths, but that included a lot of time spent digesting the codebases of my colleagues who implemented GraphQL components using slightly different tooling.</p><h3>End Result</h3><p>I found the tutorials were geared almost perfectly for me and the skill level I was going into things with — not only did I pick up a much better understanding of GraphQL, but I also touched up my JavaScript and React skills.</p><p>As a bonus, the Odyssey platform even officially recognizes your new skill with a certificate you can share with the world:</p><figure><img alt="Gerk Elznik — Apollo Graph Developer — Associate Certificate" src="https://cdn-images-1.medium.com/max/1024/0*TRUi0E5-FMZEzWMt" /><figcaption><a href="https://www.apollographql.com/tutorials/certifications/f9f6d24b-1f8c-4fb3-9f97-4dc89d6fa2ce">Gerk Elznik Certificate</a></figcaption></figure><p>My hat’s off to the people at Apollo who created this very nice learning platform — and their site says more advanced certifications will be coming soon — I’m looking forward to it!</p><p><em>Originally published at </em><a href="https://gerkelznik.github.io/apollo-graphql-certification/"><em>https://gerkelznik.github.io/apollo-graphql-certification</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=605899314734" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pull request quality gates for Helm charts]]></title>
            <link>https://medium.com/@gerkElznik/pull-request-quality-gates-for-helm-charts-6e56cecb3?source=rss-34f85a19d2ed------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e56cecb3</guid>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[helm-chart]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[linting]]></category>
            <dc:creator><![CDATA[Gerk Elznik]]></dc:creator>
            <pubDate>Sat, 16 Apr 2022 02:16:06 GMT</pubDate>
            <atom:updated>2022-04-25T13:05:26.794Z</atom:updated>
            <content:encoded><![CDATA[<h4>Personal Projects</h4><h4>Learn about adding CI pipeline quality gates to lint and test your helm charts during a pull request</h4><p>If you’re practicing continuous integration and continuous delivery, it’s a good idea to test and verify <em>actually deploying</em> your changes during a pull request, to ensure they’re production-ready, before you’ve merged them with the main line of code. At this point, a mistake that breaks something hasn’t necessarily caused any problems for your co-workers and the reasoning behind your changes will still be fresh in your head.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/0*l0N8Mh4jhH431CGa.jpg" /><figcaption><a href="https://mokkapps.de/blog/run-automated-electron-app-tests-using-travis-ci/">Photo credit</a></figcaption></figure><p>The challenging aspect of testing an actual deployment is that it requires a <em>target environment</em> to be running and ready which can be too time-consuming to seem feasible for every pull request — you also want the test environment to have as much parity with your production environment as possible or else the value of the tests will diminish the more disparate they are.</p><p>Fortunately, when we’re working with Kubernetes, there are a growing number of options to quickly spin up a local cluster with high feature parity to that of your production cluster. This article will demonstrate one such option by using <a href="https://kind.sigs.k8s.io/">kind</a> in a CI pipeline (we’ll use GitHub Actions, but kind could be used in any CI tool that has Docker available). In my previous article, I demonstrated how to <a href="https://gerkelznik.github.io/provision-personal-helm-chart-repo/"><em>Provision a free personal Helm chart repo using GitHub</em></a>; we’ll now continue where it left off and see how to add automated <strong>linting</strong> and <strong>testing</strong> of our charts on every pull request – the tests will utilize a disposable kind cluster as a fully-functional Kubernetes environment.</p><h3>Step 1: Set up a Branch Policy enforcing pull requests</h3><p>Using the GitHub <a href="https://github.com/gerkElznik/helm-charts">repository</a> we set up in the last article, we already created a <a href="https://github.com/gerkElznik/helm-charts/actions/workflows/release.yml">Release Charts</a> pipeline that is triggered when a change is pushed to the main branch, and it then creates a new <a href="https://docs.github.com/en/enterprise-cloud@latest/repositories/releasing-projects-on-github/about-releases">GitHub Release</a> if a new version for a chart is detected, however, as I learned the hard way by overlooking something, it is possible to create a release for a chart that is in a state that won’t successfully deploy to Kubernetes – this required me to create a fix and then delete and recreate the bad release – which obviously would have been bad news for an end-user who quickly picked up the new release and started depending on it before I was able to fix the mistake.</p><p>Because I was the only one working on the code in this repo, I was lazily working directly on the main branch locally and pushing changes directly to the remote main branch without a pull request or anyone else reviewing my changes. I’d like to prevent the possibility of another mistake leading to a bad release of my helm charts so the first thing I need to do is start requiring all changes to the main branch to come via a pull request. This can be accomplished with a branch policy, or as they are called in GitHub, a <a href="https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/managing-a-branch-protection-rule">Branch protection rule</a> as shown here:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yd1-phLrFuzvnCmu.png" /></figure><p>I’m not using it in this case, but the option to <a href="https://docs.github.com/en/enterprise-server@3.4/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners">Require review from Code Owners</a> is a really powerful feature I usually use when working with a cross-functional team that shares a code base, but where different members of the team have specialties in certain areas and need to review any changes to specific files or directories associated with their role or specialty.</p><p>Since you are most likely an administrator of your GitHub repo and we want this protection to apply for you as well as anyone else, be sure to also check the Include administrators option.</p><h3>Step 2: Configure CI pipeline to trigger on pull requests</h3><p>Now that we’ve ensured all changes to our main line of code come from a pull request, we can use that to trigger a CI pipeline and add quality gates to our continuous integration process.</p><p>Example GitHub Actions Workflow <a href="https://github.com/gerkElznik/helm-charts/blob/main/.github/workflows/lint-test.yml">.github/workflows/lint-test.yml</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*riGi5rZbuScwELXp0JEOZQ.png" /><figcaption>lint-test.yml</figcaption></figure><p>Example chart-testing config file <a href="https://github.com/gerkElznik/helm-charts/blob/main/.github/chart-testing-config.yml">.github/chart-testing-config.yml</a></p><pre># See https://github.com/helm/chart-testing#configuration<br>remote: origin<br>target-branch: main<br>chart-dirs:<br>  - charts<br>helm-extra-args: --timeout 600s</pre><p>The above YAML config files will add a new workflow named <a href="https://github.com/gerkElznik/helm-charts/actions/workflows/lint-test.yml">Lint and Test Charts</a> that is triggered on every pull request and must succeed in order for the pull request to be merged; let’s breakdown the steps:</p><ol><li><strong>Checkout:</strong> Checks out the new version of the code.</li><li><strong>Set up Helm:</strong> Helm is a dependency for the chart-testing tool used later.</li><li><strong>Set up Python:</strong> Python is a dependency for the Chart Testing tool used later.</li><li><strong>Set up chart-testing:</strong> Install the ct CLI tool, see <a href="https://github.com/helm/chart-testing">https://github.com/helm/chart-testing</a>.</li><li><strong>Run chart-testing (list-changed):</strong> Sets an output value of changed to true if the changes in this pull request actually changed a chart, otherwise we can save on build time and avoid running unnecessary steps.</li><li><strong>Run chart-testing (lint):</strong> Runs helm lint, version checking, YAML schema validation on Chart.yaml, YAML linting on Chart.yaml and values.yaml, and maintainer validation on. See <a href="https://github.com/helm/chart-testing/blob/main/doc/ct_lint.md">ct lint</a>.</li><li><strong>Create kind cluster:</strong> Runs a local Kubernetes cluster using Docker to provide a test environment. Skipped if no chart changes were detected earlier to avoid lengthy build times. Note that an optional config input with the path to a <a href="https://kind.sigs.k8s.io/docs/user/configuration">kind config file</a> can be used to customize your test cluster.</li><li><strong>Run chart-testing (install):</strong> Runs <a href="https://helm.sh/docs/helm/helm_install">helm install</a> and <a href="https://helm.sh/docs/helm/helm_test">helm test</a>. Ensures that your helm chart deploys successfully to a real Kubernetes cluster. Also runs the helm chart’s tests which are helm hooks that can run all kinds of functional tests against your chart release in a real environment. See <a href="https://github.com/helm/chart-testing/blob/main/doc/ct_install.md">ct install</a>.</li><li><strong>Run chart-testing (upgrade):</strong> Same as above, except it validates tests will pass after upgrading a chart that has an existing release (of the chart’s previous version). This provides extra protection for problems that wouldn’t arise on a chart’s initial release but occur on subsequent releases.</li></ol><h3>Step 3: Verify by changing a chart and creating a pull request</h3><p>Everything should be in place now to lint and test changes to any helm charts in the repo, the last thing to do is verify things are working as expected. First, we can make a small change to the existing helm chart on our local main branch and ensure the branch protection rule will prevent pushing the change directly to the remote main branch. I’ll just add an innocuous additional label to the Service created by the helm chart called foo: bar:</p><pre>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: {{ include &quot;macgruber.fullname&quot; . }}<br>  labels:<br>    {{- include &quot;macgruber.labels&quot; . | nindent 4 }}<br>    foo: bar<br>spec:<br>  type: {{ .Values.service.type }}<br>  ports:<br>    - port: {{ .Values.service.port }}<br>      targetPort: http<br>      protocol: TCP<br>      name: http<br>  selector:<br>    {{- include &quot;macgruber.selectorLabels&quot; . | nindent 4 }}</pre><p><em>Reference </em><a href="https://github.com/gerkElznik/helm-charts/commit/b03a6542f36c876e5e4669421bddf40bb46749b7"><em>charts/macgruber/templates/service.yaml</em></a></p><p>I’ll also bump version: 0.1.0 to version: 0.1.1 in <a href="https://github.com/gerkElznik/helm-charts/blob/main/charts/macgruber/Chart.yaml">Chart.yaml</a>.</p><p>Then I will try pushing this change:</p><pre><strong>$</strong> git add . <br><strong>$</strong> <br><strong>$</strong> git commit -m &quot;Add innocuous foo label and bump chart version&quot;<br>[main 055d4d0] Add innocuous foo label and bump chart version<br> 1 file changed, 1 insertion(+), 1 deletion(-)<br><strong>$</strong> <br><strong>$</strong> git push                                                      <br>Enumerating objects: 9, done.<br>Counting objects: 100% (9/9), done.<br>Delta compression using up to 8 threads<br>Compressing objects: 100% (4/4), done.<br>Writing objects: 100% (5/5), 494 bytes | 494.00 KiB/s, done.<br>Total 5 (delta 2), reused 0 (delta 0), pack-reused 0<br>remote: Resolving deltas: 100% (2/2), completed with 2 local objects.<br>remote: error: GH006: Protected branch update failed for refs/heads/main.<br>remote: error: Changes must be made through a pull request.<br>To github.com:gerkElznik/helm-charts.git<br><strong> ! [remote rejected] main -&gt;</strong> main (protected branch hook declined)<br>error: failed to push some refs to &#39;github.com:gerkElznik/helm-charts.git&#39;</pre><p>Success! We protected ourselves from being able to push directly to the main branch. Let’s try that again by using a non-protected branch:</p><pre><strong>$</strong> git branch newlabel <br><strong>$</strong> <br><strong>$</strong> git reset --keep HEAD~1<br><strong>$</strong> <br><strong>$</strong> git checkout newlabel<br>Switched to branch &#39;newlabel&#39;<br><strong>$</strong> <br><strong>$</strong> git push --set-upstream origin newlabel<br>Enumerating objects: 9, done.<br>Counting objects: 100% (9/9), done.<br>Delta compression using up to 8 threads<br>Compressing objects: 100% (4/4), done.<br>Writing objects: 100% (5/5), 494 bytes | 494.00 KiB/s, done.<br>Total 5 (delta 2), reused 0 (delta 0), pack-reused 0<br>remote: Resolving deltas: 100% (2/2), completed with 2 local objects.<br>remote: <br>remote: Create a pull request for &#39;newlabel&#39; on GitHub by visiting:<br>remote:      https://github.com/gerkElznik/helm-charts/pull/new/newlabel<br>remote: <br>To github.com:gerkElznik/helm-charts.git<br><strong> * [new branch]      newlabel -&gt;</strong> newlabel<br>Branch &#39;newlabel&#39; set up to track remote branch &#39;newlabel&#39; from &#39;origin&#39;.</pre><p>This time it worked pushing to a non-protected branch. Now open a pull request merging the newlabel branch into the main branch. We should see our Lint and Test Charts automatically run, but notice it failed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LbiREB0it-yblp70.png" /></figure><p>If we look at the Details we see that we violated one of our linting rules to ensure that a maintainer has been added to the chart.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_gB2LwbrYVhoZSNu.png" /></figure><p>To resolve this, I added the following to my Chart.yaml and pushed it to the remote newlabel branch:</p><pre>maintainers:<br>- name: gerkElznik<br>  email: 69826913+gerkElznik@users.noreply.github.com</pre><p>Once the change is pushed, the pull request will automatically re-run the Lint and Test Chartsworkflow, this time successfully:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZV-pFcrU6-0yV7a5.png" /></figure><p>Notice that in less than three minutes we were able to spin up our local Kubernetes cluster, perform a fresh install of our new chart version, and perform an install of the previous chart version followed by an upgrade to the new chart version.</p><h3>In Conclusion</h3><p>After accidentally creating a release for my helm chart that was in a bad state and failed to install, I decided it was necessary to add some quality gates that would protect me from myself — as the old proverb says, <em>“to err is human”</em> — by protecting the main line of code and requiring pull requests to be used I was able to force changes to my helm charts to pass linting and testing, ensuring they can be successfully released to a real Kubernetes environment before risking polluting my teammate’s code or releases that others depend on with bugs or mistakes.</p><p>If you enjoyed this post I’d appreciate some claps!</p><p><em>Originally published at </em><a href="https://gerkelznik.github.io/pull-request-quality-gates-helm-charts"><em>https://gerkelznik.github.io/pull-request-quality-gates-helm-charts</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e56cecb3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Provision a free personal Helm chart repo using GitHub]]></title>
            <link>https://medium.com/@gerkElznik/provision-a-free-personal-helm-chart-repo-using-github-583b668d9ba4?source=rss-34f85a19d2ed------2</link>
            <guid isPermaLink="false">https://medium.com/p/583b668d9ba4</guid>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[github-pages]]></category>
            <category><![CDATA[helm-chart]]></category>
            <category><![CDATA[github-container-registry]]></category>
            <dc:creator><![CDATA[Gerk Elznik]]></dc:creator>
            <pubDate>Thu, 07 Apr 2022 18:43:46 GMT</pubDate>
            <atom:updated>2022-04-25T13:14:15.647Z</atom:updated>
            <content:encoded><![CDATA[<h4>Personal Projects</h4><h4>Learn why you should consider using GitHub to host your personal helm chart repo, including step-by-step instructions to get started with a real example</h4><p>Who couldn’t use their very own personal helm chart repository these days? I know I sure could. But I know what you’re thinking, <em>“welp, there’s another fee periodically dinging me for something I rarely use — I already haven’t used my Peacock Plus subscription since I finished watching MacGruber months ago…”</em>, right?</p><figure><img alt="MacGruber says Wrong" src="https://cdn-images-1.medium.com/max/854/0*9DQXEK-DPAztz049.jpg" /><figcaption>Photo credit: <a href="https://www.pastemagazine.com/comedy/macgruber/macgruber-tv-series">Paste Magazine</a></figcaption></figure><p>Wrong. Thanks to the features GitHub provides us <strong>free of charge</strong> we can host our helm chart repo, we can store our docker images, we can cut new releases, we can have automated CI processes, and with the money we’re saving we can even afford to hang on to that otherwise worthless Peacock Plus subscription until the next season of MacGruber drops! Let’s take a look at the building blocks first, and then we’ll walk through the steps to set up a real world <a href="https://github.com/gerkElznik/helm-charts">example</a>:</p><ul><li><a href="https://docs.github.com/en/get-started/quickstart/create-a-repo">GitHub Repo</a> will store our code and configuration of the other features.</li><li><a href="https://pages.github.com/">GitHub Pages</a> will provide us with a public endpoint and an HTTP server for our chart repo.</li><li><a href="https://docs.github.com/en/actions">GitHub Actions</a> will provide us with pipelines for our automated workflows.</li><li><a href="https://helm.sh/docs/howto/chart_releaser_action">Chart Releaser</a> is an open source <a href="https://github.com/helm/chart-releaser">tool</a> that will make this all a breeze (and inspired this article).</li><li><a href="https://docs.github.com/en/enterprise-cloud@latest/repositories/releasing-projects-on-github/about-releases">GitHub Releases</a> will store our packaged helm chart releases (versions).</li><li><a href="https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry">GitHub Container Registry</a> will store our custom docker images (versions).</li></ul><h3>Step 1: Create a GitHub Repo to house everything</h3><p>My intention is for this repo to be a central home for all of my personal helm charts, not just a single chart, so I’m going to create a new public repo generically named helm-charts, taking my inspiration from the <a href="https://github.com/prometheus-community/helm-charts">prometheus-community</a> repo which is home to a multitude of charts in a single repo. Also, just to prepare, if you read the <a href="https://helm.sh/docs/howto/chart_releaser_action">documentation</a> for Chart Releaser which we’ll be using in a bit, it instructs us to create a branch in our new repo explicitly named gh-branch used by GitHub Pages, and also to keep our charts in a directory explicitly named charts (this is configurable if you desire a different name) in the main branch.</p><p>I created a new helm-charts repo in my web browser and cloned it to the machine I’m working on:</p><pre>git clone https://github.com/gerkElznik/helm-charts.git &amp;&amp; cd helm-charts</pre><h3>Step 2: Set up GitHub Pages for a repo endpoint</h3><p>Create a new branch named gh-pages (it will contain separate content and lineage than the main branch and they’re never intended to be merged):</p><pre>git checkout --orphan gh-pages<br>git rm -rf .<br>git commit -m &quot;Initial commit&quot; --allow-empty<br>git push --set-upstream origin gh-pages</pre><p>After creating the gh-pages branch you can see GitHub Pages is automatically enabled and contains a URL for your site by going to Settings &gt;&gt; Pages:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mpzO2EGzn8Befuq3.png" /></figure><h3>Step 3: Automate it all with Workflows in GitHub Actions</h3><p>There will also be a new <strong>GitHub Actions Workflow</strong> named pages-build-deploy created automatically after you created the gh-pages branch:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MkhhO7Jnsw3GLo1K.png" /></figure><p>Usually, this workflow only runs after the index.yaml file for our helm repo is updated in the gh-pages branch for us by the Chart Releaser tool, but to add some instructions to our helm repo’s public endpoint (in the event a user visits it with a browser), we can add a README.md to the root of the gh-pages branch and push it (you could alternatively write an index.html if you prefer working with HTML over markdown), this should trigger your pages-build-deploy workflow and when it completes you can browse to your site and see your instructions.</p><p>Example <a href="https://github.com/gerkElznik/helm-charts/blob/gh-pages/README.md">README.md</a> will result in this instructional page <a href="https://gerkelznik.github.io/helm-charts">https://gerkelznik.github.io/helm-charts</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*p7bkO556CUg9eGL3.png" /></figure><p>Now we’ll make use of the Chart Releaser tool’s free <a href="https://github.com/marketplace/actions/helm-chart-releaser">marketplace GitHub Action</a> by creating a new Workflow (eg: <a href="https://github.com/gerkelznik/helm-charts/blob/main/.github/workflows/release.yml">.github/workflows/release.yml</a> in the main branch) with the following content:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZrkyVC27kOruxyIXa1P8hg.png" /><figcaption>release.yml</figcaption></figure><blockquote>This uses <a href="https://www.github.com/helm/chart-releaser-action">@helm/chart-releaser-action</a> to turn your GitHub project into a self-hosted Helm chart repo. It does this — during every push to main — by checking each chart in your project, and whenever there’s a new chart version, creates a corresponding <a href="https://help.github.com/en/github/administering-a-repository/about-releases">GitHub release</a> named for the chart version, adds Helm chart artifacts to the release, and creates or updates an index.yaml file with metadata about those releases, which is then hosted on GitHub Pages. You do not need an index.yaml file in main at all because it is managed in the gh-pages branch.</blockquote><p>Commit and push the workflow YAML file and you should see your new workflow run, but since we don’t have any helm charts in our /charts directory yet there’s nothing for it to do – we’ll add one in just a second.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*U3rZBtYTXxHyv7YO.png" /></figure><h3>Step 4: Containerize a sample web app</h3><p>Before we add a helm chart, we’ll create a very simple web app packaged as a docker image. We’ll also create another new GitHub repo to house our web app since in the real world it is common to keep our application code in a separate repo from our helm charts — the sample I created for this demo is <a href="https://github.com/gerkElznik/macgruber-app">macgruber-app</a>.</p><p>Once you’re able to successfully build a docker image containing your app and verified it runs as expected locally, then we can add a <a href="https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-github-packages">GitHub Actions Workflow</a> to this new repo that will handle pushing new versions of our docker image to GitHub Container Registry each time we cut a new release.</p><p>Example <a href="https://github.com/gerkElznik/macgruber-app/blob/main/.github/workflows/publish-image.yml">.github/workflows/publish-image.yml</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jewzGfess_bArjiHfmUqPw.png" /><figcaption>publish-image.yml</figcaption></figure><blockquote>The above workflow is triggered by a release being published in your repo. It checks out the GitHub repository, and uses the login-action to log in to the Container registry. It then extracts labels and tags for the Docker image. Finally, it uses the build-push-actionaction to build the image and publish it on the Container registry.</blockquote><p>Now we will cut a release for our sample app, I’ll use the GitHub CLI as it leaves a nice paper trail to follow, but feel free to do the same from your web browser.</p><p>If you don’t already have it and you’re on macOS, install GitHub CLI using <a href="https://brew.sh/">Homebrew</a> and peak at their <a href="https://cli.github.com/manual/">getting-started instructions</a>:</p><pre>brew install gh</pre><p>Now execute these GitHub CLI commands from the root directory of your sample app repo (for me this is macgruber-app):</p><pre><strong>#</strong> interactive setup<br>gh auth login<br># create a release<br>gh release create v0.1.0 --notes &quot;Initial release of macgruber-app&quot;</pre><p>As soon as your new release is published you should be able to see your workflow created above automatically triggering a run:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9XRizAaB1S56nb4U.png" /></figure><p>When the workflow completes you should see the image added to your Packages:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ion1nFQsJOU14Tdy.png" /></figure><p>When you click on the new package (see the red arrow above), you’ll be able to see a version tag created (in this case 0.1.0) for the image that corresponds to the release we cut. Unfortunately, I found that the package (image) was published as “Private” meaning an anonymous user would be unable to pull this image, and that’s not what I want for the applications my personal helm charts will package up since I desire to be able to share them freely, and at the time of this writing I was unable to find a way to automate changing it to “Public” – however, the package’s visibility can be manually changed by clicking on “Package settings” as the red arrow below shows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7_JM6frbDvKbanHf.png" /></figure><p>Then in the “Danger Zone” change the visibility to Public:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_vvRHVKq9Vcr-vs6.png" /></figure><blockquote>GitHub Packages using Container Registry (ghcr.io) is still pretty new so I will keep an eye on the API and be on the lookout for a way to automate Public visibility and will update the article when this capability is available.</blockquote><p>Now your image should be public to the world and any anonymous user can pull it like so:</p><pre>docker pull ghcr.io/gerkelznik/macgruber-app:0.1.0</pre><h3>Step 5: Publish a helm chart</h3><p>Be sure you have <a href="https://helm.sh/docs/intro/quickstart/#install-helm">helm installed</a>, I’m using the following version:</p><pre><strong>$</strong> helm version<br>version.BuildInfo{Version:&quot;v3.8.1&quot;, GitCommit:&quot;5cb9af4b1b271d11d7a97a71df3ac337dd94ad37&quot;, GitTreeState:&quot;clean&quot;, GoVersion:&quot;go1.17.8&quot;}</pre><p>Switch back to the helm-charts repo we created earlier and make sure you’re on the main branch (or at least not the gh-pages branch), then create our new helm chart within a directory named charts (remember from earlier, the @helm/chart-releaser-action action looks for new chart versions in this directory, otherwise it will find nothing to do):</p><pre><strong>$</strong> mkdir -p charts &amp;&amp; cd charts<br><strong>$</strong> helm create macgruber<br><strong>$</strong> tree<br>.<br>└── macgruber<br>    ├── Chart.yaml<br>    ├── charts<br>    ├── templates<br>    │   ├── NOTES.txt<br>    │   ├── _helpers.tpl<br>    │   ├── deployment.yaml<br>    │   ├── hpa.yaml<br>    │   ├── ingress.yaml<br>    │   ├── service.yaml<br>    │   ├── serviceaccount.yaml<br>    │   └── tests<br>    │       └── test-connection.yaml<br>    └── values.yaml<br>4 directories, 10 files</pre><p>To keep this example simple, we’ll delete everything in the macgruber directory that was generated for us except:</p><ul><li>Chart.yaml</li><li>values.yaml</li><li>templates/_helpers.tpl</li><li>templates/deployment.yaml</li><li>templates/service.yaml</li><li>templates/serviceaccount.yaml</li></ul><p>Most of the defaults are okay for us to keep, we just need to make the following replacements:</p><p>Charts.yaml - Change the appVersion value to the version of the release we cut for our simple app (should match the tag of the docker image, so don’t include the “v” prefix):</p><pre>appVersion: &quot;0.1.0&quot;</pre><p>values.yaml - Change the image.repository value to the registry/repo we pushed our docker image to earlier:</p><pre>image:<br>  repository: ghcr.io/gerkelznik/macgruber-app</pre><p>Now just push your changes to the main branch and the Release Charts followed by the pages-build-deployment workflows will execute:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DbyBlOOADiPJfd7Z.png" /></figure><p>Once these are complete you should be able to see the new helm chart release:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Zasxyd1K7tBx84EE.png" /></figure><p>And to verify the site is hosting the backbone of your helm chart repo, the index.yaml, just add it to the end of your GitHub Pages URL and visit it in a browser, for example, <a href="https://gerkelznik.github.io/helm-charts/index.yaml">https://gerkelznik.github.io/helm-charts/index.yaml</a></p><h3>Step 6: Verify the end-user experience</h3><p>We’re finally ready to see if our hard work paid off and we can share our bundled-up application as a helm chart.</p><ol><li>The first thing an end-user needs to do is add our repo using the GitHub Pages URL:</li></ol><pre><strong>$</strong> helm repo add gerkelznik https://gerkelznik.github.io/helm-charts &quot;gerkelznik&quot; has been added to your repositories</pre><p>2. Then they can search for charts in the repo:</p><pre><strong>$</strong> helm search repo gerkelznik<br>NAME                 CHART VERSION APP VERSION DESCRIPTION gerkelznik/macgruber 0.1.0         0.1.0       A Helm chart for a...</pre><p>3. They need a Kubernetes cluster to release the chart to, so we’ll create a test environment by starting a local <a href="https://minikube.sigs.k8s.io/docs/start">minikube</a> cluster:</p><pre><strong>$</strong> minikube version<br>minikube version: v1.25.2 commit: 362d5fdc0a3dbee389b3d3f1034e8023e72bd3a7<br><strong>$</strong> minikube config set driver docker<br>❗  These changes will take effect upon a minikube delete and then a minikube start<br><strong>$</strong> minikube start<br>😄  minikube v1.25.2 on Darwin 12.3.1<br>✨  Using the docker driver based on user configuration<br>👍  Starting control plane node minikube in cluster minikube<br>🚜  Pulling base image ...<br>💾  Downloading Kubernetes v1.23.3 preload ... <br><strong>&gt;</strong> preloaded-images-k8s-v17-v1...: 505.68 MiB / 505.68 MiB  100.00% 37.66 Mi <br><strong>&gt;</strong> gcr.io/k8s-minikube/kicbase: 379.06 MiB / 379.06 MiB  100.00% 24.76 MiB p<br>🔥  Creating docker container (CPUs=2, Memory=8100MB) ...<br>🐳  Preparing Kubernetes v1.23.3 on Docker 20.10.12 ... <br>▪ kubelet.housekeeping-interval=5m <br>▪ Generating certificates and keys ... <br>▪ Booting up control plane ... <br>▪ Configuring RBAC rules ...<br>🔎  Verifying Kubernetes components... <br>▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5<br>🌟  Enabled addons: storage-provisioner, default-storageclass<br>🏄  Done! kubectl is now configured to use &quot;minikube&quot; cluster and &quot;default&quot; namespace by default</pre><p>4. And finally they can install the helm chart:</p><pre><strong>$</strong> helm install macgruber gerkelznik/macgruber<br>NAME: macgruber<br>LAST DEPLOYED: Wed Apr  6 21:54:16 2022<br>NAMESPACE: default<br>STATUS: deployed<br>REVISION: 1<br>TEST SUITE: None</pre><p>Voila, we now verified that an end-user can install our new helm chart and we have a pod running a container using the simple app image we built earlier:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Mzgs3Iv6kOEiGecU.png" /></figure><p>Just for fun, we can port forward local port 8080 to the Service our helm chart created (which listens on port 80):</p><pre>kubectl port-forward service/macgruber 8080:80</pre><p>And then see our <em>awesome</em> new app in action from a browser at <a href="http://localhost:8080/">http://localhost:8080</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*iZ8zt9J8XbBejcde.gif" /></figure><h3>In Conclusion</h3><p>The GitHub ecosystem provides a nice free option for hosting helm chart repos, in addition, it also provides automated workflows managed with pipeline-as-code, docker image repos, and of course application code repos.</p><p>In this article, we saw there are several steps necessary to get to the point where you have a shareable public helm chart. I found that GitHub has free features checking all the boxes to get you there. I’m interested to hear your feedback on experiences you’ve had with various other tools that accomplish the same.</p><p>For my next post, I’ll continue where we left off in this article and I’ll show how we can add another GitHub Actions Workflow to our helm-chart repo to <strong>lint</strong> and <strong>test</strong> pull requests for our charts using an action called <a href="https://github.com/helm/chart-testing-action">@helm/chart-testing-action</a>. This will spin up an ephemeral <a href="https://kind.sigs.k8s.io/">kind</a> Kubernetes cluster and use a <a href="https://github.com/helm/chart-testing">Chart Testing tool</a> to automate testing our helm charts. Stay tuned by <a href="https://medium.com/@gerkElznik/about"><em>following me</em></a>.</p><p><em>Originally published at </em><a href="https://gerkelznik.github.io/provision-personal-helm-chart-repo"><em>https://gerkelznik.github.io/provision-personal-helm-chart-repo</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=583b668d9ba4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a Personal Website Using GitHub Pages]]></title>
            <link>https://medium.com/@gerkElznik/creating-a-personal-website-using-github-pages-9dd04b9ab4b7?source=rss-34f85a19d2ed------2</link>
            <guid isPermaLink="false">https://medium.com/p/9dd04b9ab4b7</guid>
            <category><![CDATA[personal-website]]></category>
            <category><![CDATA[jekyll-themes]]></category>
            <category><![CDATA[github-pages]]></category>
            <category><![CDATA[jekyll]]></category>
            <category><![CDATA[ruby]]></category>
            <dc:creator><![CDATA[Gerk Elznik]]></dc:creator>
            <pubDate>Sun, 27 Mar 2022 20:38:32 GMT</pubDate>
            <atom:updated>2022-04-07T05:20:41.713Z</atom:updated>
            <content:encoded><![CDATA[<h4>Personal Projects</h4><h4>Learn why you should consider using GitHub Pages to host your personal website and its content, including instructions to get you started</h4><figure><img alt="GitHub Pages and Jekyll" src="https://cdn-images-1.medium.com/max/845/1*woHdE25q6eeyhPBxNQE0Sw.jpeg" /><figcaption>Generate your GitHub Pages static site with Jekyll</figcaption></figure><p>As an avid reader of technology blog posts on <a href="https://medium.com/">Medium</a>, I’ve learned so much from the writings of others, I’ve made advancements in my career that are undoubtedly thanks to the information and insights I’ve gleaned from the community, and now I find myself inspired to begin a writing journey of my own so that I might contribute to the growth of others in a similar fashion. I find that my favorite blog posts are generally the ones that act as tutorials to build a simple demo, and for these Medium is not enough on its own. Just as I advocate on the job to store one’s work in version control, to have a single source of truth, I desire the same for the blog posts I will be writing. If Medium were to suddenly vanish, I want to have a backup of all my work. Also, given that I intend for many of my posts to link to an accompanying git repo that can easily be cloned by readers wanting to follow along or start where I left off and tinker with things, I realized a git hosting solution was of paramount importance to be able to share my work.</p><p>Enter <a href="https://github.com/">GitHub</a>. Public GitHub repositories and <a href="https://gist.github.com/">GitHub Gists</a> are probably the most well-known and trusted of their kind, and when combined with <a href="https://pages.github.com/">GitHub Pages</a> I can quickly set up a personal blog site linked to the accompanying code that a reader can use to follow along and obtain valuable hands-on experience. For example, all of the source code and configuration used to develop, build, deploy, and host this site can be examined from this one <a href="https://github.com/gerkElznik/gerkElznik.github.io">repo</a>, even the <a href="https://raw.githubusercontent.com/gerkElznik/gerkElznik.github.io/main/_posts/2022-03-06-creating-personal-website.md">source code</a> behind this very post.</p><p>Creating a personalized brand to allow others to identify my linked work is also important to me, and with GitHub Pages being tied to my GitHub account and profile, I’m able to use my recognizable <strong>Gerk Elznik</strong> identity so that others can easily identify my work across platforms.</p><h3>Setting up GitHub Pages</h3><p>GitHub Pages relies on Jekyll, which allows me to author my blog posts in <a href="https://www.markdownguide.org/">markdown</a> and commit my changes with git, giving me peace of mind that I’ll always have an original copy of my work in my possession with all the version history preserved.</p><p>You can follow the <a href="https://pages.github.com/">getting started instructions</a> to set up your site using GitHub Pages. Make sure your repository name is [your-username].github.io, this will end up being the base URL of your website. After working through the steps, you will have a bare-bones website with “Hello World” in an index.html. From here you’ll want to assess how you can use Jekyll to further customize your site.</p><h3>Setting up my Development Environment</h3><p>Rather than writing a whole bunch of HTML, Jekyll allows us to use markdown, which has become somewhat of the de facto standard for writing static documentation and content in git repos that will render nicely when viewed in a browser. In my opinion, it is easy on the eyes and allows for simple maintenance as it is written in plain text and without too much fuss it allows you to add basic formatting with headers, lists, tables, images, links, and more.</p><p>Once you get going, you’ll soon run into the desire to add some custom styling to your site, but if you’re like me and your objective is not to work on your design and CSS skills then you’ll likely just want to add an existing <a href="https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/adding-a-theme-to-your-github-pages-site-using-jekyll">Jekyll theme</a> as opposed to writing much of your own styling. I found the documentation for this to be a little lacking, and this is where I squandered a good deal of time evaluating my options.</p><p>The built-in Theme Chooser under the GitHub Settings for Pages did not quite have what I was looking for, I briefly evaluated the Architect theme but decided it would still leave too much of the site’s styling up to me. I was mainly looking for these four things from a theme:</p><ul><li>A simple and clean way to set up my personal branding including a picture and bio so that visitors will recognize me.</li><li>Attractive and prominent links to my various social media accounts.</li><li>A page for listing my blog posts that would link to another page for the actual post.</li><li>A page listing my projects in a gallery view with pictures and links for each project.</li></ul><p>After browsing a few different sites with free and paid Jekyll themes like this <a href="https://jekyllthemes.io/">one</a>, I decided that <a href="https://mmistakes.github.io/minimal-mistakes">Minimal Mistakes</a> looked the best out of the ones that covered my above criteria. The site has a quick-start guide and documentation that I found worth reading through and following along with in order to get moving.</p><p>I was new to Jekyll as well as Ruby (Jekyll is a Ruby Gem), so the instructions sent me on a journey to learn about these dependencies first — if you’re not looking to spend much time in this area, I would recommend simply selecting one of the GitHub Pages themes using the built-in Theme Chooser — I went into things planning on only using the out-of-the-box functionality of the Minimal Mistakes theme but ended up putting in the extra hours to customize things more than I intended.</p><p>Since I work on a Mac, installing Ruby could be as simple as brew install ruby, but being a fan of twelve-factor app practices, specifically concerning <a href="https://12factor.net/dependencies">dependencies</a>, I felt the need to use a version manager that would allow me to pin the version of Ruby in my project’s directory and manage it independently of my system-wide installation. For this, I chose <a href="https://github.com/rbenv/rbenv">rbenv</a> and installed the latest version of Ruby local to my project’s repo. Then with my local version of Ruby active, I was able to gem install bundler jekyll. <a href="https://bundler.io/">Bundler</a> along with a Gemfile and Gemfile.lock are also important for consistent dependency management and following twelve-factor app practices.</p><p>Finally I could simply run bundle exec jekyll serve --livereload to locally serve my website with hot-reload enabled, providing a fast feeback loop to start tinkering with things.</p><h3>Making your site Personal</h3><p>The most important file concerning your theme is _config.yml, which will be at the root of your directory. If you also went with the Minimal Mistakes theme and followed the quick-start instructions, then you’ll have a bunch of default values set in it which should give you a decent idea of the out-of-the-box personalization you can make. I went down the list, setting my values for things like my bio, images, google analytics, social media links, and more. I recommend taking a look at <a href="https://github.com/gerkElznik/gerkElznik.github.io/blob/main/_config.yml">mine</a> and comparing it to my site to spot which settings control which pieces of content. Other files of interest may be <a href="https://github.com/gerkElznik/gerkElznik.github.io/blob/main/_includes/analytics-providers/google-gtag.html">_includes/analytics-providers/google-gtag.html</a> where I added my global site tag for <a href="https://marketingplatform.google.com/about/analytics">Google Analytics</a> and <a href="https://github.com/gerkElznik/gerkElznik.github.io/blob/main/_includes/head/custom.html">_includes/head/custom.html</a> where I added links for favicons.</p><h3>Alternatives</h3><p>I evaluated some alternatives for hosting my personal website besides GitHub Pages. <a href="https://www.netlify.com/">Netlify</a> was one such alternative, <a href="https://azure.microsoft.com/en-us/services/app-service/static/">Azure Static Web Apps</a> was another, as well as using the static site hosting capabilities of <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/WebsiteHosting.html">AWS S3</a> or <a href="https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-static-website">Azure Storage</a>. While I have some experience with the latter two as well as experience with front-end JavaScript frameworks for SPAs like <a href="https://create-react-app.dev/">Create React App</a> and <a href="https://cli.vuejs.org/#getting-started">Vue CLI</a>, I felt all of these options would be overkill as I don’t plan on doing things like calling APIs and needing a reactive front-end. Jekyll wasn’t a technology I was clamoring to learn, it is less likely to be beneficial to my career than honing my skills with these alternatives, but ultimately, I was looking for a solution that would require the least effort to add new site content or change existing site content; for that, I felt GitHub Pages and Jekyll were the winners.</p><h3>In Conclusion</h3><p>Using GitHub Pages to build a personal website and distinguish yourself with a recognizable identity and external brand in your communities of interest is a worthwhile endeavor if you’re willing to spend some extra time setting things up. You’ll end up with a public git repo that you can share with others and that will be the single source of truth for your work that you can always keep in your possession. Jekyll requires a bit of initial ramp-up time, but I like the simplicity of writing my blog posts in markdown. GitHub Actions will handle building and deploying changes committed to your repo, but it is also well worth setting up your local development environment to enable a fast feedback loop as you tinker with your site. After your content is published to your personal blog site, you can export it to an aggregator such as Medium where it’s more likely to be discovered by others who can comment, clap, and support you.</p><p><em>Originally published at </em><a href="https://gerkelznik.github.io/creating-personal-website"><em>https://gerkelznik.github.io/creating-personal-website</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9dd04b9ab4b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>