• Terraform: Using the external data source

    2 min read

    terraform data-source external

    To be able to execute an arbitrary command to retrieve some data and being able to use it as a variable in terraform we can use the external data-source

    17/08/2021

    Read more...
  • Getting Kubernetes documentation using kubectl

    3 min read

    kubernetes explain

    While forking on Kubernetes manifest it's easy to forget the available fields for each Kubernetes object. Using kubectl explain we can get all the fields available with a short description of them. Pretty much a man inside kubectl

    13/08/2021

    Read more...
  • 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...

More recent...

Older content...