• Keeping record of the change cause using the --record flag

    3 min read

    kubectl rolling update history change-cause

    On Kubernetes, when we update objects such as a deployment or a daemonset we can check it's rollout history using kubectl rollout history:

    $ kubectl rollout history deploy pet2cattle
    deployment.apps/pet2cattle 
    REVISION  CHANGE-CAUSE
    21        <none>
    22        <none>
    23        <none>
    24        <none>
    26        <none>
    28        <none>
    29        <none>
    30        <none>
    32        <none>
    33        <none>
    34        <none>
    

    By default we won't be able to see a change cause, but we can fill this gap by setting the command that triggered the update adding the --record flag as follows:

    $ kubectl scale deployment/pet2cattle --replicas 2 --record
    deployment.apps/pet2cattle scaled
    

    18/05/2021

    Read more...
  • Rolling updates on Kubernetes deployments

    2 min read

    Deployment pod rolling update

    There are several strategies available for updating a deployment on Kubernetes, by default it will trigger a rolling update: It will deploy the new version before tearing down the old one so there's no downtime associated to it.

    Let's see how we can see this process by applying an update to a deployment:

    $ kubectl apply -f deployment.yaml
    

    17/05/2021

    Read more...
  • How to imperatively change a container's image

    2 min read

    kubernetes set image

    To change a container's image we can:

    • Update the yaml definition and push it using kubectl apply
    • Use kubectl edit to update it using a definition fetched from the Kubernetes cluster itself
    • To use kubectl set image to set the new image

    Let's check how to use kubectl set image

    14/05/2021

    Read more...
  • Forward traffic to kubernetes services

    2 min read

    kubectl port-forward kubernetes

    When we want to access services that run inside a kubernetes cluster that are not supposed to be normally accessed we can temporally run kubectl port-forward to forward traffic to our workstation. To be able to use it, the node must have socat installed.

    13/05/2021

    Read more...
  • Forcefully replace a terraform resource / terraform taint

    3 min read

    terraform taint replace

    With terraform taint we are telling terraform that a particular object has become degraded so it will propose to replace it in the next plan. This command is going to be deprecated on terraform v1.0 since now we have the -replace flag on the apply command

    $ terraform taint kubernetes_namespace.pet2cattle_namespace
    Acquiring state lock. This may take a few moments...
    Resource instance kubernetes_namespace.pet2cattle_namespace has been marked as tainted.
    Releasing state lock. This may take a few moments...
    

    12/05/2021

    Read more...

More recent...

Older content...