From 2210b1410a9ba7acdd550dd4a3ad13709b02da9d Mon Sep 17 00:00:00 2001 From: ivuorinen Date: Mon, 8 Jul 2024 00:15:24 +0000 Subject: [PATCH] Update cheatsheets --- tldr/kubectl-config | 35 +++++++++++++++++++++++++++++++++++ tldr/who | 5 +---- 2 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 tldr/kubectl-config diff --git a/tldr/kubectl-config b/tldr/kubectl-config new file mode 100644 index 00000000..46bac384 --- /dev/null +++ b/tldr/kubectl-config @@ -0,0 +1,35 @@ +--- +syntax: markdown +tags: [tldr, common] +source: https://github.com/tldr-pages/tldr.git +--- +# kubectl config + +> Manage Kubernetes configuration (kubeconfig) files for accessing clusters via `kubectl` or the Kubernetes API. +> By default, the Kubernetes will get its configuration from `${HOME}/.kube/config`. +> See also: `kubectx`, `kubens`. +> More information: . + +- Get all contexts in the default kubeconfig file: + +`kubectl config get-contexts` + +- Get all clusters/contexts/users in a custom kubeconfig file: + +`kubectl config {{get-clusters|get-contexts|get-users}} --kubeconfig {{path/to/kubeconfig.yaml}}` + +- Get the current context: + +`kubectl config current-context` + +- Switch to another context: + +`kubectl config {{use|use-context}} {{context_name}}` + +- Delete clusters/contexts/users: + +`kubectl config {{delete-cluster|delete-context|delete-user}} {{cluster|context|user}}` + +- Permanently add custom kubeconfig files: + +`export KUBECONFIG="{{$HOME.kube/config:path/to/custom/kubeconfig.yaml}}" kubectl config get-contexts` diff --git a/tldr/who b/tldr/who index 456307cb..271421ef 100644 --- a/tldr/who +++ b/tldr/who @@ -6,16 +6,13 @@ source: https://github.com/tldr-pages/tldr.git # who > Display who is logged in and related data (processes, boot time). +> See also: `whoami`. > More information: . - Display the username, line, and time of all currently logged-in sessions: `who` -- Display information only for the current terminal session: - -`who am i` - - Display all available information: `who -a`