<?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 Roman Avdashkevich on Medium]]></title>
        <description><![CDATA[Stories by Roman Avdashkevich on Medium]]></description>
        <link>https://medium.com/@k-pax?source=rss-44c4e929f20------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*A0sUMdyLUUaeUwTf6rWAYw.jpeg</url>
            <title>Stories by Roman Avdashkevich on Medium</title>
            <link>https://medium.com/@k-pax?source=rss-44c4e929f20------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 03:27:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@k-pax/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[Orphaned Git Branches]]></title>
            <link>https://k-pax.medium.com/orphaned-git-branches-2a89be1dd896?source=rss-44c4e929f20------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a89be1dd896</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[commit]]></category>
            <category><![CDATA[git-log]]></category>
            <dc:creator><![CDATA[Roman Avdashkevich]]></dc:creator>
            <pubDate>Sun, 14 Aug 2022 03:10:37 GMT</pubDate>
            <atom:updated>2022-08-14T03:11:55.008Z</atom:updated>
            <content:encoded><![CDATA[<h4>Restart git commit history</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aDH41JL0GAiU3CJeKbSkYQ.jpeg" /></figure><p>This post demonstrates how to reset your commit history using orphan branches.</p><pre><strong>git checkout</strong> --orphan &lt;new-branch&gt; </pre><p>Using --orphan flag on git checkoutor switch commands creates a copy of the parent branch with all its content without the preceding commit history.</p><h4>Use cases</h4><ul><li>When you change your private repository visibility, making it public, you may need to reset git logs to remove sensitive information that was committed earlier.</li><li>You may need to reduce the size of your repository by truncating its commit history.</li></ul><h4>Reset commit logs in a remote repository</h4><p>The following workflow removes commit history from a remote git repository</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/044ac728698cb300cf8c926d2502ead4/href">https://medium.com/media/044ac728698cb300cf8c926d2502ead4/href</a></iframe><p>After switching to an orphan branch (❷):</p><ul><li>The git log command returns the message fatal: your current branch &lt;branch-name&gt; does not have any commit yet.</li><li>The git status command is going to list every file from the previous branch as a newly added file ready to be committed (that is, already staged)</li></ul><p>If you don’t want to include all files from the previous branch, run git reset . to unstage everything and add only the files you need.</p><p>If you don’t need any files from the parent branch, run git rm -rf . right after creating an orphan branch (❷), which will remove all staged files. Another way to do it would be by running git switch --orphan=&lt;new-branch&gt; (instead of git checkout...). This will create a new branch without files from the parent branch.</p><p>By default, git doesn’t like commits without any changes, and to bypass that add the --allow-empty flag when making your initial commit as follows:</p><pre><strong>git commit</strong> --allow-empty -m &quot;Initial commit&quot;</pre><h4>&lt;start-point&gt; argument</h4><p>In order to reset the initial state of a repository to a certain commit, add a &lt;start-point&gt; argument to the git checkout command:</p><pre><strong>git checkout</strong> --orphan &lt;new-branch&gt; [&lt;start-point&gt;]</pre><p>The head of the new branch will point to this commit. It may be given as a commit-id, a tag, or even another branch name. If this option is omitted, the current HEAD will be used instead.</p><p>That’s it for today!</p><h4>Conclusion</h4><p>The example above demonstrated how to manage the commit history of a git repository with the standard git commands.</p><p>You may run into situations where you don’t want to wipe out the entire git history and only need to remove a sensitive file from your repository’s history without removing the commit itself. If that’s your case check out the <a href="https://github.com/newren/git-filter-repo"><em>git-filter repo</em></a> or the <a href="https://rtyley.github.io/bfg-repo-cleaner/"><em>BFG Repo-Cleaner</em></a> tools that will help you to remove a file from every commit that it was involved with.</p><h4>Resources:</h4><ul><li><a href="https://git-scm.com/docs/git-checkout">git-checkout</a> documentation</li><li><a href="https://git-scm.com/docs/git-branch">git-branch</a> documentation</li><li><a href="https://git-scm.com/docs/git-commit">git-commit</a> documentation</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a89be1dd896" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker Multi-Stage builds]]></title>
            <link>https://k-pax.medium.com/multi-stage-dockerfiles-build-e853686e10bf?source=rss-44c4e929f20------2</link>
            <guid isPermaLink="false">https://medium.com/p/e853686e10bf</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[multi-stage-builds]]></category>
            <category><![CDATA[dockerfiles]]></category>
            <dc:creator><![CDATA[Roman Avdashkevich]]></dc:creator>
            <pubDate>Wed, 23 Mar 2022 16:09:59 GMT</pubDate>
            <atom:updated>2022-08-06T05:37:13.969Z</atom:updated>
            <content:encoded><![CDATA[<h4>Optimizing your Docker images with multi-stage builds</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TwJWLWgqZaod1MlMVx_YDQ.jpeg" /></figure><p>Docker images are often larger than they need to be and it’s a good idea to always aim for smaller images by avoiding the installation of unnecessary packages. There are a lot of ways to make them smaller. This post is about using a multi-stage build for that purpose.</p><p>According to the <a href="https://www.redhat.com/en/resources/cloud-native-container-design-whitepaper">single concern principle</a> containers should be designed to run a single isolated process that addresses a single concern. Containers should consume only the resources required for running packaged applications.</p><p>It’s good practice to always use the <a href="https://docs.docker.com/develop/develop-images/multistage-build/">multi-stage</a> builds to create more compact Docker images when you need to build artifacts and then run your application. Let’s take a look at how much disk space we can save by utilizing multi-stage builds and comparing it with building images in one stage.</p><p>As an example, we’ll use a simple web app written in Go.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fb269c26e3f1118d7829244a034050d0/href">https://medium.com/media/fb269c26e3f1118d7829244a034050d0/href</a></iframe><p>Let’s build a Docker image in one stage and see its size:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5893c185cea768cd851ba536be2639f2/href">https://medium.com/media/5893c185cea768cd851ba536be2639f2/href</a></iframe><pre>docker build -t webapp .<br>docker images | grep webapp<br>webapp           latest           64a1652ca001            321MB</pre><p>In this case, we use a single-stage build, and therefore the size of the final Docker image is 321 MB which is way too big considering how little this application is doing.</p><p>We can substantially reduce the size of a Docker image using a multi-stage build approach. Let’s rewrite our Dockerfile and rebuild the same application :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f7834a792495d130659a3bb085d5b292/href">https://medium.com/media/f7834a792495d130659a3bb085d5b292/href</a></iframe><pre>docker build -t webapp-multi-stage .<br>docker images | grep webapp-multi-stage<br>webapp-multi-stage         latest        1edee18acf3        11.7MB</pre><p>The final image is only 11.7 MB in size. How did we manage to scale down the image so drastically? In the “builder” stage we compiled and built the application, and then copied the compiled result to the final stage using the--fromflag that copies content from other images.</p><p>The multi-stage build approach works well for applications that require a lot of dependencies to build artifacts but don’t require those dependencies to run compiled artifacts. Building an artifact in one stage, and running the binary in the second stage results in more minimal final images.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e853686e10bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying Argo CD and Sealed Secrets with Helm]]></title>
            <link>https://faun.pub/deploying-argo-cd-and-sealed-secrets-with-helm-8de12f53051b?source=rss-44c4e929f20------2</link>
            <guid isPermaLink="false">https://medium.com/p/8de12f53051b</guid>
            <category><![CDATA[helm]]></category>
            <category><![CDATA[argo-cd]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[sealed-secret]]></category>
            <dc:creator><![CDATA[Roman Avdashkevich]]></dc:creator>
            <pubDate>Fri, 07 Jan 2022 20:41:00 GMT</pubDate>
            <atom:updated>2022-01-21T16:59:30.622Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RCpTXpbgqhBcC00ZCeWYjg.jpeg" /></figure><h4>Let’s get stuff deployed!</h4><p>In this tutorial, we will go over the Declarative setup of <a href="https://argoproj.github.io/argo-cd/">Argo CD</a> and <a href="https://github.com/bitnami-labs/sealed-secrets">Sealed Secrets</a> on a Kubernetes cluster.</p><p>For deploying Argo CD and Sealed Secrets we will be using Helm Charts. Helm packages all YAML manifests into an organized directory structure and lets you deploy applications with a few CLI commands. When using Helm Charts we can override default parameters in the <em>values.yaml</em> file changing default installation to our needs.</p><p>Let’s get started, shall we?</p><p>The documentation for Argo CD suggests creating an argocd namespace for deploying Argo CD services and applications. Bitnami Sealed Secrets by default will install the SealedSecret controller into thekube-system namespace. For the purpose of this tutorial let’s create a namespace called shared-services to isolate our services.<br>Let’s run the following command in the terminal:</p><pre>kubectl create namespace shared-services</pre><p>Chances are that you found this tutorial because you want to deploy an application from a private repository. In order to do that you need to provide a public and a private key for the target repository. For the purpose of this demo I will omit listing my private key but will provide you with a template that you may use for deploying your app.</p><p><strong>Let’s start with Argo CD</strong></p><p>The community-maintained Helm chart for Argo CD is available at <a href="https://github.com/argoproj/argo-helm/tree/master/charts/argo-cd">argo-helm/charts/argo-cd</a>. I recommend using the <a href="https://argo-cd.readthedocs.io/en/stable/operator-manual/declarative-setup/">official documentation</a> as a reference.</p><p>Before running <em>helm install</em> we’re going to customize our installation and define the application resources in the <em>values.yaml</em> file.<br>Here’s what we’re going to do:</p><ul><li>Set the password for the built-in admin user that has full access to the system. Argo expects the password to be bcrypt hashed. You can create this hash with htpasswd -nbBC 10 “” $password | tr -d ‘:\n’ | sed ‘s/$2y/$2a/&#39;. Change $password to whatever you want.</li><li>By default, argocd server runs with self-signed TLS enabled. To access Argo UI we need to add -insecure flag in server.extraArgs field.</li><li>Disable the dex instance that is used for delegating authentication to external identity providers.</li></ul><p>Let’s grab the public key of the connected git repository (check your ~/.ssh/known_hosts file).</p><p>Applications in Argo CD are defined by two key blocks of information:</p><ul><li>source sets the URL for the source repository and Git path for the manifests with the desired state. You can add the <em>target revision</em> field to explicitly specify the branch. Argo CD will monitor for any changes and will apply them automatically.</li><li>destination defines the target cluster and namespace. By default, it will deploy to the context currently selected in the <em>kubeconfig</em>.</li></ul><p><em>It has been established as the best practice to have separate repositories for application source code and application configuration code (Kubernetes manifest files).</em></p><p>A deployed application will have <em>OutOfSync</em> status if its actual state in the cluster is different from the manifest file in the repository that serves as the source of truth.</p><p>Here’s a customized <em>values</em> file for Argo CD</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/64340af0c85bc5cdfa98b618e82337ab/href">https://medium.com/media/64340af0c85bc5cdfa98b618e82337ab/href</a></iframe><p>To spin up an instance of Argo CD add the chart repo and run <em>helm install</em> with the modified <em>values.yaml</em> file. Use the <em>--atomic</em> flag to delete created resources if some of the components fail during installation.</p><pre>helm repo add argo <a href="https://argoproj.github.io/argo-helm">https://argoproj.github.io/argo-helm</a><br>helm install argocd argo/argo-cd -f argocd/values.yaml -n shared-services --atomic</pre><p>There’s one more thing we need to do. Without providing a private ssh key for a git repository, Argo CD won’t be able to retrieve deployment manifests for your application. Repository details are stored in secrets. To avoid security risks we will use the Sealed Secrets tool to safely store the ssh key in the version control.</p><p><strong>Secret</strong></p><p>A Secret is a Kubernetes object that contains sensitive information such as access tokens, basic-auth credentials, TLS certificates, and so on. Just like ConfigMaps they contain key-value pairs and are used to manage the application deployment.</p><p>Here’s an example of the secret with repository credentials (ssh key is omitted):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4e6c17a59e938190cc5ee75ad4d01014/href">https://medium.com/media/4e6c17a59e938190cc5ee75ad4d01014/href</a></iframe><p>Make sure to tab 4 spaces when copying your key. You can also add it in one line by encoding your key in Base64. It would look like this: sshPrivateKey: c3NoUHgm9F4pO5KHk2gJpdmF0ZUtleQo=</p><p>Let’s see how we can seal the secret.</p><h3>Sealed Secrets</h3><p>Sealed Secrets installation is comprised of two parts:<br>- A controller that runs in-cluster<br>- A <em>kubeseal</em> CLI</p><p>When you deploy the Sealed Secret Controller in a cluster it generates a public and a private key. The public key is used by <em>kubeseal</em> CLI for encryption and the private key is used for decrypting the SealedSecrets CRDs into Kubernetes Secrets.</p><p>Sealed-secret certificates are automatically renewed every 30 days and you should always rotate your secrets.</p><p>Let’s install the Sealed Secrets controller first. For the installation, we will change the target namespace to “shared-services”. Our <em>values.yaml</em> file will have only one line with the target namespace:</p><pre>namespace: &quot;shared-services&quot;</pre><p>Add the repository and run <em>helm install</em></p><pre>helm repo add sealed-secrets <a href="https://bitnami-labs.github.io/sealed-secrets">https://bitnami-labs.github.io/sealed-secrets</a><br>helm install sealed-secrets sealed-secrets/sealed-secrets -f kubeseal/values.yaml -n shared-services --atomic</pre><p>Let’s check the status of the installation by running <em>helm list -A </em>which lists all installations across all namespaces<em>. </em>We can see that both Argo CD and Sealed-Secrets releases are installed in the “shared-services” namespace.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*agtWErGdk5m2mw5J.png" /></figure><p>To install <em>kubeseal </em>CLI<em> </em>you can use Homebrew for macOS, or install the binary from the GitHub page for Linux:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0ecdbdbebb96d7b57e0473e40be9dedc/href">https://medium.com/media/0ecdbdbebb96d7b57e0473e40be9dedc/href</a></iframe><p>Now use <em>kubeseal</em> to retrieve the certificate from the controller. Because we installed the controller to a different namespace than the default kube-system, we need to provide this namespace to the <em>kubeseal</em> CLI:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/400bcfcd82fbf5ea3b75c76666d54613/href">https://medium.com/media/400bcfcd82fbf5ea3b75c76666d54613/href</a></iframe><p>The public key can be safely stored in version control and can be used to encrypt secrets without direct access to the Kubernetes cluster.</p><p><em>kubeseal</em> will use the fetched certificate to encrypt Kubernetes secrets. That’s how you’d encrypt a secret with <em>kubeseal</em> utility:</p><pre>kubeseal --format=yaml --cert=mycert.pem &lt; github-secret.yaml &gt; sealed-github-secret.yaml</pre><p>The command above creates a SealedSecret CRD that looks like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b75611f30135f812bc52815db29508c4/href">https://medium.com/media/b75611f30135f812bc52815db29508c4/href</a></iframe><p>It’s important to be aware that the SealedSecret and Kubernetes Secret must share the same namespace, otherwise the controller won’t decrypt the SealedSecret.</p><p>Now apply the Sealed Secret to the cluster:</p><pre>kubectl apply -f sealed-github-secret.yaml</pre><p>Once a SealedSecret CRD is deployed to the cluster, the controller will pick it up, decrypt it using the private key, and deploy a normal Kubernetes Secret into the same namespace. After this action, the YAML file with the unsealed secret may be deleted as we no longer need it.</p><p>Let’s check if our secret was successfully decrypted and deployed by the controller.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*EGLJNhHa8tKoEKGW.png" /></figure><p>Now let’s check if Argo CD was able to successfully connect to the private repository and deploy our application. By default, the Argo CD API server is not exposed to an external IP. To access the API server, we will expose the Argo CD to <em>localhost:8080</em> (I’m using k9s but you can do it with kubectl by runningkubectl port-forward svc/argocd-server -n shared-services 8080:443)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*j0IW9_OLOerdr9kh.png" /></figure><p>To log in we can use admin user and the password “argo-demo” (as we defined it in the <em>values.yaml</em> file).</p><p>When we navigate to connected repositories we can see that the specified repository has successful connection status. It means that the Sealed Secret controller successfully decrypted and deployed the Secret with the repository information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*BKYJcIfRuOaYceke.png" /></figure><p>ArgoCD is deployed and syncing the application in a cluster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*x_4BwVz_GeYXD0LX.png" /></figure><p>All resources and actions described above are available at <a href="https://github.com/roman-hds/argo-demo">https://github.com/roman-hds/argo-demo</a></p><figure><a href="https://faun.to/bP1m5"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BCiLLad3dvZLwBa-B5cAVQ.png" /></a></figure><p>Join FAUN: <a href="https://faun.to/i9Pt9"><strong>Website</strong></a><strong> </strong>💻<strong>|</strong><a href="https://faun.dev/podcast"><strong>Podcast</strong></a><strong> </strong>🎙️<strong>|</strong><a href="https://twitter.com/joinfaun"><strong>Twitter</strong></a><strong> </strong>🐦<strong>|</strong><a href="https://www.facebook.com/faun.dev/"><strong>Facebook</strong></a><strong> </strong>👥<strong>|</strong><a href="https://instagram.com/fauncommunity/"><strong>Instagram</strong></a><strong> </strong>📷|<a href="https://www.facebook.com/groups/364904580892967/"><strong>Facebook Group</strong></a><strong> </strong>🗣️<strong>|</strong><a href="https://www.linkedin.com/company/faundev"><strong>Linkedin Group</strong></a><strong> </strong>💬<strong>|</strong> <a href="https://faun.dev/chat"><strong>Slack</strong></a> 📱<strong>|</strong><a href="https://thechief.io/"><strong>Cloud Native</strong> <strong>News</strong></a><strong> </strong>📰<strong>|</strong><a href="https://linktr.ee/faun.dev/"><strong>More</strong></a><strong>.</strong></p><p><strong>If this post was helpful, please click the clap 👏 button below a few times to show your support for the author 👇</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8de12f53051b" width="1" height="1" alt=""><hr><p><a href="https://faun.pub/deploying-argo-cd-and-sealed-secrets-with-helm-8de12f53051b">Deploying Argo CD and Sealed Secrets with Helm</a> was originally published in <a href="https://faun.pub/">FAUN.dev() 🐾</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>