This kubectl extension allows to quickly connect to an existing karbon cluster without the need to connect to Prism UI. It uses the Karbon API to get kubeconfig file and install it on your local system. The kubectl extension can be used on Linux, MacOS and Windows.
https://github.com/nutanix/kubectl-karbon/assets/180613/392310a8-02e7-4aca-a9ea-1e50fddec682
See the table below for all kubectl-karbon installation methods:
Installation method | Operating systems |
---|---|
Kubectl Krew Plugins | Linux, MacOS, Windows |
Homebrew or Linuxbrew package | Linux, MacOS |
Manual | Linux, MacOS, Windows |
After installing, the tools will be available as kubectl karbon
.
You can install and use Krew kubectl
plugin manager to get the karbon
plugin .
kubectl krew install karbon
Keep up-to-date with kubectl krew upgrade karbon
(or kubectl krew upgrade to upgrade everything)
You can install with Homebrew for macOS or LinuxBrew for Linux
brew install nutanix/tap/kubectl-karbon
Keep up-to-date with brew upgrade kubectl-karbon
(or brew upgrade to upgrade everything)
kubectl karbon
MacOS X notes for security error
Depending of your OS settings when you install you binary manually we must launch the following command:
xattr -r -d com.apple.quarantine /usr/local/bin/kubectl-karbon
kubectl karbon help
Help about any commandkubectl karbon list
Get the list of k8s clusterskubectl karbon login
Authenticate user with Nutanix Prism Central, create kubeconfig file, get ssh key/cert, …kubectl karbon logout
Remove kubeconfig file, remove ssh key/cert file, clean ssh-agent …kubectl karbon version
Print the version of the pluginYou can specify a config file to define your seetings. The default is $HOME/.kubectl-karbon.yaml and you can use another one with the --config
flag.
server: servername
port: 9440
cluster: karbon_cluster_name
user: admin
insecure: true
verbose: false
debug: false
force: false
merge: false
kubie: false
keyring: false
#ssh-agent: false
#ssh-file: false
#kubie-path: ~/.kube/.kubie/
#kubeconfig: /path/.kube/config
config file example
All entries are optional, you can define only what you need to enforce.
you can also use the following environement variable
KARBON_SERVER
KARBON_PORT
KARBON_CLUSTER
KARBON_USER
KARBON_INSECURE
KARBON_VERBOSE
KARBON_DEBUG
KARBON_FORCE
KARBON_MERGE
KARBON_PASSWORD
KARBON_KUBIE
KARBON_KUBIE_PATH
KARBON_SSH_AGENT
KARBON_SSH_FILE
KARBON_KEYRING
KUBECONFIG
precedence is
FLAGS
=> ENV
=> CONFIG FILE
=> DEFAULT
You can use the --force
option to overwrite any existing file(s) like kubeconfig or ssh key/cert.
By default this tools never stored the password.
You can use the KARBON_PASSWORD
env variable.
You can also use the --keyring
option to save and retrieve your password from the system keyring. It supports OS X, Linux/BSD (dbus) and Windows.
In all other cases password should be provided in an interactive way.
During login, allow SSH key and cert retrieval.
The key and cert can be added to the running ssh-agent (--ssh-agent
) or saved in file inside the ~/.ssh/ directory (--ssh-file
).
Allows full integration with Kube or Kubie who have support for split configuration files, meaning it can load Kubernetes contexts from multiple files.
When this mode is active (--kubie
) each kubeconfig file is stored as an independent file in the kubie-path directoy (default ~/.kube/kubie/cluster_name.yaml
)
The merge
feature allows you to add a new context to an existing kubeconfig
file instead of overwriting it. This is useful when you have multiple Kubernetes clusters and want to manage them using the same kubeconfig
file.
To use the merge
feature, simply pass the --merge
flag when running the login
command:
kubectl-karbon login --username <username> --password <password> --merge
kubectl-karbon is currently using go v1.16 or above. In order to build kubectl-karbon from source you must:
Build and run the executable
make build && make install