• Add new line when printing data using jsonpath

    2 min read

    kubectl jsonpath output formatting new lines custom delimiters

    When we print values using jsonpath we'll get all the values in a single line (actually, it won't even bother adding the newline character at the end of the list):

    $ kubectl get ns -o jsonpath='{ .items[*].metadata.name }'
    default dynamodb-operator ec2-operator iam-operator kube-node-lease kube-public kube-system local-path-storage testvault
    

    06/06/2023

    Read more...
  • kubectl: Retrieve a list of object names

    2 min read

    kubectl jsonpath

    If we need to write some script to retrieve a certain information that kubectl can provide, we can always add the option to remove headers and use something like awk to narrowit down. There's also a better way than doing this:

    kubectl get ns --no-headers | awk '{ print $1 }'
    

    31/08/2022

    Read more...

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