• Kubernetes Mutating Webhook: Patch a Kubernetes Pod on the fly - the hard way

    6 min read

    Mutating Webhook admission controller MutatingWebhookConfiguration

    To be able to modify a request to the Kubernetes API server prior to persist the object (to, for example, inject a sidecar) we can use a Mutating Webhook. The admission controller makes a requests using all the MutatingWebhookConfiguration objects that matches the request and processes them in serial:

    apiVersion: admissionregistration.k8s.io/v1
    kind: MutatingWebhookConfiguration
    (...)
    

    Let's take a look on how to configure a mutating webhook from scratch

    12/08/2021

    Read more...
  • How to avoid pods of the same Deployment to be scheduled on the same node

    2 min read

    kubernetes pod affinity node podAntiAffinity

    For some applications we might want to avoid having two or more Pods belonging to the same Deployment to be scheduled on different nodes, yet we don't need them to be a DaemonSet. Let's use as an example the cluster autoscaler: We would like to have two replicas but not on the same node, since if we are draining the node an there's not enough capacity on the other nodes with both Pods offline a manual intervention would be required to spawn a new node

    $ kubectl get pods -n autoscaler -o wide
    NAME                                                 READY   STATUS    RESTARTS   AGE     IP              NODE                                           NOMINATED NODE   READINESS GATES
    autoscaler-aws-cluster-autoscaler-585cc546dd-jc46d   1/1     Running   0          16h     10.103.195.47   ip-10-12-16-10.eu-west-1.compute.internal    <none>           <none>
    autoscaler-aws-cluster-autoscaler-585cc546dd-s4j2r   1/1     Running   0          16h     10.103.195.147  ip-10-12-16-10.eu-west-1.compute.internal    <none>           <none>
    

    To do so we will have to configure affinity

    11/08/2021

    Read more...
  • Loading a CSV file into terraform

    2 min read

    terraform csvdecode function csv

    Sometimes if you have some externally managed data it can come handy to be able to import it into terraform as a CSV file instead of having to manually enter all the date. To do so we can use the csvdecode() function

    10/08/2021

    Read more...
  • What's a Kubernetes Deployment object?

    2 min read

    kubernetes Deployment

    Maybe the most common object used for deploying applications on Kubernetes is the Deployment object. It is intended to provide declarative updates for Pods at a controlled rate.

    With a Deployment we are setting the desired state of a ReplicaSet. The Deployment controller will take the appropriate actions to adjust the ReplicaSet so it has the correct amount of Pods

    09/08/2021

    Read more...
  • What's a Kubernetes Job?

    2 min read

    kubernetes Job

    A Kubernetes Job is an object that contains a Pod definition, just as a Deployment do, but instead of expecting the Pod to be continuously running, it is expecting it to finish. In case the Pod execution fails, it will continue to retry execution until a specified number of them successfully terminate.

    05/08/2021

    Read more...
  • Kubernetes startupProbe: testing containers for application startup

    2 min read

    kubernetes Pod startupProbe

    Starting from Kubernetes v1.20 we can configure a startup Probe: It will check for containers to be come into service, disabling liveness and readiness checks until it succeeds.

    05/08/2021

    Read more...
  • Kubernetes deployment strategies

    2 min read

    kubernetes Deployment RollingUpdate Recreate

    To update a Deployment objects we can choose between two built-in strategies used to replace old Pods by new ones: Recreate and RollingUpdate

    Let's see the differences between them

    04/08/2021

    Read more...
  • Kubernetes: What's a PodDisruptionBudget?

    2 min read

    kubernetes Pod PodDisruptionBudget

    In Kubernetes we can configure a PodDisruptionBudgets (PDB) to tell the cluster for a given set of Pods how they can tolerate interruptions (such as application upgrades) maintaining it's general availability.

    This Kubernetes object has graduated to GA in Kubernetes v1.21

    03/08/2021

    Read more...
  • Kubernetes: cannot delete Pods with local storage

    2 min read

    kubernetes kubectl drain local storage emptyDir

    While draining a node it might fail with the message cannot delete Pods with local storage as follows:

    $ kubectl drain tycho.pet2cattle.com --ignore-daemonsets
    node/tycho.pet2cattle.com already cordoned
    error: unable to drain node "tycho.pet2cattle.com", aborting command...
    
    There are pending nodes to be drained:
     tycho.pet2cattle.com
    error: cannot delete Pods with local storage (use --delete-emptydir-data to override): spinnaker-ampa/spin-rosco-658fdb4694-v99jt
    

    02/08/2021

    Read more...

More recent...

From pet to cattle
Treat your kubernetes clusters like cattle, not pets