• tree visualization of Kubernetes objects

    2 min read

    Some kubernetes objects creates and manages other kubernetes objects in order to provide it's functionality. For example, the Deployment object creates a ReplicaSet that in turn creates the desired Pod objects. We can always track down this relationship using kubectl describe but using the tree krew plugin we can see the relationship in a visual way. We can install it like so:

    $ kubectl krew install tree
    

    14/06/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...
  • How to imperatively change a container's image

    2 min read

    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

    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...
  • kubectl uncordon: mark node as schedulable

    1 min read

    Using kubectl drain you can evict pods and disabled scheduling for a node so you can proceed with some maintenance. Once this maintenance is over we will need to allow pods to be scheduled to this node, removing the SchedulingDisabled:

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

    29/04/2021

    Read more...

Older content...

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