• kubectl drain: prepare node for maintenance

    You can use kubectl drain to evict pods from a node and mark it as unschedulable to prevent new pods from arriving. It will allow the pod's containers to gracefully terminate and respecting the PodDisruptionBudgets with a few exceptions. Let's test it suing the following nodes:

    $ kubectl get nodes
    NAME                    STATUS   ROLES                  AGE   VERSION
    nauvoo.pet2cattle.com   Ready    control-plane,master   19d   v1.20.4+k3s1
    tycho.pet2cattle.com    Ready    <none>                 26s   v1.20.4+k3s1
    

    14/04/2021

    Read more...
  • How kubernetes hides away the volumeMounts complexity

    If we try compare volumeMounts with the actual mounts that we have on a pod using, for example, df it can be quite confusing due to the usage of the overlay filesystem

    Let's consider the volumeMounts section of a deploy:

    $ kubectl get deploy pet2cattle -o yaml
    (...)
              volumeMounts:
              - mountPath: /opt/pet2cattle/conf
                name: config
              - mountPath: /opt/pet2cattle/data
                name: pet2cattle
                subPath: data
              - mountPath: /opt/pet2cattle/lib
                name: pet2cattle
                subPath: lib
              - mountPath: /tmp
                name: tmp-dir
    (...)
    

    And compare it with the filesystem we see on the pod:

    $ kubectl exec pet2cattle-8475d6697-jbmsm -- df -hP
    Filesystem      Size  Used Avail Use% Mounted on
    overlay         100G  9.7G   91G  10% /
    tmpfs            64M     0   64M   0% /dev
    tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
    /dev/xvda1      100G  9.7G   91G  10% /tmp
    shm              64M     0   64M   0% /dev/shm
    /dev/xvdcu       20G  2.5G   18G  13% /opt/pet2cattle/lib
    tmpfs           3.9G   12K  3.9G   1% /run/secrets/kubernetes.io/serviceaccount
    tmpfs           3.9G     0  3.9G   0% /proc/acpi
    tmpfs           3.9G     0  3.9G   0% /proc/scsi
    tmpfs           3.9G     0  3.9G   0% /sys/firmware
    

    13/04/2021

    Read more...
  • k3s: Join a new worker node to an existing cluster

    On a previous post we saw how ridiculously easy is to bootstrap a k3s cluster on a Raspberry Pi but what do we need to do to join new worker nodes to the cluster?

    05/04/2021

    Read more...
  • Declaratively create a kubernetes pod using kubectl (for docker administrators)

    The first thing one want to try once we have access to a Kubernetes cluster is to run a pod in it. Let's try to create our first pod on kubernetes, declaratively: meaning that we will be writing a manifest to do it.

    31/03/2021

    Read more...
  • Imperatively create a kubernetes pod using kubectl (for docker administrators)

    Just as an hello-world equivalent, first thing one want to try to start learning how to use a Kubernetes cluster is to run a pod in it. Let's try to create our first pod on kubernetes just as we would do with docker for running a container

    29/03/2021

    Read more...

Older content...