• 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...
  • How to add entries to a pod's /etc/hosts file

    2 min read

    hostAliases pod kubernetes

    The /etc/hosts file is a Kubernetes-managed file so we cannot add entries freely to it. If we want to add entries to it we will have to use the hostAliases field in the Pod's spec.

    $ kubectl exec -it demo-pod -- cat /etc/hosts
    # Kubernetes-managed hosts file.
    127.0.0.1 localhost
    ::1 localhost ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    fe00::0 ip6-mcastprefix
    fe00::1 ip6-allnodes
    fe00::2 ip6-allrouters
    10.103.198.74 demo-pod
    

    11/05/2021

    Read more...
  • AWS EKS: How to resize Persistent Volumes

    3 min read

    AWS EKS resize volume

    On a AWS EKS cluster, at the time of this writing, by default you cannot resize volumes provisioned with the default gp2 StorageClass. This is because on the default StorageClass the allowVolumeExpansion is set to false, preventing the volume expansion:

    $ kubectl get sc
    NAME            PROVISIONER             RECLAIMPOLICY   VOLUMEBINDINGMODE      ALLOWVOLUMEEXPANSION   AGE
    gp2 (default)   kubernetes.io/aws-ebs   Delete          WaitForFirstConsumer   false                  78d
    

    10/05/2021

    Read more...

More recent...

Older content...