How to list all root keys in YAML file using yq v4 CLI?
yq4
is my terminal alias foryq
above
Let's print all the root keys if they have enabled
sub-key e.g.
apiVersion: v1 | |
kind: Namespace | |
metadata: | |
name: dummy-exporter | |
--- | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
labels: | |
app: dummy-exporter |
How to list all root keys in YAML file using yq v4 CLI?
yq4
is my terminal alias foryq
above
Let's print all the root keys if they have enabled
sub-key e.g.
#!/bin/bash | |
# This script is for Mac OSX users. If you are on Linux, replace 'gxargs' with 'xargs'. | |
# To install 'gxargs' command using Homebrew, run 'brew install findutils' first. | |
# Without parallel (ideal for small number of pods) | |
kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | gxargs -n 1 -d '\n' bash -c 'kubectl delete pod $0 $1 --force' | |
# With parallel (ideal for big number of pods) | |
# To install 'parallel' command using Homebrew, run 'brew install parallel' first. |
If you have multiple Kubernetes contexts (list them by kubectl config get-contexts
) and you want to view or extract the kubeconfig just for current/selected context, you can use one of the following command:
$ kubectl config view --minify --flatten
OR
#!/bin/bash | |
# Step 1 - Install Tailscale | |
sudo apt-get install apt-transport-https && \ | |
curl -fsSL https://pkgs.tailscale.com/stable/raspbian/buster.gpg | sudo apt-key add - && \ | |
curl -fsSL https://pkgs.tailscale.com/stable/raspbian/buster.list | sudo tee /etc/apt/sources.list.d/tailscale.list && \ | |
sudo apt-get update && \ | |
sudo apt-get install -y tailscale && \ | |
sudo tailscale up |
# Method #1 | |
whois $(whois $(curl -s icanhazip.com) | grep origin | awk '{print $2}') | grep -i descr | cut -d: -f2- | tail -n1 | xargs | |
# Method #2 | |
whois $(whois $(curl -s icanhazip.com) | grep origin | awk '{print $2}') | grep -i 'org-name\|orgname' | cut -d: -f2- | tail -n1 | xargs | |
# Method #3 | |
whois $(curl -s icanhazip.com) | grep -i 'org-name\|orgname' | cut -d: -f2- | tail -n1 | xargs |
#!/bin/bash | |
vcgencmd measure_temp | |
vcgencmd get_throttled | |
sysbench --test=cpu --cpu-max-prime=20000 --num-threads=4 run >/dev/null 2>&1 | |
vcgencmd measure_temp | |
vcgencmd get_throttled | |
sysbench --test=cpu --cpu-max-prime=20000 --num-threads=4 run >/dev/null 2>&1 | |
vcgencmd measure_temp | |
vcgencmd get_throttled | |
sysbench --test=cpu --cpu-max-prime=20000 --num-threads=4 run >/dev/null 2>&1 |
# Require 'jq' | |
# https://stedolan.github.io/jq/ | |
helm list -A -o json | jq -r '.[] | .name + " " + .namespace' | xargs -n2 sh -c 'helm uninstall $1 -n $2' sh |
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
# IMPORTANT | |
# Make sure you already create an ingress rule for the port that you want to open in Oracle Cloud virtual firewall aka | |
# "Security Lists". This tutorial might be useful for you: | |
# ---> https://youtu.be/1AIXULHjabQ | |
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
# SSH into the instance | |
$ ssh <username>@<ip_address> |