Let's look at some basic kubectl output options.
Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).
We can start with:
kubectl get no
Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).
docker run -it --rm --privileged --pid=host justincormack/nsenter1
more info: https://github.com/justincormack/nsenter1
# Instructions for fresh install | |
$ sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume --daemon | |
# reboot | |
$ source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh | |
$ echo 'export NIX_PATH=darwin-config=$HOME/.nixpkgs/darwin-configuration.nix:$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH' | tee -a ~/.zshrc | |
$ echo 'source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh' | tee -a ~/.zshrc | |
$ nix-channel --add https://nixos.org/channels/nixpkgs-unstable | |
$ nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin | |
$ nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager |
"metrics": { | |
... | |
"disk": { | |
"measurement": [ | |
"used_percent", | |
"inodes_free" | |
], | |
"metrics_collection_interval": 60, | |
"resources": [ | |
"*" |
terraform { | |
required_providers { | |
external = { | |
source = "hashicorp/external" | |
version = "~> 2" | |
} | |
} | |
} | |
data "external" "git_remote_url" { |
#!/bin/bash | |
pod_name=$1 | |
while true; do | |
kubectl get events --sort-by='.lastTimestamp' \ | |
-ojson \ | |
| jq -r '.items[] | select((.involvedObject.name | contains("'$pod_name'")) and (.involvedObject.kind=="Pod")) | "\(.lastTimestamp) [\(.count)] \(.message)"' | |
echo | |
echo "---------" | |
echo |