<?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 Tomáš Kukrál on Medium]]></title>
        <description><![CDATA[Stories by Tomáš Kukrál on Medium]]></description>
        <link>https://medium.com/@tomkukral?source=rss-3cbceeb38096------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*QXkp_GNQyk_ueW8a1TKzOw.jpeg</url>
            <title>Stories by Tomáš Kukrál on Medium</title>
            <link>https://medium.com/@tomkukral?source=rss-3cbceeb38096------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 06:04:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tomkukral/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[AKS vs reality]]></title>
            <link>https://medium.com/@tomkukral/aks-vs-reality-ae3a0eed87ad?source=rss-3cbceeb38096------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae3a0eed87ad</guid>
            <category><![CDATA[production]]></category>
            <category><![CDATA[kubenetes]]></category>
            <category><![CDATA[ak]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Tomáš Kukrál]]></dc:creator>
            <pubDate>Fri, 04 Jan 2019 08:25:18 GMT</pubDate>
            <atom:updated>2019-01-06T09:45:20.738Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hrReLCixSL4dHeqC_t251A.jpeg" /></figure><p>I’ve been using <a href="https://azure.microsoft.com/en-us/services/kubernetes-service/">AKS</a> (managed Kubernetes from Azure) for last few months to run some personal project and a few production workloads. I’ll share my operation experience in this article.</p><p>The most important advantage of AKS should be easy Kubernetes provisioning and lifecycle management (LCM). Basic assumption of managed Kubenetes means to be operated and managed by cloud provider, where you just consume the API. It means that you aren’t responsible for monitoring Kubernetes nodes, updates and day-to-day operation because it should be handled by Azure. <strong>It’s managed and you are paying for it.</strong> So forget about doing SSH to nodes and fixing something. If you break anything (like overloading node by undefined memory resources) than it should be reported back to you easily.</p><p>Ok, so you have deployed new Kubenetes cluster using <a href="https://www.terraform.io/">terraform</a> or <a href="http://portal.azure.com/">web portal</a>, and you are looking for link to download <em>kubeconfig</em> file. Save your time, because there is no link to download it. I was expecting similar experience like <a href="https://cloud.google.com/kubernetes-engine/">GKE</a> — just click on <strong>download kubeconfig</strong> button and use standard kubectl command. Azure require az command installed on your machine to be able to generate <em>kubeconfig</em> and connect to you cluster. It is suprising for me that CLI, API and web portal provide different set of features.</p><p>Essential part of Kubenetes clusters is scaling, so you are able to change cluster size according to the requirements. Some managed Kubernetes clusters can autoscale according to allocated and requested pod resources, but this isn’t supported in AKS. I hope it will be possible in the future. However, missing autoscaling isn’t a huge problem for me because semi-manual scaling is posible by changing the cluster size.</p><p>Much more serious issue is how scaling works, because you can only change cluster size, which is more than suboptimal from my point of view. Let’s imagine this scenario: You are using AKS cluster with F2 instances (4GB RAM) to run CI jobs and regular CI job is allocating less than 2GB RAM (pod resources summary). It works fine until some job become more compilicated and will require pod with more than 4GB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*_YAxET2o3qehdzZVB6gOYQ.png" /><figcaption>Scaling AKS cluster</figcaption></figure><p>There is <strong>no way to add different flavor</strong> to the cluster and you are locked to same instance flavour which was selected during cluster creation. GKE is solving this problem with node pools so any flavors can be mixed in cluster. Only way to add bigger instances to AKS cluster is to delete current cluster and redeploy with bigger instances. Not very cloud native, isn’t it?</p><p>Another problem is replacing failed node. It can fail due to your’s or Azure’s mistake and I was expecting to have easy way to destroy the node and start new one. I don’t care about local data since all our critical data must be external or stored on <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/">PVs</a> so replacing node quickly while fixing root cause of problem is the best way to go. We have found <strong>dirty workaround</strong> to replace failed node by scaling to 1 node (which will delete all nodes expect the first one) and then scale back to your previous cluster size. However, there are two very unpleasant issues:</p><ol><li>Your cluster is underscaled during this operation and it will probably make cluster overloaded until you scale up to the previous cluster size</li><li>First node can’t be replaced because scaling to <strong>zero</strong> nodes isn’t supported therefore you need to disable scheduling on first node to workaround it.</li></ol><p>Let’s take a deep look how AKS nodes are configured. First we need SSH to the node. I was hopeing to avoid this (see first paragraph) but I’m not aware of any other method since Azure portal is very limited. There is a <a href="https://docs.microsoft.com/en-us/azure/aks/ssh">document</a> describing the procedure. It basicaly starts pod in a cluster, installs openssh-clientinto the pod, generates SSH keys, puts private key into the pod and connects to node. It’s very complicated and uncomfortable compared to simple SSH button in GKE console.</p><p>Second way to reach faulty Kubernetes node is to assing public IP address and adjust security group to allow SSH connection to this particular node.</p><p>Docker is using default /var/lib/docker graph so be aware that images can fill up system disk. Fresh node have about 7GB used for filesystem. I’d like to have option to dedicate disk for docker but it ins’t possible. I’m expecting Azure to be monitoring filesystem usage and using proper settings for <a href="https://kubernetes.io/docs/concepts/cluster-administration/kubelet-garbage-collection/">kubelet garbage collection</a> to avoid filesystem fill up.</p><pre>Filesystem      Size  Used Avail Use% Mounted on<br>udev            2.0G     0  2.0G   0% /dev<br>tmpfs           395M  1.7M  393M   1% /run<br>/dev/sda1        30G  7.2G   22G  25% /<br>tmpfs           2.0G     0  2.0G   0% /dev/shm<br>tmpfs           5.0M     0  5.0M   0% /run/lock<br>tmpfs           2.0G     0  2.0G   0% /sys/fs/cgroup<br>/dev/sdb1        32G   48M   30G   1% /mnt</pre><p>Docker logging configuration seems to be fine already:</p><pre>{<br>  &quot;live-restore&quot;: true,<br>  &quot;log-driver&quot;: &quot;json-file&quot;,<br>  &quot;log-opts&quot;:  {<br>     &quot;max-size&quot;: &quot;50m&quot;,<br>     &quot;max-file&quot;: &quot;5&quot;<br>  }<br>}</pre><p>There is a script /usr/local/bin/health-monitor.sh used for checking node health. The script was starting container every few seconds to check docker but it seems to be changed to different monitoring method. We have seen docker daemon to be restarted by this script in order to try heal the node which made situation even worse. However, this script seems to be adjusted in latest AKS and it works fine for now.</p><p>It’d be nice if AKS nodes can run ntp because there were clock skew problems repoted by our users. There is not ntp daemon running.</p><p>You can decide to run AKS with <a href="https://docs.microsoft.com/en-us/azure/aks/configure-advanced-networking">Advanced networking</a> which provides more configuration options than the Basic networking. However, only 30 pods can be started per node due to their CNI design. This isn’t a problem because it’s stated in documentation and you should plan for this and choose right sizing of VM. In our case we had to deploy more smaller instances rather than larger to do not hit limit of pod IP addresses.</p><p>We have been using AKS cluster to run <a href="https://docs.gitlab.com/runner/executors/kubernetes.html">Gitlab executor</a> and this kind of workload was a huge challenge for the cluster. Executor was starting many pods with more than five containers inside. We have experienced Kubernetes contol plane unavailable, nodes broken by filled up filesystem and broken connection between control plane and nodes. Error message bellow was observed countless times.</p><pre>ERROR: Job failed (system failure): error dialing backend: dial tcp: lookup aks-agentpool-47932935-2 on 172.30.0.10:53: server misbehaving</pre><p>AKS is using SSH tunnel between nodes and control plane. This tunnel is needed for all connections originated from control plane and targeted to nodes. It’s necessary, for example, for metric scraping, kubectl log, andkubectl exec . so SSH tunnel pretty critical part of cluster. It was necessary to restart the tunnel manually sometimes when connectivity was broken.</p><pre>NAME                           READY     STATUS    RESTARTS   AGE<br>tunnelfront-994bb8445-klhb6    1/1       Running   0          8h</pre><p>We have started some clusters in pre-GA and it got stuck when doing Kubenetes upgrade. We worked with support to fix this cluster to find a root cause for this problem and they seems to have some problem with Kubernetes control plane update (They are managing it using helm). This was what they were able to get</p><pre>helm history 5ae1bff3edd7aa0001e96632<br>REVISION UPDATED STATUS CHART DESCRIPTION</pre><pre>1 Thu Apr 26 12:03:52 2018 SUPERSEDED kube-control-plane-0.2.0 Install complete</pre><pre>2 Thu Apr 26 12:10:45 2018 FAILED kube-control-plane-0.2.0 Upgrade “5ae1bff3edd7aa0001e96632” failed: timed out wait…</pre><p>Then backend team tried to rollback to different release and failed on release not found and recommended to recreate the cluster.</p><p>This certainly isn’t what you want to do with production cluster so I hope they have fixed all these critical issues before going to GA.</p><p>There is <a href="https://github.com/Azure/AKS/issues/604">no changelog</a> for AKS so the only way to follow changes in environment is your own investigation. This isn’t very convenient because cluster deployed tomorrow can have different settings than cluster deployed today. I don’t need to know git-like history for AKS deployments but it’s critical to have all changes affecting workload properly planned and announced beforehand.</p><p>We have seen incompatible changes in AKS API caused by adding required parameters which may break your deployment pipeline completely.</p><p>This is my <strong>personal</strong> experience running AKS clusters for last 9 months. AKS seems to be pretty nice service but very limited scaling capabilities and unclear service roadmap. We have switched most demanding workload (Gitlab runner) to GKE in August so I don’t have hands-on experince with latest updates. I’m sure that AKS team is working hard but they have a long way to catch GKE.</p><p>Please let me know if you are aware of any better solution for problems describe abowe. I’m looking forward to see this solved.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae3a0eed87ad" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using buildah in GitLab CI]]></title>
            <link>https://medium.com/prgcont/using-buildah-in-gitlab-ci-9b529af19e42?source=rss-3cbceeb38096------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b529af19e42</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[volterra]]></category>
            <category><![CDATA[buildah]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Tomáš Kukrál]]></dc:creator>
            <pubDate>Mon, 11 Jun 2018 08:26:00 GMT</pubDate>
            <atom:updated>2018-06-11T08:26:00.803Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<p>Building images in CI is pretty common task and it always brings questions about technologies and workflow. I’d like to show you how we solved these questions by using buildah together with <strong>GitLab CI</strong>.</p><p>Let’s first take a look at our CI infrastucture:</p><ul><li>We are using <a href="https://gitlab.com/">Gitlab</a> to manage source code and Gitlab CI to run tests, linters and build images.</li><li>Private Gitlab runner with <a href="https://docs.gitlab.com/runner/executors/kubernetes.html">Kubernetes executor</a> is executing our CI. It means that every job/build is running in pod on top of managed Kubernetes cluster.</li><li>Every successful pipeline produces container image with current version or branch build and pushes container into the registry.</li></ul><p>There are different ways to build container image, and probably the most common is creating Dockerfile and running docker build -t myimage . However, this command isn’t supposed to be used alone, since it requires docker daemon and it can get more complicated when this build is already running in pod/container as we can’t run another docker daemon.</p><p>There is pretty ugly and very offten used solution called <a href="https://github.com/jpetazzo/dind">dind</a> (Docker-in-Docker). It mounts docker socket into the containter so you are effectively allowing your in-container docker command to manage docker daemon running in the host. You don’t want to do this because:</p><ul><li>All builds on the host are <strong>mixed</strong> together by sharing single docker daemon</li><li>Build command isn’t respecting any limitations for build pod because build itself isn’t running in build container but on docker daemon outside</li></ul><p>Another funny problem with image building is incompatibility of Dockerfile commands in different docker version. You can’t use <a href="https://docs.docker.com/develop/develop-images/multistage-build/">multi-stage builds</a> with docker version &lt;<strong>17.05</strong> and our managed cluster is running <strong>1.13.1</strong>. Using similar docker version in host as well in container is required for build to work properly.</p><p>There is nice project called <a href="https://github.com/projectatomic/buildah">buildah</a> which is providing powerful and easy way to build container images, even when you are running in container.</p><h3>Buildah image</h3><p>We used to be usingdocker:latest for <strong>dind </strong>but this tool requires docker daemon on the host and mounted socket.</p><p>First step necessary for switching builds to buildah is building buildah buider image. You can use buildah to build this image but using Dockerfile may be easier for the first steps. This image should contain buildah for building images and podman which is used for container registry login and running containers. Following Dockerfile will give you buildah image ready to create container or you can use my <a href="https://hub.docker.com/r/tomkukral/buildah/">tomkukral/buildah</a>.</p><pre>FROM fedora</pre><pre>RUN dnf install -y \<br>  buildah \<br>  podman \<br>  make \<br>  &amp;&amp; \<br> dnf clean all</pre><h3>Kubernetes Gitlab CI runner</h3><p>Gitlab runner is using native Kubernetes features for starting builds, i.e. build is running as Kubernetes pod and we need to make sure executor is configured properly. Example of config.toml file can be found below. You can see there are two volume mounts:</p><ul><li>/var/run/docker.sock for docker builds because we haven’t switched everything yet</li><li>/var/lib/containers for buildah. Containers (layers) are stored in this directory and buildah requires this to be a regular filesystem. More information can be found in <a href="https://github.com/projectatomic/buildah/issues/158">issue #158</a>.</li></ul><pre>[[runners]]<br>      name = &quot;Kubernetes Runner&quot;<br>      url = &quot;<a href="https://gitlab.com/ci">https://gitlab.com/ci</a>&quot;<br>      token = &quot;{{ .gitlab_runner_token }}&quot;<br>      executor = &quot;kubernetes&quot;<br>      privileged = true</pre><pre>      [runners.kubernetes]<br>        namespace = &quot;gitlab&quot;<br>        <br>        [[runners.kubernetes.volumes.host_path]]<br>          name = &quot;docker&quot;<br>          mount_path = &quot;/var/run/docker.sock&quot;<br>          read_only = false<br>        [[runners.kubernetes.volumes.host_path]]<br>          name = &quot;buildah&quot;<br>          mount_path = &quot;/var/lib/containers/&quot;<br>          read_only = false</pre><p>You may be asking why is mounting directory better than mounting socket? It makes a huge difference because you you can mount any host directory into buildah container and provide project separation. Another big difference is that /var/lib/container is just a storage and no management socket is there.</p><p>That’s a pity that build container must be still running in <strong>privileged</strong> mode but there is ongoing effort to switch to unprivileged.</p><h3>Building the image</h3><p>Now we have builder image and Gitlab runner ready to build using buildah and next step is to setup CI pipeline. These steps are pretty straightforward because only few commands must be changed:</p><ul><li>docker build to buildah bud</li><li>docker login to podman login</li><li>docker push to buildah push</li></ul><p>Don’t forget to add docker:// to push target if you are pushing to docker container registry because buildah can push to other <a href="https://github.com/projectatomic/buildah/blob/master/docs/buildah-push.md">transports</a> as well.</p><pre>variables:<br>  # REGISTRY_USERNAME - secret variable <br>  # REGISTRY_PASSWORD - secret variable<br>  # REGISTRY_SERVER - secret variable<br>  IMAGE_NAME: ${REGISTRY_SERVER}/proj/${CI_PROJECT_NAME}</pre><pre>container:<br>  stage: publish<br>  image: tomkukral/buildah<br>  dependencies:<br>    - build<br>  before_script:<br>    - podman version<br>    - buildah version<br>    - podman login --username &quot;${REGISTRY_USERNAME}&quot; --password &quot;${REGISTRY_PASSWORD}&quot; &quot;${REGISTRY_SERVER}&quot;<br>  script:<br>    - buildah bud -t ${IMAGE_NAME}:${CI_COMMIT_SHA} .<br>    - buildah push ${IMAGE_NAME}:${CI_COMMIT_SHA} docker://${IMAGE_NAME}:${CI_COMMIT_SHA}<br>  after_script:<br>    - podman logout &quot;${REGISTRY_SERVER}&quot;</pre><p>Now let’s try to run pipeline and check your new image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*AxBh72DBOTPaiYZPwkBnrQ.png" /></figure><h3>Resume</h3><p>Now you are able to build container images using Gitlab CI with Kubernetes executor and it’s up to you to choose right container build tool. There are another interesting features in podman/builah, e.g. image signing. I can write post about it … just let me know if you are interested.</p><p>Happy building!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b529af19e42" width="1" height="1" alt=""><hr><p><a href="https://medium.com/prgcont/using-buildah-in-gitlab-ci-9b529af19e42">Using buildah in GitLab CI</a> was originally published in <a href="https://medium.com/prgcont">Prague Containers Meetup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>