Created
February 27, 2023 11:46
-
-
Save rafaribe/836ea6fef1ddfaef2066ebe19ea9fa64 to your computer and use it in GitHub Desktop.
k9s configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# $XDG_CONFIG_HOME/k9s/alias.yml | |
alias: | |
sec: v1/secrets | |
sm: monitoring.coreos.com/v1/servicemonitors | |
ss: apps/v1/statefulsets | |
udp: traefik.containo.us/v1alpha1/ingressrouteudps | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# $HOME/.k9s/plugin.yml | |
# move selected line to chosen resource in K9s, then: | |
# Shift-T (with confirmation) to toggle helm releases or kustomizations suspend and resume | |
# Shift-R (no confirmation) to reconcile a git source or a helm release or a kustomization | |
plugin: | |
toggle-helmrelease: | |
shortCut: Shift-T | |
confirm: true | |
scopes: | |
- helmreleases | |
description: Toggle to suspend or resume a HelmRelease | |
command: sh | |
background: false | |
args: | |
- -c | |
- 'flux --context $CONTEXT $([ $(kubectl --context $CONTEXT get helmreleases -n $NAMESPACE $NAME -o=custom-columns=TYPE:.spec.suspend | tail -1) = "true" ] && echo "resume" || echo "suspend") helmrelease -n $NAMESPACE $NAME | less' | |
toggle-kustomization: | |
shortCut: Shift-T | |
confirm: true | |
scopes: | |
- kustomizations | |
description: Toggle to suspend or resume a Kustomization | |
command: sh | |
background: false | |
args: | |
- -c | |
- 'flux --context $CONTEXT $([ $(kubectl --context $CONTEXT get kustomizations -n $NAMESPACE $NAME -o=custom-columns=TYPE:.spec.suspend | tail -1) = "true" ] && echo "resume" || echo "suspend") kustomization -n $NAMESPACE $NAME | less' | |
reconcile-git: | |
shortCut: Shift-R | |
confirm: false | |
description: Flux reconcile | |
scopes: | |
- gitrepositories | |
command: sh | |
background: false | |
args: | |
- -c | |
- "flux --context $CONTEXT reconcile source git -n $NAMESPACE $NAME | less" | |
reconcile-oci: | |
shortCut: Shift-R | |
confirm: false | |
description: Flux reconcile | |
scopes: | |
- ocirepositories | |
command: sh | |
background: false | |
args: | |
- -c | |
- "flux --context $CONTEXT reconcile source oci -n $NAMESPACE $NAME | less" | |
reconcile-helm: | |
shortCut: Shift-R | |
confirm: false | |
description: Flux reconcile | |
scopes: | |
- helmrepositories | |
command: sh | |
background: false | |
args: | |
- -c | |
- "flux --context $CONTEXT reconcile source helm -n $NAMESPACE $NAME | less" | |
reconcile-hr: | |
shortCut: Shift-R | |
confirm: false | |
description: Flux reconcile | |
scopes: | |
- helmreleases | |
command: sh | |
background: false | |
args: | |
- -c | |
- "flux --context $CONTEXT reconcile helmrelease -n $NAMESPACE $NAME | less" | |
reconcile-ks: | |
shortCut: Shift-R | |
confirm: false | |
description: Flux reconcile | |
scopes: | |
- kustomizations | |
command: sh | |
background: false | |
args: | |
- -c | |
- "flux --context $CONTEXT reconcile kustomization -n $NAMESPACE $NAME | less" | |
trace: | |
shortCut: Shift-A | |
confirm: false | |
description: Flux trace | |
scopes: | |
- all | |
command: sh | |
background: false | |
args: | |
- -c | |
- "flux --context $CONTEXT trace $NAME --kind `echo $RESOURCE_NAME | sed -E 's/(s|es)$//g'` --api-version $RESOURCE_GROUP/$RESOURCE_VERSION --namespace $NAMESPACE $NAME | less" | |
dive: | |
shortCut: d | |
confirm: false | |
description: "Dive image" | |
scopes: | |
- containers | |
command: dive | |
background: false | |
args: | |
- $COL-IMAGE | |
#get all resources in a namespace using the krew get-all plugin | |
get-all: | |
shortCut: g | |
confirm: false | |
description: get-all | |
scopes: | |
- all | |
command: sh | |
background: false | |
args: | |
- -c | |
- "kubectl get-all -n $NAMESPACE | less" | |
watch-events: | |
shortCut: Shift-E | |
confirm: false | |
description: Get Events | |
scopes: | |
- all | |
command: sh | |
background: false | |
args: | |
- -c | |
- "watch -n 5 kubectl get events --context $CONTEXT --namespace $NAMESPACE --field-selector involvedObject.name=$NAME" | |
stern: | |
shortCut: Ctrl-L | |
confirm: false | |
description: "Logs <Stern>" | |
scopes: | |
- pods | |
command: stern | |
background: false | |
args: | |
- --tail | |
- 50 | |
- $FILTER | |
- -n | |
- $NAMESPACE | |
- --context | |
- $CONTEXT | |
helm-values: | |
shortCut: v | |
confirm: false | |
description: Values | |
scopes: | |
- helm | |
command: sh | |
background: false | |
args: | |
- -c | |
- "helm get values $COL-NAME -n $NAMESPACE --kube-context $CONTEXT | less" | |
jqlogs: | |
shortCut: Ctrl-J | |
confirm: false | |
description: "Logs (jq)" | |
scopes: | |
- po | |
command: kubectl | |
background: false | |
args: | |
- jq | |
- $NAME | |
- $NAMESPACE | |
- $CONTEXT | |
images: | |
shortCut: Ctrl-V | |
confirm: false | |
description: get images | |
scopes: | |
- pods | |
command: kubectl | |
background: false | |
args: | |
- images | |
- -n | |
- $NAMESPACE | |
- --context | |
- $CONTEXT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# This script allows us to edit our k9s stuff on the home directory under ~/.config/k9s instead of dealing with MacOS Library paths with spaces. | |
# It symlinks every file in the ~/.config/k9s to the $XDG_CONFIG_HOME where k9s is expecting configuration | |
cd ~/Library/Application\ Support/k9s | |
for i in /Users/rafaribe/.config/k9s/*; do | |
if [ "$i" != "/Users/$USER/.config/k9s/symlink_everything_here.sh" ]; then | |
echo "$i" | |
ln -s "$i" . | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment