<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Posts on Alekc's Blog</title><link>https://blog.alekc.org/posts/</link><description>Recent content in Posts on Alekc's Blog</description><generator>Hugo -- gohugo.io</generator><copyright>©{year}, All Rights Reserved</copyright><atom:link href="https://blog.alekc.org/posts/index.xml" rel="self" type="application/rss+xml"/><item><title>xcrun: error: invalid active developer path</title><link>https://blog.alekc.org/posts/xcrun-error-invalid-active-developer-path/</link><pubDate>Sat, 10 Dec 2022 07:00:00 +0000</pubDate><guid>https://blog.alekc.org/posts/xcrun-error-invalid-active-developer-path/</guid><description>Recently (after updating my OSX to the Ventura 13.0.1), when I tried to clone a git repository I was presented with a bit of a cryptic message:
1xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun Turns out you need to reinstall your xcode tools, so just run
1xcode-select --install In case that doesn&amp;rsquo;t work, try
1sudo xcode-select --reset 2sudo xcodebuild -license accept</description></item><item><title>Useful debugging tools for kubernetes</title><link>https://blog.alekc.org/posts/useful-debugging-tools-for-kubernetes/</link><pubDate>Sat, 03 Dec 2022 00:00:00 +0000</pubDate><guid>https://blog.alekc.org/posts/useful-debugging-tools-for-kubernetes/</guid><description>Sometimes its useful to be able to run some ephemeral containers on kubernetes cluster in order to perform some debugging (i.e. dns resolution, pinging nodes, etc).
Sadly, most of the times, it can be tricky to remember all overrides so here is a small list
Run an ephemeral shell on a random node 1kubectl run -ti --restart=Never --rm debug --image=alekcander/network-diag -- sh Run a container with specific service account 1kubectl run -ti --restart=Never --rm debug --image=alekcander/network-diag --overrides=&amp;#39;{ &amp;#34;spec&amp;#34;: { &amp;#34;serviceAccount&amp;#34;: &amp;#34;terraform-runner&amp;#34; } }&amp;#39; -- sh Run on a specific node 1kubectl run -ti --restart=Never --rm debug --image=alekcander/network-diag --overrides=&amp;#39;{&amp;#34;spec&amp;#34;: { &amp;#34;nodeName&amp;#34;: &amp;#34;alekc-worker-01&amp;#34;}}&amp;#39; -- sh Run based on specific selector (ie.</description></item><item><title>Template for persistent volumes on helm charts</title><link>https://blog.alekc.org/posts/template-for-persistent-volumes-on-helm-charts/</link><pubDate>Wed, 05 Oct 2022 23:00:00 +0000</pubDate><guid>https://blog.alekc.org/posts/template-for-persistent-volumes-on-helm-charts/</guid><description>Over and over happens to reinvent the wheel and write some specific configuration related to volume management while creating helm charts. This is due to the fact that helm chart template doesn&amp;rsquo;t create any settings relative to the persistent volumes.
To avoid doing that in the future, I am adding here a small recipe
Values.yaml 1persistence:2storageClass:&amp;#34;&amp;#34;3existingClaim:&amp;#34;&amp;#34;4enabled:true5accessMode:ReadWriteOnce6size:800Mi7# if you need any additional volumes, you can define them here8additionalVolumes:[]9# if you need any additional volume mounts, you can define them here10additionalMounts:[]Deployment.</description></item><item><title>Setup of a development machine</title><link>https://blog.alekc.org/posts/setup-of-a-development-machine/</link><pubDate>Thu, 15 Sep 2022 23:00:00 +0000</pubDate><guid>https://blog.alekc.org/posts/setup-of-a-development-machine/</guid><description>&lt;p>This is a small wrap ap about setting up a dev environment which I am using at the moment.&lt;/p>
&lt;p>It works for me, your mileage may vary.&lt;/p>
&lt;p>The guide covers both Linux (WSL) and Osx,&lt;/p></description></item><item><title>Fixing etcdDatabaseHighFragmentationRatio prometheus alert</title><link>https://blog.alekc.org/posts/fixing-etcddatabasehighfragmentationratio-prometheus-alert/</link><pubDate>Sat, 03 Sep 2022 23:00:00 +0000</pubDate><guid>https://blog.alekc.org/posts/fixing-etcddatabasehighfragmentationratio-prometheus-alert/</guid><description>If you receive a following error in alertmanager
1etcd cluster &amp;#34;kube-etcd&amp;#34;: database size in use on instance xxx.xxx.xxx.xxx:2381 2is 49.55% of the actual allocated disk space, please run defragmentation 3(e.g. etcdctl defrag) to retrieve the unused fragmented disk space. it can be easily solved by running a following command:
1kubectl exec $(kubectl get pods --selector=component=etcd -A -o name \ 2| head -n 1) -n kube-system -- etcdctl defrag --cluster \ 3--cacert /etc/kubernetes/pki/etcd/ca.</description></item><item><title>Kubernetes networking</title><link>https://blog.alekc.org/posts/kubernetes-networking/</link><pubDate>Wed, 17 Aug 2022 08:00:00 +0000</pubDate><guid>https://blog.alekc.org/posts/kubernetes-networking/</guid><description>Kubernetes networking Pause container In Kubernetes, the pause container serves as the &amp;ldquo;parent container&amp;rdquo; for all of the containers in your pod, and it has two main responsibilities:
it serves as the basis of Linux namespace sharing in the pod with PID (process ID) namespace sharing enabled, it serves as PID 1 for each pod and reaps zombie processes. In Linux, each running process communicates within a network namespace that provides a logical networking stack with its own routes, firewall rules, and network devices.</description></item><item><title>7 Rs Strategy for moving apps</title><link>https://blog.alekc.org/posts/5-rs-strategy-for-moving-apps/</link><pubDate>Mon, 15 Aug 2022 23:00:00 +0000</pubDate><guid>https://blog.alekc.org/posts/5-rs-strategy-for-moving-apps/</guid><description>As more and more businesses upgrade their legacy infrastructure and prepare for their move to the cloud. It&amp;rsquo;s helpful to have a systematic approach and estimate what must be done to achieve the objective.
Recently I&amp;rsquo;ve read an interesting article on AWS and their 7R approach
While it&amp;rsquo;s centered around the database, you can reuse the same approach for a more generic infrastructure.
Some additional reading on the subject
https://docs.</description></item><item><title>Longhorn disaster recovery jobs</title><link>https://blog.alekc.org/posts/longhorn-disaster-recovery-jobs/</link><pubDate>Mon, 15 Aug 2022 02:00:00 +0000</pubDate><guid>https://blog.alekc.org/posts/longhorn-disaster-recovery-jobs/</guid><description>&lt;p>Longhorn is a brilliant piece of software (especially for those who cannot use block volumes on their Kubernetes cluster), but it can (and does) happen to have some volumes getting degraded and thus requiring to recover from a backup.&lt;/p></description></item><item><title>How to create cross cloud self managed kubernetes cluster</title><link>https://blog.alekc.org/posts/how-to-create-cross-cloud-self-managed-kubernetes-cluster/</link><pubDate>Sun, 14 Aug 2022 23:00:00 +0000</pubDate><guid>https://blog.alekc.org/posts/how-to-create-cross-cloud-self-managed-kubernetes-cluster/</guid><description>&lt;hr>
&lt;p>While it&amp;rsquo;s fairly &amp;ldquo;trivial&amp;rdquo; to install a stacked kubernetes cluster with kubeadm on any cloud provider or managed bare metal (where you have a certain degree of management over the networking which permits you to use bgp for example), it&amp;rsquo;s not so trivial when your nodes are situated in different network segments (clouds) and/or behind NAT.&lt;/p>
&lt;p>With this guide I will try to alleviate a pain related to this kind of setup.&lt;/p></description></item><item><title>Prometheus - kube-proxy endpoint connection refused</title><link>https://blog.alekc.org/posts/prometheus-kube-proxy-endpoint-connection-refused/</link><pubDate>Mon, 30 May 2022 23:00:00 +0000</pubDate><guid>https://blog.alekc.org/posts/prometheus-kube-proxy-endpoint-connection-refused/</guid><description>When using kube-prometheus-stack and kubernetes cluster provisioned by kubeadm you will likely have an issue of prometheus not being able to connect to the kube-proxy metrics
It can be easily fixed by editing it&amp;rsquo;s config map
kubectl edit cm/kube-proxy -n kube-system Change the metricsBindAddress property from 127.0.0.1:10249 (or empty value) to
metricsBindAddress: 0.0.0.0:10249 Delete and redeploy kube-proxy pods
kubectl delete pod -l k8s-app=kube-proxy -n kube-system</description></item><item><title>Go test run configuration template in Goland</title><link>https://blog.alekc.org/posts/go-test-run-configuration-template-in-goland/</link><pubDate>Mon, 31 Jan 2022 00:00:00 +0000</pubDate><guid>https://blog.alekc.org/posts/go-test-run-configuration-template-in-goland/</guid><description>Spotted this on terraform-provider-kubectl Turns out you can create a template for go configuration which will add some Env vars and other settings. Very useful if you have multiple test which you want to debug /run which have some env var prerequisites.
1&amp;lt;component name=&amp;#34;ProjectRunConfigurationManager&amp;#34;&amp;gt; 2 &amp;lt;configuration default=&amp;#34;true&amp;#34; type=&amp;#34;GoTestRunConfiguration&amp;#34; factoryName=&amp;#34;Go Test&amp;#34;&amp;gt; 3 &amp;lt;module name=&amp;#34;terraform-provider-kubectl&amp;#34; /&amp;gt; 4 &amp;lt;working_directory value=&amp;#34;$PROJECT_DIR$&amp;#34; /&amp;gt; 5 &amp;lt;envs&amp;gt; 6 &amp;lt;env name=&amp;#34;TF_ACC&amp;#34; value=&amp;#34;1&amp;#34; /&amp;gt; 7 &amp;lt;env name=&amp;#34;KUBECONFIG&amp;#34; value=&amp;#34;$PROJECT_DIR$/scripts/kubeconfig.yaml&amp;#34; /&amp;gt; 8 &amp;lt;/envs&amp;gt; 9 &amp;lt;kind value=&amp;#34;DIRECTORY&amp;#34; /&amp;gt; 10 &amp;lt;package value=&amp;#34;github.</description></item><item><title>How to expose service behind nat with wireguard and vps</title><link>https://blog.alekc.org/posts/how-to-expose-service-behind-nat-with-wireguard-and-vps/</link><pubDate>Sat, 29 Jan 2022 00:00:00 +0000</pubDate><guid>https://blog.alekc.org/posts/how-to-expose-service-behind-nat-with-wireguard-and-vps/</guid><description>Scenario: you have one (or more) services running at your home which you would like to expose on the internet. Sadly, you are also behind a dynamic dns and your ip can change in any moment.
Sure, you can use one of public dynamic dns providers such as no-ip or zoneedit, but what if you don&amp;rsquo;t want to depend on dns caching from your client and would like to reduce any downtime as much as possible?</description></item><item><title>How to use xargs when the argument should be in the middle of the command</title><link>https://blog.alekc.org/posts/how-to-use-xargs-when-the-argument-should-be-in-the-middle-of-the-command/</link><pubDate>Fri, 28 Jan 2022 00:00:00 +0000</pubDate><guid>https://blog.alekc.org/posts/how-to-use-xargs-when-the-argument-should-be-in-the-middle-of-the-command/</guid><description>A lot of times (especially when working with kubernetes) happens that you need to extract certain arguments with one command and use them in the middle of another. A quick way to deal with it is through usage of xargs with -I arg.
For example:
kubectl get ns -o name | xargs -I &amp;quot;{}&amp;quot; kubectl label {} goldilocks.fairwinds.com/enabled=true</description></item><item><title>How to mass remove finalizers from argocd applications</title><link>https://blog.alekc.org/posts/how-to-mass-remove-finalizers-from-argocd-applications/</link><pubDate>Mon, 24 Jan 2022 11:00:00 +0000</pubDate><guid>https://blog.alekc.org/posts/how-to-mass-remove-finalizers-from-argocd-applications/</guid><description>If you are using finalizers in your argo-cd applications, you may find that it&amp;rsquo;s impossible to delete them if argo-cd installation is broken.
In order to fix it, you can either update them one by one with kubectl edit and remove the finalizer tag, or you can run following command which will patch all argocd entities in argocd namespace
kubectl get Application -A -o name | xargs kubectl patch -p '{&amp;quot;metadata&amp;quot;:{&amp;quot;finalizers&amp;quot;:null}}' --type=merge -n argocd</description></item><item><title>How to remove prompt from aws commands</title><link>https://blog.alekc.org/posts/how-to-remove-prompt-from-aws-commands/</link><pubDate>Mon, 24 Jan 2022 00:00:00 +0000</pubDate><guid>https://blog.alekc.org/posts/how-to-remove-prompt-from-aws-commands/</guid><description>&lt;p>One of the biggest annoyances while using aws cli for me was the fact that the command&amp;rsquo;s output was not printed to standard stdout but it was opened in &lt;code>less&lt;/code> like session, which was very annoying if you needed to copy several entries from the output result.&lt;/p></description></item><item><title>Install and configure local gitlab runner on OSX</title><link>https://blog.alekc.org/posts/install-and-configure-local-gitlab-runner-on-osx/</link><pubDate>Fri, 21 Jan 2022 00:00:00 +0000</pubDate><guid>https://blog.alekc.org/posts/install-and-configure-local-gitlab-runner-on-osx/</guid><description>&lt;p>The process of installing gitlab runner on the osx is pretty straightforward and well documented on &lt;a href="https://docs.gitlab.com/runner/install/osx.html" target="_blank" rel="nofollow noopener">official Gitlab documentation&lt;/a>
, however what I find lacking, is the configuration part where you define your actual runners.&lt;/p>
&lt;p>So this is a small write up about the whole process which hopefully save me and you some time in the future&lt;/p></description></item><item><title>How to create terraform iam roles for irsa functionality</title><link>https://blog.alekc.org/posts/how-to-create-terraform-iam-roles-for-irsa-functionality/</link><pubDate>Tue, 18 Jan 2022 16:00:00 +0000</pubDate><guid>https://blog.alekc.org/posts/how-to-create-terraform-iam-roles-for-irsa-functionality/</guid><description>&lt;p>IRSA (IAM role for service account) is a very useful tool which permits us to provide AWS permissions to the containers in any pod that uses that service account. This enables us to give a very granular permission setting for specific service accounts and remove most of the headache related to authentication and persisting of secrets.&lt;/p>
&lt;p>Below a quick snippet of how to create such mechanism.&lt;/p></description></item><item><title>Use terraform http data source to wait for cluster coming up</title><link>https://blog.alekc.org/posts/use-terraform-http-data-source-for-cluster-health-check/</link><pubDate>Tue, 18 Jan 2022 00:00:00 +0000</pubDate><guid>https://blog.alekc.org/posts/use-terraform-http-data-source-for-cluster-health-check/</guid><description>&lt;p>Neat example of how we can use terraform http data source to wait for our kubernetes cluster to come up with a healthy state (shamelessly taken from some github repo)&lt;/p></description></item><item><title>An error occurred (AccessDenied) when calling the AssumeRoleWithWebIdentity operation</title><link>https://blog.alekc.org/posts/2021/how-to-fix-access-denied-assumerolewithwebidentity/</link><pubDate>Wed, 29 Sep 2021 05:40:59 +0000</pubDate><guid>https://blog.alekc.org/posts/2021/how-to-fix-access-denied-assumerolewithwebidentity/</guid><description>&lt;p>When working with EKS under AWS, it&amp;rsquo;s possible that at some point you wanted to run a pod under a certain role, and you&amp;rsquo;ve encountered a following error:&lt;/p>
&lt;blockquote>
&lt;p>An error occurred (AccessDenied) when calling the AssumeRoleWithWebIdentity operation: Not authorized to perform sts:AssumeRoleWithWebIdentity&lt;/p>
&lt;/blockquote>
&lt;p>What&amp;rsquo;s frustrating, is that by default AWS doesn&amp;rsquo;t provide you a lot of feedback of why that error happened.&lt;/p>
&lt;p>So I&amp;rsquo;ve written down some debug steps for further reference:&lt;/p></description></item><item><title>Limit docker log file size</title><link>https://blog.alekc.org/posts/2021/how-to-limit-docker-file-size/</link><pubDate>Mon, 15 Feb 2021 05:40:59 +0000</pubDate><guid>https://blog.alekc.org/posts/2021/how-to-limit-docker-file-size/</guid><description>&lt;p>If you are running docker with default settings, you will probably find one day that the disk space on your machine begin to approach 100% state.&lt;/p>
&lt;p>That&amp;rsquo;s because by default, docker will log all stdout from the containers to a log files, and it won&amp;rsquo;t rotate nor trim them.&lt;/p>
&lt;p>Luckily there is a quick solution to that&lt;/p></description></item><item><title>Recovery of etcd failing node</title><link>https://blog.alekc.org/posts/2021/recovery-of-etcd-failing-node/</link><pubDate>Thu, 14 Jan 2021 16:40:59 +0000</pubDate><guid>https://blog.alekc.org/posts/2021/recovery-of-etcd-failing-node/</guid><description>&lt;p>One of my etcd nodes in my home k8s cluster has been failing with following message:&lt;/p>
&lt;div class="highlight">&lt;pre class="chroma">&lt;code class="language-fallback" data-lang="fallback">&lt;span class="ln">1&lt;/span>2021-01-14 11:16:09.233458 I | embed: listening for peers on 192.168.0.33:2380
&lt;span class="ln">2&lt;/span>raft2021/01/14 11:16:09 tocommit(29492601) is out of range [lastIndex(29492469)]. Was the raft log corrupted, truncated, or lost?
&lt;span class="ln">3&lt;/span>panic: tocommit(29492601) is out of range [lastIndex(29492469)]. Was the raft log corrupted, truncated, or lost?
&lt;/code>&lt;/pre>&lt;/div>&lt;p>These are steps I took to fix it:&lt;/p></description></item><item><title>Backup and restore k3s kubernetes cluster with velero</title><link>https://blog.alekc.org/posts/2020/velero-backup-restore-on-scaleway/</link><pubDate>Sun, 05 Jul 2020 11:25:59 +0000</pubDate><guid>https://blog.alekc.org/posts/2020/velero-backup-restore-on-scaleway/</guid><description>&lt;p>Recently for my home, I&amp;rsquo;ve migrated from docker to k3s cluster. However, in the beginning, it was a standalone master with an agent connected to it. Later on I wanted to migrate to HA, however for now it&amp;rsquo;s not possible to do so natively with k3s.&lt;/p></description></item><item><title>Error reading repository - Error 410</title><link>https://blog.alekc.org/posts/2020/git-error-410/</link><pubDate>Sun, 26 Jan 2020 19:25:59 +0000</pubDate><guid>https://blog.alekc.org/posts/2020/git-error-410/</guid><description>&lt;p>My company uses private Gitlab installation (let&amp;rsquo;s call it &lt;em>git.company.com&lt;/em>), and some Goland projects are referencing other private repositories as dependencies.&lt;/p></description></item><item><title>Testing ansible roles with molecule, using DIND</title><link>https://blog.alekc.org/posts/2020/2020-molecule-getting-started/</link><pubDate>Sun, 26 Jan 2020 18:25:59 +0000</pubDate><guid>https://blog.alekc.org/posts/2020/2020-molecule-getting-started/</guid><description>&lt;p>Molecule is a testing/development framework which is designed to aid in the development and testing of Ansible roles.&lt;/p>
&lt;p>However, there are several challenges involved if you need to test &lt;code>docker_container&lt;/code> functionality in your role&lt;/p></description></item><item><title>New beginning</title><link>https://blog.alekc.org/posts/2020/new-beginning/</link><pubDate>Fri, 17 Jan 2020 18:25:59 +0000</pubDate><guid>https://blog.alekc.org/posts/2020/new-beginning/</guid><description>&lt;p>Since the 2020 is a new decade, I decided to revamp completely my old blog and start from scratch.&lt;/p></description></item></channel></rss>