Command: kubectl
¶
Regarding Leverage Toolbox versions
To have this feature available, Leverage Toolbox versions 1.2.7-0.1.7
and up, or 1.3.5-0.1.7
and up must be used.
The kubectl
command is a wrapper for a containerized installation of kubectl. It provides the kubectl executable with specific configuration values required by Leverage.
It transparently handles authentication, whether it is Multi-Factor or via Single Sign-On, on behalf of the user in the commands that require it. SSO Authentication takes precedence over MFA when both are active.
Some sub-commands can only be run at layer level (discover
is an exception) and will not run anywhere else in the project.
The sub-command configure
can only be run at an EKS cluster layer level. Usually called cluster
.
The command can also be invoked via its shortened version kc
.
Configuring on first use
To start using this command, you must first run leverage kubectl configure
on a cluster
layer, to set up the credentials on the proper config file.
Discovering clusters
You can now run the discover
command from the root of the project to find and configure all the involved clusters.
run
¶
Usage ¶
leverage kubectl [commands] [arguments]
Equivalent to kubectl
.
All arguments given are passed as received to kubectl.
Example:
leverage kubectl get pods --namespace monitoring
shell
¶
Usage ¶
leverage kubectl shell
Open a shell into the Kubectl container in the current directory.
configure
¶
Usage ¶
leverage kubectl configure
Add the cluster from the EKS layer into your kubectl config file.
Equivalent to aws eks update-kubeconfig ...
.
discover
¶
Scans the current directory and its subdirectories for Kubernetes (EKS) cluster metadata files. It then presents a menu to the user to select a cluster, which will be configured in the user's kubectl
configuration file.
The command searches for files named metadata.yaml
in the directory tree.
v1.18.0 version of the Reference Architecture is required
The metadata files are now autogenerated by the Reference Architecture. If you are using a version of the Reference Architecture prior to v1.18.0, you will need to create the metadata files manually.
This command can be run on any layer or from the root of the project. The current directory is used as the starting point for the search.