• What's a Kubernetes Deployment object?

    2 min read

    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...
  • Kubernetes deployment strategies

    2 min read

    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...
  • Using an HPA object to autoscale a deployment based on it's Pods CPU metrics

    3 min read

    On Kubernetes, scaling an application is just a matter of defining how many replicas we want:

    $ kubectl scale deployment/demo --replicas=5
    deployment.apps/demo scaled
    

    Having to manually adjust the number of replicas is not really practical. Here's where the HorizontalPodAutoscaler (HPA) comes into play

    01/07/2021

    Read more...
  • kubernetes: Rollback a deployment update

    2 min read

    When performing rolling updates we can see it's history using kubectl rollout history:

    $ kubectl rollout history deploy pet2cattle
    deployment.apps/pet2cattle 
    REVISION  CHANGE-CAUSE
    100       <none>
    101       <none>
    102       <none>
    103       <none>
    104       <none>
    105       <none>
    106       <none>
    107       <none>
    109       kubectl scale deployment/pet2cattle --replicas=2 --record=true
    110       kubectl scale deployment/pet2cattle --replicas=5 --record=true
    111       kubectl scale deployment/pet2cattle --replicas=1 --record=true
    

    If have any problem with the update we can undo and update using kubectl rollout undo

    25/05/2021

    Read more...
  • Keeping record of the change cause using the --record flag

    3 min read

    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...

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