Kubed uses kubectl
to interact with Kubernetes clusters, and
you can use multiple kubectl
contexts in Kubed to work
with different Kubernetes clusters in parallel. Within each context,
Kubed lets you work in multiple namespaces too. In general,
each buffer has its own local context and local namespace,
and Kubed commands use these local context and namespace by default.
This is similar to how different buffers have different values of
default-directory
(see (emacs)File Names), and how that
affects commands that interact with the filesystem.
For Kubed buffers that display a Kubernetes resource (see Display Resource) or a list of resources (see Browse Resources), the
buffer-local context and namespace are the context and namespace of
the resources the buffer displays. For non-Kubed buffers, the user
option kubed-default-context-and-namespace
determines the
default local context and namespace.
Default kubectl
context and Kubernetes namespace for Kubed
commands. The value of this option is either a cons cell
(context . namespace)
or nil
. If it is
nil
, Kubed initializes this option to a cons cell with the
current kubectl
context and namespace for that context on
the first time Kubed consults this option.
As mentioned above, most Kubed commands use the local context and namespace by default—it is also conventional for Kubed commands to let you choose a different namespace if you invoke them with a prefix argument (C-u), and to also let you choose a different context if you invoke them with a double prefix argument (C-u C-u).
The following functions return the local context and namespace for buffer in which you call them:
Return the local kubectl
context for the current buffer.
Return the local Kubernetes namespace for the current buffer.
Return the local context and namespace for the current buffer as a
cons cell (context . namespace)
.